Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions .github/workflows/verify-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ on:
pull_request:
types: [edited, opened, reopened, synchronize]

# Principle of least privilege: this workflow only needs to read repository
# contents. Restricting the token limits the blast radius of any compromised step.
permissions:
contents: read

defaults:
run:
shell: bash
Expand All @@ -13,8 +18,12 @@ jobs:
steps:
- name: Validate PR Title
if: github.base_ref == 'dev'
# Pass the untrusted PR title via the environment (not direct ${{ }}
# interpolation) so it is treated as data and cannot inject shell commands.
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
title="${{ github.event.pull_request.title }}"
title="$PR_TITLE"
if [[ "$title" =~ ^(POSTRELEASE|FIX|CHANGE|NEW)([[:space:]]*\([^()]+\))?[[:space:]]*:?[[:space:]]*@W-[[:digit:]]{8,9}@[[:space:]]*.+ ]]; then
echo "Valid PR title: '$title'"
else
Expand All @@ -29,8 +38,12 @@ jobs:
- name: Check for "Postrelease" keyword in PR title.
id: main
if: github.base_ref == 'dev'
# Pass the untrusted PR title via the environment (not direct ${{ }}
# interpolation) so it is treated as data and cannot inject shell commands.
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
title="${{ github.event.pull_request.title }}"
title="$PR_TITLE"
if [[ "$title" =~ ^POSTRELEASE ]]; then
echo "is_postrelease=true" >> "$GITHUB_OUTPUT"
else
Expand Down
Loading