Automatic Data Update #892
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v4 | |
- name: Install dependencies | |
uses: sapphiredev/.github/actions/install-yarn-dependencies@main | |
with: | |
node-version: 20 | |
- name: Run updater | |
run: yarn au:twemojis | |
- 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 |