Skip to content

Commit 4dd7303

Browse files
authored
PYTHON-6076 Request workflows permission in create-release-branch (#3039)
1 parent e66da83 commit 4dd7303

1 file changed

Lines changed: 23 additions & 3 deletions

File tree

‎.github/workflows/create-release-branch.yml‎

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,30 @@ jobs:
3333
outputs:
3434
version: ${{ steps.pre-publish.outputs.version }}
3535
steps:
36-
- uses: mongodb-labs/drivers-github-tools/secure-checkout@v3
36+
- name: Create app token
37+
id: app-token
38+
uses: actions/create-github-app-token@v3
3739
with:
38-
app_id: ${{ vars.APP_ID }}
39-
private_key: ${{ secrets.APP_PRIVATE_KEY }}
40+
app-id: ${{ vars.APP_ID }}
41+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
42+
permission-contents: write
43+
permission-pull-requests: write
44+
permission-workflows: write
45+
- name: Store token
46+
shell: bash -eu {0}
47+
# zizmor: ignore[template-injection] GH_TOKEN is a GitHub App installation token, not attacker-controllable
48+
run: echo "GH_TOKEN=${{ steps.app-token.outputs.token }}" >> "$GITHUB_ENV"
49+
- uses: actions/checkout@v7.0.1
50+
with:
51+
ref: ${{ github.ref }}
52+
token: ${{ env.GH_TOKEN }}
53+
fetch-depth: 1
54+
persist-credentials: false
55+
- name: Configure git auth for push
56+
shell: bash -eu {0}
57+
run: |
58+
auth_header=$(printf 'x-access-token:%s' "${GH_TOKEN}" | base64 -w0)
59+
git config --local http.https://github.com/.extraheader "AUTHORIZATION: basic ${auth_header}"
4060
- uses: mongodb-labs/drivers-github-tools/setup@v3
4161
with:
4262
aws_role_arn: ${{ secrets.AWS_ROLE_ARN }}

0 commit comments

Comments
 (0)