Skip to content

Commit

Permalink
ci: use GitHub Actions token instead of chatops/release_notes sec…
Browse files Browse the repository at this point in the history
…rets

It seems more secure to use the controlled & limited token than an
ambient secret.
  • Loading branch information
bluetech committed May 17, 2021
1 parent 4fd2ee2 commit fc8f6b2
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
contents: write

needs: [build]

Expand Down Expand Up @@ -236,7 +236,7 @@ jobs:

- name: Publish GitHub release notes
env:
GH_RELEASE_NOTES_TOKEN: ${{ secrets.release_notes }}
GH_RELEASE_NOTES_TOKEN: ${{ github.token }}
run: |
sudo apt-get install pandoc
tox -e publish-gh-release-notes
7 changes: 4 additions & 3 deletions .github/workflows/prepare-release-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
contents: write
pull-requests: write

steps:
- uses: actions/checkout@v2
Expand All @@ -40,9 +41,9 @@ jobs:
- name: Prepare release PR (minor/patch release)
if: github.event.inputs.major == 'no'
run: |
tox -e prepare-release-pr -- ${{ github.event.inputs.branch }} ${{ secrets.chatops }}
tox -e prepare-release-pr -- ${{ github.event.inputs.branch }} ${{ github.token }}
- name: Prepare release PR (major release)
if: github.event.inputs.major == 'yes'
run: |
tox -e prepare-release-pr -- ${{ github.event.inputs.branch }} ${{ secrets.chatops }} --major
tox -e prepare-release-pr -- ${{ github.event.inputs.branch }} ${{ github.token }} --major
5 changes: 3 additions & 2 deletions .github/workflows/release-on-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
contents: write
issues: write

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

Expand All @@ -36,4 +37,4 @@ jobs:
- name: Prepare release
run: |
tox -e release-on-comment -- $GITHUB_EVENT_PATH ${{ secrets.chatops }}
tox -e release-on-comment -- $GITHUB_EVENT_PATH ${{ github.token }}
5 changes: 2 additions & 3 deletions scripts/prepare-release-pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
After that, it will create a release using the `release` tox environment, and push a new PR.
**Secret**: currently the secret is defined in the @pytestbot account,
which the core maintainers have access to. There we created a new secret named `chatops`
with write access to the repository.
**Token**: currently the token from the GitHub Actions is used, pushed with
`pytest bot <pytestbot@gmail.com>` commit author.
"""
import argparse
import re
Expand Down
4 changes: 2 additions & 2 deletions scripts/release-on-comment.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
After that, it will create a release using the `release` tox environment, and push a new PR.
**Secret**: currently the secret is defined in the @pytestbot account, which the core maintainers
have access to. There we created a new secret named `chatops` with write access to the repository.
**Token**: currently the token from the GitHub Actions is used, pushed with
`pytest bot <pytestbot@gmail.com>` commit author.
"""
import argparse
import json
Expand Down

0 comments on commit fc8f6b2

Please sign in to comment.