Skip to content

Commit cd67f9f

Browse files
committed
ci: use github app to commit changes in workflow
1 parent d1cb6dd commit cd67f9f

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

.github/workflows/build-and-push-stage.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,17 +86,29 @@ jobs:
8686
version: 'v4.44.3'
8787
force: true
8888

89-
- name: Initialize mandatory git config
90-
run: |
91-
git config --global user.name 'GitHub Actions'
92-
git config --global user.email 'noreply@github.com'
93-
9489
- name: Bump version in values/stage.yaml
9590
run: yq -i '.deployment.image.tag=strenv(RELEASE_VERSION)' ./k8s/values/stage.yaml
9691

92+
- uses: actions/create-github-app-token@v2
93+
id: app-token
94+
with:
95+
app-id: ${{ vars.APP_ID }}
96+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
97+
98+
- name: Get GitHub App User ID
99+
id: get-user-id
100+
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
101+
env:
102+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
103+
104+
- name: Initialize mandatory git config
105+
run: |
106+
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
107+
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com'
108+
97109
- name: Commit k8s values and push changes
98110
env:
99-
GITHUB_TOKEN: ${{ secrets.GREEN_ECOLUTION_PAT }}
111+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
100112
run: |
101113
git add ./k8s/values/stage.yaml
102114
git commit --message "chore: update stage image to version ${{ env.RELEASE_VERSION }}" \

0 commit comments

Comments
 (0)