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
16 changes: 11 additions & 5 deletions .github/workflows/validate-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,23 @@ jobs:
# The rules the commit-msg hook applies, from the same file (COMMIT-04).
# The title reaches committed on stdin from the environment, never
# interpolated into the script, so it cannot inject into the shell.
# Dependabot capitalizes its fixed verb ("chore(deps): Bump ...") with no
# option to change it, so only that word is lowercased, only for it.
# Dependabot titles name the full package ("Bump ghcr.io/devcontainers/
# features/common-utils from ... to ...") with no option to shorten them,
# so for Dependabot alone the subject-length limit is lifted; every other
# rule still applies.
- name: Check the title passes committed
env:
TITLE: ${{ github.event.pull_request.title }}
DEPENDABOT: ${{ github.event.pull_request.user.login == 'dependabot[bot]' }}
run: |
set -euo pipefail
if [[ "$DEPENDABOT" == "true" ]]; then
TITLE="${TITLE/): Bump /): bump }"
relaxed="$RUNNER_TEMP/committed.toml"
sed 's/^subject_length = .*/subject_length = 0/' .config/commits/committed.toml > "$relaxed"
printf '%s\n' "$TITLE" | committed --config "$relaxed" --commit-file -
else
printf '%s\n' "$TITLE" | committed --config .config/commits/committed.toml --commit-file -
fi
printf '%s\n' "$TITLE" | committed --config .config/commits/committed.toml --commit-file -

# committed cannot require a scope or a lowercase subject; the action
# checks those, with the types and scopes read from the same file.
Expand All @@ -74,7 +79,8 @@ jobs:
types: ${{ steps.allowed.outputs.types }}
scopes: ${{ steps.allowed.outputs.scopes }}
requireScope: true
# Dependabot's "Bump" is the one capital allowed (see above).
# Dependabot capitalizes its fixed verb ("chore(deps): Bump ...") with
# no option to change it; that word is the one capital allowed.
subjectPattern: >-
${{ github.event.pull_request.user.login == 'dependabot[bot]'
&& '^(?:[a-z]|Bump ).+$' || '^[a-z].+$' }}