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
48 changes: 3 additions & 45 deletions .github/workflows/preflight-pr-title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
# before the first ":". Mirrors the prefix-parsing convention already used by
# `preflight-todo-comments.yml`, so the same IDs power both checks.
#
# Bot-authored PRs are skipped by default (any account where
# Bot-authored PRs are skipped (any account where
# `pull_request.user.type == 'Bot'`, which covers `hash-worker[bot]`,
# `dependabot[bot]`, and any other GitHub App). Additional user logins can be
# skipped via the `ignored-actors` input.
# `dependabot[bot]`, and any other GitHub App).
name: PR Title

on:
Expand All @@ -20,16 +19,6 @@ on:
types: [opened, synchronize, reopened, edited]
merge_group:
workflow_call:
Comment thread
TimDiekmann marked this conversation as resolved.
inputs:
ignored-actors:
description: |
Additional GitHub logins to exempt from the check, as a
newline- or comma-separated list. GitHub App accounts
(`pull_request.user.type == 'Bot'`) are always skipped, so
this is only needed for human accounts that should be exempt.
type: string
required: false
default: ""

permissions:
contents: read
Expand All @@ -38,40 +27,9 @@ jobs:
check:
name: Linear Issue ID
runs-on: ubuntu-24.04
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
if: (github.event_name == 'pull_request' || github.event_name == 'pull_request_target') && github.event.pull_request.user.type != 'Bot'
steps:
- name: Determine whether to skip the check
id: skip
env:
PR_USER: ${{ github.event.pull_request.user.login }}
PR_USER_TYPE: ${{ github.event.pull_request.user.type }}
EXTRA_IGNORED: ${{ inputs.ignored-actors }}
run: |
echo "PR author: $PR_USER (type: $PR_USER_TYPE)"

if [[ "$PR_USER_TYPE" == "Bot" ]]; then
echo "::notice::Skipping check — PR authored by a bot account ($PR_USER)."
echo "skip=true" >> "$GITHUB_OUTPUT"
exit 0
fi

if [[ -n "$EXTRA_IGNORED" ]]; then
EXTRA_NORMALIZED=$(printf '%s' "$EXTRA_IGNORED" \
| tr ',' '\n' \
| sed 's/^[[:space:]]*//; s/[[:space:]]*$//' \
| sed '/^$/d')

if echo "$EXTRA_NORMALIZED" | grep -qFx "$PR_USER"; then
echo "::notice::Skipping check — PR author $PR_USER is in the ignored-actors list."
echo "skip=true" >> "$GITHUB_OUTPUT"
exit 0
fi
fi

echo "skip=false" >> "$GITHUB_OUTPUT"

- name: Validate PR title contains Linear issue ID
if: steps.skip.outputs.skip != 'true'
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
Expand Down
Loading