1
+ name : " auto-readme"
2
+ on :
3
+ workflow_dispatch : {}
4
+
5
+ # # Added pull_request to register workflow from the PR.
6
+ # # Read more https://stackoverflow.com/questions/63362126/github-actions-how-to-run-a-workflow-created-on-a-non-master-branch-from-the-wo
7
+ pull_request :
8
+ branches-ignore : ['*']
9
+
10
+ schedule :
11
+ # Example of job definition:
12
+ # .---------------- minute (0 - 59)
13
+ # | .------------- hour (0 - 23)
14
+ # | | .---------- day of month (1 - 31)
15
+ # | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
16
+ # | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
17
+ # | | | | |
18
+ # * * * * * user-name command to be executed
19
+
20
+ # Update README.md nightly at 4am UTC
21
+ - cron : ' 0 4 * * *'
22
+
23
+ jobs :
24
+ update :
25
+ runs-on : ubuntu-latest
26
+ steps :
27
+ - uses : actions/checkout@v2
28
+
29
+ - name : Find default branch name
30
+ id : defaultBranch
31
+ shell : bash
32
+ env :
33
+ GITHUB_TOKEN : " ${{ secrets.GITHUB_TOKEN }}"
34
+ run : |
35
+ default_branch=$(gh repo view --json defaultBranchRef --jq .defaultBranchRef.name)
36
+ printf "::set-output name=defaultBranch::%s\n" "${default_branch}"
37
+ printf "defaultBranchRef.name=%s\n" "${default_branch}"
38
+
39
+ - name : Update readme
40
+ shell : bash
41
+ id : update
42
+ env :
43
+ GITHUB_TOKEN : " ${{ secrets.GITHUB_TOKEN }}"
44
+ DEF : " ${{ steps.defaultBranch.outputs.defaultBranch }}"
45
+ run : |
46
+ make init
47
+ make readme/build
48
+ # Ignore changes if they are only whitespace
49
+ if ! git diff --quiet README.md && git diff --ignore-all-space --ignore-blank-lines --quiet README.md; then
50
+ git restore README.md
51
+ echo Ignoring whitespace-only changes in README
52
+ fi
53
+
54
+ - name : Create Pull Request
55
+ # This action will not create or change a pull request if there are no changes to make.
56
+ # If a PR of the auto-update/readme branch is open, this action will just update it, not create a new PR.
57
+ uses :
cloudposse/actions/github/[email protected]
58
+ with :
59
+ token : ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
60
+ commit-message : Update README.md and docs
61
+ title : Update README.md and docs
62
+ body : |-
63
+ ## what
64
+ This is an auto-generated PR that updates the README.md and docs
65
+
66
+ ## why
67
+ To have most recent changes of README.md and doc from origin templates
68
+
69
+ branch : auto-update/readme
70
+ base : ${{ steps.defaultBranch.outputs.defaultBranch }}
71
+ delete-branch : true
72
+ labels : |
73
+ auto-update
74
+ no-release
75
+ readme
0 commit comments