Rotate emojiData #12
Workflow file for this run
This file contains hidden or 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: Rotate emojiData | |
on: | |
schedule: | |
- cron: "*/5 * * * *" | |
workflow_dispatch: | |
concurrency: | |
group: rotate-emoji-group | |
jobs: | |
sync-emojis-from-github: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# TODO change to develop | |
ref: rotate-emoji-test-dev | |
- name: Setup Node.js v20 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci --ignore-scripts | |
- name: Fetch emojiData | |
run: npm run build:emoji | |
- name: Check for changes | |
run: | | |
if git diff --quiet -- "src/core/render/emoji-data.js"; then | |
echo "No changes Found. Skipping PR creation." | |
else | |
echo "Changes detected in emoji-data.js. Creating PR." | |
current_date=$(date +'%Y-%m-%d') | |
branch_name="update-emoji-data-$current_date" | |
pr_title="update(emoji): sync emojiData and find update emojis in [$current_date]" | |
git config --global user.email "actions@github.com" | |
git config --global user.name "GitHub Actions" | |
git checkout -b $branch_name | |
git add src/core/render/emoji-data.js | |
git add docs/emoji.md | |
git commit -m "update(emoji): sync emojiData and find update emojis in [$current_date]" | |
unique_branch_name=$branch_name-$(git log -1 --pretty=%h) | |
git checkout -b $unique_branch_name | |
git push origin $unique_branch_name | |
gh pr create --title "$pr_title" --body "Found updated github emojis need to sync, PTAL @docsifyjs/reviewers :robot:." --base develop | |
fi | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |