Skip to content

Commit

Permalink
#11631 GitHub Workflows security hardening (#11632)
Browse files Browse the repository at this point in the history
  • Loading branch information
adiroiban committed Sep 4, 2022
2 parents f4c9fbe + a8cd914 commit d415545
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
17 changes: 15 additions & 2 deletions .github/workflows/test.yaml
Expand Up @@ -22,6 +22,9 @@ on:
required: false
default: false

permissions:
contents: read

# Only have a run a single parallel for each branch.
# Runs for trunk are queues.
# Older runs for non-trunk branches are cancelled and the jobs are executed
Expand Down Expand Up @@ -371,8 +374,19 @@ jobs:
with:
password: ${{ secrets.PYPI_UPLOAD_TOKEN }}

# Read the Docs has no support for our "twisted-1.2.3" numbering convention
# and can't detect which tag is the stable one.
# A workaournd is to manually push to a "stable" branch to inform RTD
# that this is what we want at the "/en/stable" link.
update-stable-branch:
permissions:
contents: write
name: Update stable branch for RTD - on tag
runs-on: 'ubuntu-20.04'
needs: [release-publish]
if: startsWith(github.ref, 'refs/tags/twisted-')
steps:
- name: Update stable branch - on stable tag
if: startsWith(github.ref, 'refs/tags/twisted-')
env:
STABLE_BRANCH: 'stable'
STABLE_REF_RE: '.*twisted-[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$'
Expand All @@ -395,7 +409,6 @@ jobs:
echo "Branch not updated for not stable releases: $GITUB_REF"
fi
# We have this job so that the PR can be blocked on a single job.
# In this way, each time a job is modified,
# we don't have to go to GitHub UI and reconfigure branch protection.
Expand Down
1 change: 1 addition & 0 deletions src/twisted/newsfragments/11631.bugfix
@@ -0,0 +1 @@
`test.yaml` workflow permissions restricted.

0 comments on commit d415545

Please sign in to comment.