Skip to content

Commit 864a2bc

Browse files
committed
ci: use GitHub Actions token instead of chatops/release_notes secrets
It seems more secure to use the controlled & limited token than an ambient secret.
1 parent 6bc6ec3 commit 864a2bc

File tree

5 files changed

+13
-12
lines changed

5 files changed

+13
-12
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ jobs:
204204
runs-on: ubuntu-latest
205205
timeout-minutes: 30
206206
permissions:
207-
contents: read
207+
contents: write
208208

209209
needs: [build]
210210

@@ -236,7 +236,7 @@ jobs:
236236

237237
- name: Publish GitHub release notes
238238
env:
239-
GH_RELEASE_NOTES_TOKEN: ${{ secrets.release_notes }}
239+
GH_RELEASE_NOTES_TOKEN: ${{ github.token }}
240240
run: |
241241
sudo apt-get install pandoc
242242
tox -e publish-gh-release-notes

.github/workflows/prepare-release-pr.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ jobs:
1919
build:
2020
runs-on: ubuntu-latest
2121
permissions:
22-
contents: read
22+
contents: write
23+
pull-requests: write
2324

2425
steps:
2526
- uses: actions/checkout@v2
@@ -40,9 +41,9 @@ jobs:
4041
- name: Prepare release PR (minor/patch release)
4142
if: github.event.inputs.major == 'no'
4243
run: |
43-
tox -e prepare-release-pr -- ${{ github.event.inputs.branch }} ${{ secrets.chatops }}
44+
tox -e prepare-release-pr -- ${{ github.event.inputs.branch }} ${{ github.token }}
4445
4546
- name: Prepare release PR (major release)
4647
if: github.event.inputs.major == 'yes'
4748
run: |
48-
tox -e prepare-release-pr -- ${{ github.event.inputs.branch }} ${{ secrets.chatops }} --major
49+
tox -e prepare-release-pr -- ${{ github.event.inputs.branch }} ${{ github.token }} --major

.github/workflows/release-on-comment.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ jobs:
1414
build:
1515
runs-on: ubuntu-latest
1616
permissions:
17-
contents: read
17+
contents: write
18+
issues: write
1819

1920
if: (github.event.comment && startsWith(github.event.comment.body, '@pytestbot please')) || (github.event.issue && !github.event.comment && startsWith(github.event.issue.body, '@pytestbot please'))
2021

@@ -36,4 +37,4 @@ jobs:
3637
3738
- name: Prepare release
3839
run: |
39-
tox -e release-on-comment -- $GITHUB_EVENT_PATH ${{ secrets.chatops }}
40+
tox -e release-on-comment -- $GITHUB_EVENT_PATH ${{ github.token }}

scripts/prepare-release-pr.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99
1010
After that, it will create a release using the `release` tox environment, and push a new PR.
1111
12-
**Secret**: currently the secret is defined in the @pytestbot account,
13-
which the core maintainers have access to. There we created a new secret named `chatops`
14-
with write access to the repository.
12+
**Token**: currently the token from the GitHub Actions is used, pushed with
13+
`pytest bot <[email protected]>` commit author.
1514
"""
1615
import argparse
1716
import re

scripts/release-on-comment.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
2424
After that, it will create a release using the `release` tox environment, and push a new PR.
2525
26-
**Secret**: currently the secret is defined in the @pytestbot account, which the core maintainers
27-
have access to. There we created a new secret named `chatops` with write access to the repository.
26+
**Token**: currently the token from the GitHub Actions is used, pushed with
27+
`pytest bot <[email protected]>` commit author.
2828
"""
2929
import argparse
3030
import json

0 commit comments

Comments
 (0)