Build Authors Cache #92
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: Build Authors Cache | |
on: | |
schedule: | |
- cron: '0 16 * * *' | |
workflow_dispatch: | |
env: | |
TZ: Asia/Shanghai | |
jobs: | |
build: | |
name: Build Authors Cache | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: 16.x | |
- name: Cache node_modules | |
uses: actions/cache@v2 | |
id: cache | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('yarn.lock') }} | |
restore-keys: ${{ runner.os }}-node- | |
- name: Install Dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: yarn --frozen-lockfile --production | |
- name: Fetch Authors | |
run: | | |
rm -rf authors.json | |
# Fetch authors list with 10 concurrency requests | |
yarn ts-node-esm scripts/post-build/commits-info/fetch-authors-cache.ts 10 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Commit Authors Cache | |
run: | | |
git switch --orphan authors-cache | |
git add -f authors.json | |
git config user.name github-actions | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git commit -m "Update authors cache on $(date '+%Y-%m-%d %H:%M:%S')" | |
git push -f origin authors-cache | |