Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#11631 GitHub Workflows security hardening #11632

Merged
merged 11 commits into from Sep 4, 2022
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 17 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 - on stable tag
adiroiban marked this conversation as resolved.
Show resolved Hide resolved
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 @@ -394,7 +408,7 @@ jobs:
else
echo "Branch not updated for not stable releases: $GITUB_REF"
fi

adiroiban marked this conversation as resolved.
Show resolved Hide resolved

# We have this job so that the PR can be blocked on a single job.
# In this way, each time a job is modified,
Expand All @@ -413,6 +427,7 @@ jobs:
- apidocs
- static-checks
- release-publish
- update-stable-branch
adiroiban marked this conversation as resolved.
Show resolved Hide resolved
steps:
- name: Require all successes
shell: python
Expand Down
1 change: 1 addition & 0 deletions src/twisted/newsfragments/11631.bugfix
@@ -0,0 +1 @@
`test.yaml` workflow permissions restricted.