Skip to content

Commit 9fb3407

Browse files
committed
manually commit and push changes
manually commit and push changes
1 parent 04d1659 commit 9fb3407

File tree

1 file changed

+42
-4
lines changed

1 file changed

+42
-4
lines changed

.github/workflows/release.yaml

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,54 @@ 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
26+
27+
- name: Save HEAD SHA before helm-docs
28+
id: save-sha
29+
run: |
30+
echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
2031
2132
- name: Render helm docs inside the README.md and push changes back to PR branch
2233
uses: losisin/helm-docs-github-action@v1
2334
with:
2435
output-file: ../../README.md
2536
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"
37+
git-push: false
38+
39+
- name: Check for README changes
40+
id: check-changes
41+
run: |
42+
if git diff --quiet ${{ steps.save-sha.outputs.sha }} -- README.md
43+
then
44+
echo "has_changes=false" >> $GITHUB_OUTPUT
45+
else
46+
echo "has_changes=true" >> $GITHUB_OUTPUT
47+
fi
48+
49+
- name: Commit and push
50+
if: steps.check-changes.outputs.has_changes == 'true'
51+
run: |
52+
git config --global user.name "Comet Actions"
53+
git config --global user.email "[email protected]"
54+
55+
# stage any file changes to be committed
56+
git add README.md
57+
58+
# make commit with staged changes
59+
git commit -m 'Update README.md with helm-docs'
60+
61+
- name: Push changes
62+
if: success()
63+
uses: ad-m/github-push-action@master
64+
with:
65+
github_token: ${{ secrets.COMET_ACTIONS_PAT }}
66+
branch: ${{ github.event.master_branch }}
67+
3068
release:
3169
runs-on: ubuntu-latest
3270
needs:

0 commit comments

Comments
 (0)