feat: regenerate asset data workflow #6
Workflow file for this run
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: Regenerate Asset Data and PR | |
on: | |
# Allows manual trigger for testing. Don't forget to remove/comment me and uncomment the cron job below when happy | |
workflow_dispatch: | |
pull_request: | |
# schedule: | |
# - cron: '0 0 * * *' # Schedule to run automatically, uncomment for production use | |
jobs: | |
regenerate-and-create-pr: | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.head.ref == 'feat_regenerate_asset_data_gh_action' | |
steps: | |
- name: Checkout develop | |
uses: actions/checkout@v3 | |
with: | |
ref: develop # Ensure we're starting from clean upstream develop branch | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: 'yarn' | |
- name: Yarn Install | |
run: yarn && yarn build:packages | |
- name: Generate asset data | |
run: yarn env dev && yarn run generate:asset-data | |
- name: Create new feature branch | |
run: git checkout -B feat_regenerate_asset_data | |
- name: Commit changes | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add -A | |
git diff --staged --quiet || git commit -m "feat: regenerate asset data" | |
# This will only works once - don't forget to slap some -f flag here when confirmed happy | |
git push -u origin feat_regenerate_asset_data | |
- name: Create Pull Request | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh pr create --base develop --head feat_regenerate_asset_data --title "feat: regenerate asset data" --body "Generated from CI." | |