@@ -5,18 +5,40 @@ on: # yamllint disable-line rule:truthy
5
5
# yamllint disable rule:line-length
6
6
jobs:
7
7
pr-verify:
8
+ permissions:
9
+ contents: read
10
+ pull-requests: write
11
+ issues: write
8
12
runs-on: ubuntu-latest
9
13
name: Verify Pull Request
10
14
steps:
11
- - name: Verifier action
12
- id: verifier
13
- uses: kubernetes-sigs/kubebuilder-release-tools@012269a88fa4c034a0acf1ba84c26b195c0dbab4 # v0.4.3
14
- with:
15
- github_token: ${{ secrets.GITHUB_TOKEN }}
16
-
17
15
- name: Checkout repository
18
16
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
19
17
18
+ # Take from https://github.com/kubernetes-sigs/kubebuilder/blob/master/.github/workflows/verify.yml
19
+ - name: Validate PR Title Format
20
+ env:
21
+ TITLE: ${{ github.event.pull_request.title }}
22
+ run: |
23
+ if [[ -z "$TITLE" ]]; then
24
+ echo "Error: PR title cannot be empty."
25
+ exit 1
26
+ fi
27
+
28
+ if ! [[ "$TITLE" =~ ^($'\u26A0'|$'\u2728'|$'\U0001F41B'|$'\U0001F4D6'|$'\U0001F680'|$'\U0001F331') ]]; then
29
+ echo "Error: Invalid PR title format."
30
+ echo "Your PR title must start with one of the following indicators:"
31
+ echo "- Breaking change: ⚠ (U+26A0)"
32
+ echo "- Non-breaking feature: ✨ (U+2728)"
33
+ echo "- Patch fix: 🐛 (U+1F41B)"
34
+ echo "- Docs: 📖 (U+1F4D6)"
35
+ echo "- Release: 🚀 (U+1F680)"
36
+ echo "- Infra/Tests/Other: 🌱 (U+1F331)"
37
+ exit 1
38
+ fi
39
+
40
+ echo "PR title is valid: '$TITLE'"
41
+
20
42
- name: Verify Boilerplate
21
43
run: make verify-boilerplate
22
44
@@ -38,16 +60,11 @@ jobs:
38
60
renovate-config-validator ${file}
39
61
done
40
62
41
- - name: Generate Token
42
- uses: actions/create-github-app-token@21cfef2b496dd8ef5b904c159339626a10ad380e # v1
43
- id: generate-token
44
- with:
45
- app-id: ${{ secrets.SYSELF_APP_ID }}
46
- private-key: ${{ secrets.SYSELF_APP_PRIVATE_KEY }}
47
63
- name: Generate Size
64
+ if: github.event.pull_request.head.repo.full_name == github.repository # Skip forked PRs
48
65
uses: pascalgn/size-label-action@f8edde36b3be04b4f65dcfead05dc8691b374348 # v0.5.5
49
66
env:
50
- GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
67
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51
68
with:
52
69
sizes: >
53
70
{
@@ -59,12 +76,12 @@ jobs:
59
76
"2000": "XXL"
60
77
}
61
78
- name: Generate Labels
79
+ if: github.event.pull_request.head.repo.full_name == github.repository # Skip forked PRs
62
80
uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5
63
81
with:
64
82
configuration-path: .github/labeler.yaml
65
- repo-token: ${{ steps.generate-token.outputs.token }}
66
83
- name: Sync Labels
84
+ if: github.event.pull_request.head.repo.full_name == github.repository # Skip forked PRs
67
85
uses: EndBug/label-sync@52074158190acb45f3077f9099fea818aa43f97a # v2
68
86
with:
69
87
config-file: .github/labels.yaml
70
- token: ${{ steps.generate-token.outputs.token }}
0 commit comments