[📥️] Download #820
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: '[📥️] Download' | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 8-18/2 * * 1-5' # At minute 0 past every 2nd hour from 8 through 18 on every day-of-week from Monday through Friday. | |
- cron: '0 0 * * *' # Every day at midnight | |
jobs: | |
build: | |
name: '[📥️] Download' | |
runs-on: 'ubuntu-latest' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # checkout full history | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Set yarn version to latest stable | |
run: | | |
corepack enable | |
yarn set version latest | |
- name: Get yarn cache directory path | |
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT | |
- name: Restore Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
${{ steps.yarn_cache_dir.outputs.dir }} | |
**/node_modules | |
**/.eslintcache | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock', '.yarnrc.yml') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install dependencies | |
run: | | |
yarn install --immutable | |
- name: Run Download Script | |
run: | | |
yarn download | |
- name: Show changes | |
run: | | |
git --no-pager diff --color-words | |
- name: Check if there are changes | |
run: | | |
echo "CHANGED_FILES=$(git status -s | wc -l)" >> $GITHUB_ENV | |
- name: Commit & Push changes | |
if: github.ref == 'refs/heads/master' && env.CHANGED_FILES > 1 | |
uses: actions-js/push@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
message: 'automated update' | |
branch: 'master' |