Skip to content

Commit

Permalink
feat(refresh-coda-cache workflow): add workflow. (#356)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrhender committed Feb 5, 2024
1 parent 2c45713 commit e719fc1
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/refresh-coda-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Refresh Coda Cache
on:
workflow_dispatch
jobs:
refresh-coda:
runs-on: ubuntu-latest
env:
CODA_TOKEN: ${{ secrets.CODA_TOKEN }}
filepath: app/mocks/coda-responses
filename: cached-coda-responses.json
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- id: download
name: Download updated data from Coda
run: |
npm ci
npm run refresh-test-data
OUTPUT=$(git diff --name-only | tail -1)
echo "::set-output name=gitdiff::$OUTPUT"
- id: check
name: Check for changes
run: |
echo "git diff --name-only | tail -1 >>> ${{ steps.download.outputs.gitdiff }}"
echo "cached data changed = ${{ contains( steps.download.outputs.gitdiff, env.filename ) }}"
echo "::set-output name=changed::${{ contains( steps.download.outputs.gitdiff, env.filename ) }}"
- if: steps.check.outputs.changed == 'true'
name: Commit files
run: |
git config --local user.name ${{ github.actor }}
git config --local user.email ${{ github.actor }}@users.noreply.github.com
git stage ${{ env.filepath }}/${{ env.filename }}
git commit -m "Update ${{ env.filename }}"
- if: steps.check.outputs.changed == 'true'
name: Push updated files on GitHub
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.PUSH_AUTH_TOKEN }}

0 comments on commit e719fc1

Please sign in to comment.