Skip to content

Commit 482700d

Browse files
committed
manually commit and push changes
manually commit and push changes
1 parent 04d1659 commit 482700d

File tree

1 file changed

+37
-4
lines changed

1 file changed

+37
-4
lines changed

.github/workflows/release.yaml

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,49 @@ jobs:
1717
fetch-depth: 0
1818
fetch-tags: true
1919
ref: main
20+
persist-credentials: false
21+
22+
- name: Save HEAD SHA before helm-docs
23+
id: save-sha
24+
run: |
25+
echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
2026
2127
- name: Render helm docs inside the README.md and push changes back to PR branch
2228
uses: losisin/helm-docs-github-action@v1
2329
with:
2430
output-file: ../../README.md
2531
template-files: README.md.gotmpl
26-
git-push: true
27-
git-push-user-name: "CometActions"
28-
git-push-user-email: "[email protected]"
29-
git-commit-message: "Update Helm documentation"
32+
git-push: false
33+
34+
- name: Check for README changes
35+
id: check-changes
36+
run: |
37+
if git diff --quiet ${{ steps.save-sha.outputs.sha }} -- README.md
38+
then
39+
echo "has_changes=false" >> $GITHUB_OUTPUT
40+
else
41+
echo "has_changes=true" >> $GITHUB_OUTPUT
42+
fi
43+
44+
- name: Commit and push
45+
if: steps.check-changes.outputs.has_changes == 'true'
46+
run: |
47+
git config --global user.name "Comet Actions"
48+
git config --global user.email "[email protected]"
49+
50+
# stage any file changes to be committed
51+
git add README.md
52+
53+
# make commit with staged changes
54+
git commit -m 'Update README.md with helm-docs'
55+
56+
- name: Push changes
57+
if: success()
58+
uses: ad-m/github-push-action@master
59+
with:
60+
github_token: ${{ secrets.COMET_ACTIONS_PAT }}
61+
branch: ${{ github.event.master_branch }}
62+
3063
release:
3164
runs-on: ubuntu-latest
3265
needs:

0 commit comments

Comments
 (0)