-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (53 loc) · 1.83 KB
/
generate-readme.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Generate readme
on:
workflow_dispatch:
push:
branches:
- master
jobs:
generate:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
persist-credentials: false
fetch-depth: 0
- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: ./.github/generate-readme/.node-version
- name: Setup pnpm
uses: pnpm/action-setup@v2
id: pnpm-install
with:
run_install: false
package_json_file: ./.github/generate-readme/package.json
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: Setup pnpm cache
uses: actions/cache@v4
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
working-directory: ./.github/generate-readme/
run: |
pnpm install --frozen-lockfile --prefer-frozen-lockfile
- name: Generate README file
working-directory: ./.github/generate-readme/
run: pnpm start --target ../../ --output ../../README.md
- name: Commit & Push
run: |
git remote set-url origin https://github-actions:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}
git config --global user.name "GitHub Action"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git status | grep modified && git add -A && git commit -v -m "feat: Updated README.md [skip ci]" || true
git push origin HEAD:${GITHUB_REF};
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}