generated from sapphiredev/sapphire-template
-
-
Notifications
You must be signed in to change notification settings - Fork 37
48 lines (46 loc) · 1.92 KB
/
auto-updater.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: Automatic Data Update
on:
workflow_dispatch:
schedule:
- cron: '0 2 * * *'
jobs:
DataUpdater:
name: Automatic Data Update
runs-on: ubuntu-latest
if: github.repository_owner == 'sapphiredev'
steps:
- name: Checkout Project
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3
- name: Use Node.js v18
uses: actions/setup-node@2fddd8803e2f5c9604345a0b591c3020ee971a93 # tag=v3
with:
node-version: 18
cache: yarn
registry-url: https://registry.yarnpkg.com/
- name: Install Dependencies
run: yarn --immutable
- name: Build packages for script
run: yarn turbo run build --filter=@sapphire/timestamp --filter=@sapphire/fetch --filter=@sapphire/prettier-config
- name: Run updater
run: node --experimental-json-modules scripts/twemoji-regex-updater.mjs
- name: Run prettier on the code
run: yarn format
- name: Commit any changes and create a pull request
env:
GITHUB_USER: github-actions[bot]
GITHUB_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git add .;
if git diff-index --quiet HEAD --; then
echo "No changes to commit, exiting with code 0"
exit 0;
else
git remote set-url origin "https://${GITHUB_TOKEN}:x-oauth-basic@github.com/${GITHUB_REPOSITORY}.git";
git config --local user.email "${GITHUB_EMAIL}";
git config --local user.name "${GITHUB_USER}";
git checkout -b update-twemoji-regex/$(date +%F-%H-%M);
git commit -sam "feat: update Twemoji Regex";
git push --set-upstream origin $(git rev-parse --abbrev-ref HEAD)
gh pr create -t "feat: update twemoji regex" -b "*bleep bloop* I updated the Twemoji Regex" -B main;
fi