Skip to content

Commit 45543d1

Browse files
committed
Enhance GitHub Actions workflow to automate commits for deployment previews in PRs
Signed-off-by: Lee Calcote <[email protected]>
1 parent bb5e036 commit 45543d1

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

.github/workflows/static.yml

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,33 @@ jobs:
5151
id: deployment
5252
uses: actions/deploy-pages@v4
5353

54-
- name: Set up Git user
55-
if: github.event.pull_request.head.repo.full_name != github.repository
56-
run: |
57-
git config user.name "l5io"
58-
git config user.email "[email protected]"
59-
- name: Push branch to master repo
54+
55+
56+
57+
58+
59+
60+
- name: Commit changes
6061
if: github.event.pull_request.head.repo.full_name != github.repository
61-
run: |
62-
git remote add main-origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
63-
git push main-origin HEAD:refs/heads/pr-preview/${{ github.event.pull_request.number }} --force
62+
uses: stefanzweifel/git-auto-commit-action@v5
63+
with:
64+
file_pattern: mesheryctl/helpers server/helpers/ **.go docs/
65+
commit_user_name: l5io
66+
commit_user_email: [email protected]
67+
commit_author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
68+
commit_options: "--signoff"
69+
commit_message: "Deployment preview for PR ${{ github.event.pull_request.number }}"
70+
71+
# - name: Set up Git user
72+
# if: github.event.pull_request.head.repo.full_name != github.repository
73+
# run: |
74+
# git config user.name "l5io"
75+
# git config user.email "[email protected]"
76+
# - name: Push branch to master repo
77+
# if: github.event.pull_request.head.repo.full_name != github.repository
78+
# run: |
79+
# git remote add main-origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
80+
# git push main-origin HEAD:refs/heads/pr-preview/${{ github.event.pull_request.number }} --force
6481

6582

6683
- name: Comment Preview URL on PR

0 commit comments

Comments
 (0)