Fetch Candidate Media #152
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: Fetch Candidate Media | |
on: | |
schedule: | |
- cron: "50 4 * * *" # 11:50 GMT+7 | |
- cron: "50 10 * * *" # 17:50 GMT+7 | |
- cron: "50 16 * * *" # 23:50 GMT+7 | |
workflow_dispatch: | |
jobs: | |
media-fetching: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
actions: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: npm | |
- name: Install dependencies | |
run: npm i | |
working-directory: ./scripts/media-fetcher | |
- name: Fetch candidate media | |
run: npm start | |
working-directory: ./scripts/media-fetcher | |
env: | |
CANDIDATE_MEDIA_CSV_URL: ${{ vars.CANDIDATE_MEDIA_CSV_URL }} | |
GOOGLE_API_SERVICE_ACCOUNT_CREDENTIALS: ${{ secrets.GOOGLE_API_SERVICE_ACCOUNT_CREDENTIALS }} | |
- name: Delete previous cache | |
run: | | |
gh extension install actions/gh-actions-cache | |
set +e | |
gh actions-cache delete candidate-media --confirm | |
echo "Done" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Cache candidate media | |
uses: actions/cache/save@v4 | |
with: | |
key: candidate-media | |
path: public/candidate-media |