Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions .github/workflows/nrg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Regenerate READMEs
on:
push:
branches: [master]
paths:
- 'README.src.md'
- '.github/workflows/nrg.yml'
pull_request:
paths:
- 'README.src.md'
- 'README.md'
- 'README.zh_CN.md'
- '.github/workflows/nrg.yml'
permissions:
contents: read
jobs:
regenerate:
if: github.event_name == 'push'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: nanolaba/nrg-action@9fae0216ed0c828f520e555912776ca624d84fb5 # v1
with:
file: README.src.md
nrg-version: '1.2'
- name: Commit regenerated READMEs
run: |
paths=("README.md" "README.zh_CN.md")
status="$(git status --porcelain -- "${paths[@]}")"
if [ -n "$status" ]; then
changed=$(printf '%s\n' "$status" | sed 's/^...//' | sed 's/^/ - /')
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add -A -- "${paths[@]}"
git commit -m "docs: regenerate READMEs from README.src.md" \
-m $'Files updated:\n'"$changed"
git push
fi

drift-check:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: nanolaba/nrg-action@9fae0216ed0c828f520e555912776ca624d84fb5 # v1
with:
file: README.src.md
mode: check
nrg-version: '1.2'
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
<!-- This file was automatically generated by Nanolaba Readme Generator (NRG) 1.2 -->
<!-- Visit https://github.com/nanolaba/readme-generator for details -->

Table of Contents ([中文说明](./README.zh_CN.md))
=================

Expand Down
Loading