add pink speedy (#2887) #155
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: Update cards, screenshots, and fix code style | |
on: | |
push: | |
branches: | |
- master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SKIP_REST: false | |
jobs: | |
update-cards-and-screenshots-and-fix-code-style: | |
runs-on: ubuntu-latest | |
# Don't push changes to main branches in forks as this causes merge conflicts | |
if: ${{ !github.event.repository.fork }} | |
permissions: | |
contents: write | |
# running two copies of this job at once can create race conditions | |
# and will usually cause the most recent workflow to fail. It is | |
# preferable to always have the most up to date workflow succeed | |
# so we cancel this job whenever a newer one is started. | |
concurrency: | |
group: post-merge | |
cancel-in-progress: true | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
- name: Install job dependencies | |
run: npm install | |
- name: Configure Git | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "[email protected]" | |
- name: Generate cards.json | |
run: node generators/generateCards.js | |
- name: Check for cards changes | |
run: | | |
if git diff --quiet public/cards.json; then | |
echo "No changes to commit" | |
echo "SKIP_REST=true" >> $GITHUB_ENV | |
else | |
git add public/cards.json | |
git commit -m "(CI) cards.json Generation" | |
fi | |
- name: Generate screenshots | |
if: env.SKIP_REST != 'true' | |
run: | | |
node generators/generateScreenshot.js | |
git add Art/**/icon.png | |
git commit -m "(CI) Screenshot Generation" || echo "No changes to commit" | |
- name: Push changes | |
if: env.SKIP_REST != 'true' | |
run: git push origin master | |
- name: Run Prettier to fix code style | |
id: prettier-run | |
run: | | |
npm run prettier:fix | |
echo "filecount=$(git status -s -uno | wc -L)" >> $GITHUB_OUTPUT | |
- name: Commit Prettier changes | |
if: ${{ steps.prettier-run.outputs.filecount > 0 }} | |
run: | | |
git add . | |
git commit -m "(CI) Run Prettier" | |
git push origin master |