refactor: Harden LB target attachment against Hetzner network-attach propagation races in geo-replicated clusters #366
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PR title check | |
| on: | |
| pull_request_target: | |
| types: | |
| - opened | |
| - edited | |
| - synchronize | |
| jobs: | |
| title: | |
| if: "${{ ! startsWith(github.head_ref, 'release-please') || ! contains(github.event.pull_request.labels.*.name, 'autorelease: pending') }}" | |
| name: PR title validation | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: read | |
| steps: | |
| - name: Validate PR title (semantic) | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| PR_NUMBER: ${{ github.event.pull_request.number }} | |
| REPO: ${{ github.repository }} | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| title="$(gh pr view "$PR_NUMBER" --repo "$REPO" --json title --jq '.title')" | |
| labels="$(gh pr view "$PR_NUMBER" --repo "$REPO" --json labels --jq '.labels[].name' || true)" | |
| echo "PR title: $title" | |
| echo "PR labels:" | |
| echo "$labels" | sed 's/^/ - /' || true | |
| # ignoreLabels: dependencies, github_actions | |
| for ignored in dependencies github_actions; do | |
| if echo "$labels" | grep -Fxq "$ignored"; then | |
| echo "Skipping validation because label '$ignored' is present." | |
| exit 0 | |
| fi | |
| done | |
| # types: fix|feat|refactor|docs|ci|chore | |
| types_regex='(fix|feat|refactor|docs|ci|chore)' | |
| # requireScope: false -> scope optional | |
| # subjectPattern: ^[A-Z].+$ -> subject starts with uppercase | |
| # wip: true -> allow optional leading "WIP:" (and also "Draft:" commonly) | |
| pattern="^((WIP|Draft)[: ]+)?${types_regex}(\\([^)]+\\))?: [A-Z].+\$" | |
| if [[ ! "$title" =~ $pattern ]]; then | |
| # Similar to subjectPatternError message in your action | |
| subject="${title#*: }" | |
| cat <<EOF | |
| The subject "$subject" found in the pull request title "$title" | |
| didn't match the configured pattern. Please ensure that the subject | |
| starts with an uppercase character. | |
| Expected formats: | |
| fix: Subject | |
| feat(scope): Subject (scope optional) | |
| Allowed types: | |
| fix, feat, refactor, docs, ci, chore | |
| EOF | |
| exit 1 | |
| fi | |
| echo "PR title passed semantic validation." |