17
17
name : Update README.md
18
18
on :
19
19
workflow_dispatch :
20
- pull_request :
21
- types :
22
- - opened
23
- - reopened
24
- - synchronize
20
+ push :
21
+ branches :
22
+ - main
25
23
paths :
26
24
- ' **/*.mjs'
27
25
- ' **/*.js'
28
26
- ' **/package*.json'
27
+ - ' **/README.md.template'
29
28
defaults :
30
29
run :
31
30
shell : bash
31
+ permissions :
32
+ contents : read
32
33
jobs :
33
34
update :
34
35
runs-on : [self-hosted, Linux, medium, ephemeral]
35
- permissions :
36
- # Give the default GITHUB_TOKEN write permission to commit and push the
37
- # added or changed files to the repository.
38
- contents : write
39
36
steps :
40
37
- name : Checkout Code for Push
41
38
uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
42
- if : github.event_name == 'push'
43
39
with :
44
40
fetch-depth : 0
45
-
46
- # https://github.com/actions/checkout/issues/124
47
- - name : Checkout Code for Pull Request
48
- uses : actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
49
- if : github.event_name == 'pull_request'
50
- with :
51
- fetch-depth : 0
52
- ref : ${{ github.event.pull_request.head.ref }}
41
+ token : ${{secrets.GH_ACCESS_TOKEN}}
53
42
54
43
- name : Setup Node
55
44
uses : actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
@@ -86,13 +75,14 @@ jobs:
86
75
87
76
- name : Update README.md
88
77
run : |
78
+ set -x
89
79
npm install -g @hashgraph/solo
90
80
which solo
91
81
92
82
export SOLO_CLUSTER_NAME=solo
93
83
export SOLO_NAMESPACE=solo
94
84
export SOLO_CLUSTER_SETUP_NAMESPACE=solo-cluster
95
-
85
+
96
86
echo "Perform the following kind and solo commands and save output to environment variables"
97
87
98
88
export KIND_CREATE_CLUSTER_OUTPUT=$( kind create cluster -n "${SOLO_CLUSTER_NAME}" 2>&1 | tee test.log )
@@ -133,6 +123,7 @@ jobs:
133
123
sed -i 's/\[33m//g' README.md
134
124
sed -i 's/\[39m//g' README.md
135
125
egrep -v '↓|❯|•' README.md > README.md.tmp && mv README.md.tmp README.md
126
+ set +x
136
127
137
128
- name : Check README.md Changes
138
129
id : check-readme-changes
@@ -145,7 +136,7 @@ jobs:
145
136
146
137
DELETIONS=$(echo $CHANGES | grep -o '[0-9]\+' | tail -1)
147
138
echo "Deletions: $DELETIONS"
148
-
139
+
149
140
# Calculate total lines changed if INSERTIONS and DELETIONS are not empty
150
141
if [ -z "$INSERTIONS" ]; then
151
142
INSERTIONS=0
@@ -156,15 +147,24 @@ jobs:
156
147
157
148
TOTAL_LINES_CHANGED=$(($INSERTIONS + $DELETIONS))
158
149
echo "Total README lines changed: $TOTAL_LINES_CHANGED"
159
- echo "TOTAL_LINES_CHANGED=$TOTAL_LINES_CHANGED" >> "${GITHUB_OUTPUT}"
160
150
161
- # Signed Commits by actions https://github.com/actions/runner/issues/667
151
+ - name : Import GPG key
152
+ uses : crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # v6.1.0
153
+ with :
154
+ gpg_private_key : ${{ secrets.GH_ACCESS_GPG_KEY }}
155
+ passphrase : ${{ secrets.GH_ACCESS_PASSPHRASE }}
156
+ git_user_signingkey : true
157
+ git_commit_gpgsign : true
158
+
162
159
- name : Commit README.md Changes
163
- if : ${{ steps.check-readme-changes.outputs.TOTAL_LINES_CHANGED > 20 }}
164
- uses :
planetscale/[email protected]
160
+ uses : stefanzweifel/git-auto-commit-action@8621497c8c39c72f3e2a999a26b4ca1b5058a842 # v5.0.1
165
161
with :
166
- commit_message : " auto update README.md"
167
- repo : ${{ github.repository }}
168
- branch : ${{ github.head_ref || github.ref_name }}
162
+ commit_message : " auto update README.md [skip ci]"
163
+ commit_options : ' --no-verify --signoff'
164
+ add_options : ' -u'
165
+ file_pattern : ' README.md'
166
+ commit_user_name : Swirlds Automation
167
+ commit_user_email :
[email protected]
168
+ commit_author :
Swirlds Automation <[email protected] >
169
169
env :
170
- GITHUB_TOKEN : ${{secrets.GITHUB_TOKEN }}
170
+ GITHUB_TOKEN : ${{secrets.GH_ACCESS_TOKEN }}
0 commit comments