Update References #113
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: Update References | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 0 * * mon" | |
push: | |
paths: | |
- .github/workflows/update-references.yml | |
- data/generate-references.sh | |
- data/references.yml | |
jobs: | |
update: | |
name: Update | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Update references | |
run: | | |
# Ensure comments are present | |
grep -Pzq '<!-- references:start -->(\n|.)*<!-- references:end -->' README.md | |
# Get content | |
content=$(./data/generate-references.sh) | |
# Replace content within comments with generated data | |
awk -v content="$content" -i inplace ' | |
BEGIN {p=1} | |
/^<!-- references:start -->/{print;print content;p=0} | |
/^<!-- references:end -->/{p=1} | |
p' README.md | |
- name: Commit changes | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: Update references |