File tree Expand file tree Collapse file tree 1 file changed +18
-12
lines changed Expand file tree Collapse file tree 1 file changed +18
-12
lines changed Original file line number Diff line number Diff line change 1
1
name : Generate README with Hype
2
2
on :
3
- push :
4
- branches :
5
- - main
3
+ pull_request :
4
+ types : [opened, synchronize, reopened]
6
5
jobs :
7
6
build :
8
7
runs-on : ubuntu-latest
8
+ permissions :
9
+ contents : write
10
+ pull-requests : write
9
11
steps :
10
12
- uses : actions/checkout@v4
11
13
with :
12
- repository : ${{ github.event.pull_request.head.repo.full_name }}
13
- ref : ${{ github.event.pull_request.head.ref }}
14
+ ref : ${{ github.head_ref }}
14
15
- name : Set up Go
15
16
uses : actions/setup-go@v4
16
17
with :
@@ -20,10 +21,15 @@ jobs:
20
21
run : go install github.com/gopherguides/hype/cmd/hype@latest
21
22
- name : Run hype
22
23
run : hype export -format=markdown -f hype.md -o README.md
23
- - name : Commit README back to the repo
24
- run : |-
25
- git rev-parse --abbrev-ref HEAD
26
- git config user.name 'GitHub Actions'
27
- git config user.email '[email protected] '
28
- git diff --quiet || (git add README.md && git commit -am "Updated README")
29
- git push origin ${{github.event.pull_request.head.ref}}
24
+ - name : Check for changes
25
+ id : git-check
26
+ run : |
27
+ git diff --quiet README.md || echo "changed=true" >> $GITHUB_OUTPUT
28
+ - name : Commit README changes if any
29
+ if : steps.git-check.outputs.changed == 'true'
30
+ run : |
31
+ git config --local user.email "github-actions[bot]@users.noreply.github.com"
32
+ git config --local user.name "github-actions[bot]"
33
+ git add README.md
34
+ git commit -m "Update README.md with latest Hype changes"
35
+ git push
You can’t perform that action at this time.
0 commit comments