diff --git a/.github/workflows/pr-verify.yml b/.github/workflows/pr-verify.yml deleted file mode 100644 index 7246bd88..00000000 --- a/.github/workflows/pr-verify.yml +++ /dev/null @@ -1,70 +0,0 @@ -name: Verify Pull Request -on: # yamllint disable-line rule:truthy - pull_request_target: - types: [opened, edited, synchronize, reopened, ready_for_review] -# yamllint disable rule:line-length -jobs: - pr-verify: - runs-on: ubuntu-latest - name: Verify Pull Request - if: github.event_name != 'pull_request_target' || !github.event.pull_request.draft - steps: - - name: Verifier action - id: verifier - uses: kubernetes-sigs/kubebuilder-release-tools@012269a88fa4c034a0acf1ba84c26b195c0dbab4 # v0.4.3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - - - name: Checkout repository - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1 - with: - ref: ${{ github.event.pull_request.head.sha }} - - - name: Verify Boilerplate - run: make verify-boilerplate - - - name: Verify Shellcheck - run: make verify-shellcheck - - - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 - with: - node-version: "22" - - name: Install renovate - run: npm i -g renovate@35.54.0 # TODO update this via renovatebot - - - name: Validate config - run: | - for file in $(find . -name "*.json5"); do - renovate-config-validator ${file} - done - - - name: Generate Token - uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2 - id: generate-token - with: - app_id: ${{ secrets.SCS_APP_ID }} - private_key: ${{ secrets.SCS_APP_PRIVATE_KEY }} - - name: Generate Size - uses: pascalgn/size-label-action@f8edde36b3be04b4f65dcfead05dc8691b374348 # v0.5.5 - env: - GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} - with: - sizes: > - { - "0": "XS", - "20": "S", - "50": "M", - "200": "L", - "800": "XL", - "2000": "XXL" - } - - name: Generate Labels - uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5 - with: - configuration-path: .github/labeler.yaml - repo-token: ${{ steps.generate-token.outputs.token }} - - name: Sync Labels - uses: EndBug/label-sync@52074158190acb45f3077f9099fea818aa43f97a # v2 - with: - config-file: .github/labels.yaml - token: ${{ steps.generate-token.outputs.token }} diff --git a/.github/workflows/verifier.yml b/.github/workflows/verifier.yml new file mode 100644 index 00000000..68febd41 --- /dev/null +++ b/.github/workflows/verifier.yml @@ -0,0 +1,42 @@ +name: "PR Title Verifier" + +on: + pull_request: + types: [opened, edited, synchronize, reopened] + +permissions: {} + +jobs: + verify: + permissions: + contents: read + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - name: Validate PR Title Format + env: + TITLE: ${{ github.event.pull_request.title }} + run: | + if [[ -z "$TITLE" ]]; then + echo "Error: PR title cannot be empty." + exit 1 + fi + + if ! [[ "$TITLE" =~ ^($'\u26A0'|$'\u2728'|$'\U0001F41B'|$'\U0001F4D6'|$'\U0001F680'|$'\U0001F331') ]]; then + echo "Error: Invalid PR title format." + echo "Your PR title must start with one of the following indicators:" + echo "- Breaking change: ⚠ (U+26A0)" + echo "- Non-breaking feature: ✨ (U+2728)" + echo "- Patch fix: 🐛 (U+1F41B)" + echo "- Docs: 📖 (U+1F4D6)" + echo "- Release: 🚀 (U+1F680)" + echo "- Infra/Tests/Other: 🌱 (U+1F331)" + exit 1 + fi + + echo "PR title is valid: '$TITLE'"