AutomatedUpdate #26
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: AutomatedUpdate | |
on: | |
workflow_dispatch: | |
pull_request: | |
types: [opened, synchronize] | |
paths: | |
- scripts/update-pwa.js | |
schedule: | |
- cron: '0 0 * * 1' | |
env: | |
NODE_VERSION: 18.16.0 | |
jobs: | |
CancelPrevious: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cancel Old Pipeline | |
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master' && github.ref != 'refs/heads/develop'" | |
uses: rokroskar/workflow-run-cleanup-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
AutomatedUpdate: | |
needs: [CancelPrevious] | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
steps: | |
- uses: actions/checkout@v3 | |
if: github.ref != 'refs/heads/develop' | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- uses: actions/checkout@v3 | |
if: github.ref == 'refs/heads/develop' | |
with: | |
ref: develop | |
- name: Use Node.js 16 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
cache: npm | |
- name: Create Update Branch | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub CI" | |
git switch -c update/automated-update | |
- name: Run Update Script | |
run: node scripts/update-pwa | |
- name: Run Automated Fixes | |
run: | | |
npm run lint -- --fix | |
npm run format | |
git add . | |
git commit -m "chore: post update fixes" --allow-empty | |
- name: Run Tests | |
run: npm run test | |
- name: Push Update Branch | |
if: always() | |
run: git push --force origin update/automated-update |