-
-
Notifications
You must be signed in to change notification settings - Fork 0
35 lines (30 loc) · 1.11 KB
/
diff-checker.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
name: diff checker
on:
schedule:
- cron: '0 23 * * *'
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
- name: Check diff
id: check-diff
run: |
GOBIN=${PWD}/bin go install github.com/suntong/html2md@latest
curl https://go.dev/doc/faq | ./bin/html2md -i -G | sed -n -e 106,2255p > original.md
echo "diff=$(git diff --name-only original.md | wc -l | xargs )" >> $GITHUB_OUTPUT
- name: Create a PR if diff exists
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: ${{ steps.check-diff.outputs.diff != 0 }}
run: |
git config user.name ${GITHUB_ACTOR}
git config user.email ${GITHUB_ACTOR}@users.noreply.github.com
branch=feature/diff-$(TZ=JST-9 date +'%Y-%m-%d')
git switch -c ${branch}
git add original.md
git commit --message "update diff"
git push origin ${branch}
gh pr create -B main -t "[$(date +'%Y-%m-%d')] Update site info" --body "Check the diff content"