Skip to content

Commit d71e8dd

Browse files
Workflow
1 parent 67b6301 commit d71e8dd

File tree

1 file changed

+37
-8
lines changed

1 file changed

+37
-8
lines changed

.github/workflows/publish_release.yml

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,24 @@ jobs:
1414
- name: Checkout repo
1515
uses: actions/checkout@v4
1616

17+
- name: Generate a token
18+
id: generate-token
19+
uses: actions/create-github-app-token@v2
20+
with:
21+
app-id: ${{ vars.APP_ID_APPROVE_AND_MERGE }}
22+
private-key: ${{ secrets.APP_KEY_APPROVE_AND_MERGE }}
23+
owner: community-scripts
24+
repositories: ProxmoxVE-Local
25+
26+
- name: Generate a token for PR approval and merge
27+
id: generate-token-merge
28+
uses: actions/create-github-app-token@v2
29+
with:
30+
app-id: ${{ vars.APP_ID_APPROVE_AND_MERGE }}
31+
private-key: ${{ secrets.APP_KEY_APPROVE_AND_MERGE }}
32+
owner: community-scripts
33+
repositories: ProxmoxVE-Local
34+
1735

1836
- name: Get latest draft release
1937
id: draft
@@ -67,17 +85,28 @@ jobs:
6785
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6886

6987

70-
- name: Authenticate gh with PAT
88+
- name: Approve pull request
89+
if: env.changed == 'true'
90+
env:
91+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7192
run: |
72-
echo "${{ secrets.PAT_MICHEL }}" | gh auth login --with-token
73-
93+
PR_NUMBER="${{ steps.pr.outputs.pr_number }}"
94+
if [ -n "$PR_NUMBER" ]; then
95+
gh pr review $PR_NUMBER --approve
96+
fi
7497
75-
- name: Merge PR as PAT user
76-
run: |
77-
gh pr merge "${{ steps.pr.outputs.pr_number }}" --squash --body "Merge VERSION update" --admin
98+
- name: Approve pull request and merge
99+
if: env.changed == 'true'
78100
env:
79-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80-
101+
GH_TOKEN: ${{ steps.generate-token-merge.outputs.token }}
102+
run: |
103+
git config --global user.name "github-actions-automege[bot]"
104+
git config --global user.email "github-actions-automege[bot]@users.noreply.github.com"
105+
PR_NUMBER="${{ steps.pr.outputs.pr_number }}"
106+
if [ -n "$PR_NUMBER" ]; then
107+
gh pr review "$PR_NUMBER" --approve
108+
gh pr merge "$PR_NUMBER" --squash --admin
109+
fi
81110
82111
- name: Wait for PR merge
83112
uses: actions/github-script@v7

0 commit comments

Comments
 (0)