Skip to content

Commit b30dab6

Browse files
🌱Make "Verify Pull Request" work on forks. (#1581)
1 parent 65e1181 commit b30dab6

File tree

3 files changed

+59
-16
lines changed

3 files changed

+59
-16
lines changed

.github/workflows/pr-e2e.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ jobs:
1919
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
2020
runs-on: ubuntu-latest
2121
steps:
22+
- name: Check if PR is from fork
23+
if: github.event.pull_request.head.repo.full_name != github.repository
24+
run: |
25+
echo "❌ Skipping workflow: PR is from a fork and cannot run this workflow."
26+
exit 1
27+
2228
- name: Checkout repository
2329
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2430
with:

.github/workflows/pr-verify.yml

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,40 @@ on: # yamllint disable-line rule:truthy
55
# yamllint disable rule:line-length
66
jobs:
77
pr-verify:
8+
permissions:
9+
contents: read
10+
pull-requests: write
11+
issues: write
812
runs-on: ubuntu-latest
913
name: Verify Pull Request
1014
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-
1715
- name: Checkout repository
1816
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1917

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+
2042
- name: Verify Boilerplate
2143
run: make verify-boilerplate
2244

@@ -38,16 +60,11 @@ jobs:
3860
renovate-config-validator ${file}
3961
done
4062

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 }}
4763
- name: Generate Size
64+
if: github.event.pull_request.head.repo.full_name == github.repository # Skip forked PRs
4865
uses: pascalgn/size-label-action@f8edde36b3be04b4f65dcfead05dc8691b374348 # v0.5.5
4966
env:
50-
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
67+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5168
with:
5269
sizes: >
5370
{
@@ -59,12 +76,12 @@ jobs:
5976
"2000": "XXL"
6077
}
6178
- name: Generate Labels
79+
if: github.event.pull_request.head.repo.full_name == github.repository # Skip forked PRs
6280
uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5
6381
with:
6482
configuration-path: .github/labeler.yaml
65-
repo-token: ${{ steps.generate-token.outputs.token }}
6683
- name: Sync Labels
84+
if: github.event.pull_request.head.repo.full_name == github.repository # Skip forked PRs
6785
uses: EndBug/label-sync@52074158190acb45f3077f9099fea818aa43f97a # v2
6886
with:
6987
config-file: .github/labels.yaml
70-
token: ${{ steps.generate-token.outputs.token }}

.vscode/settings.json

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,25 @@
66
"editor.hover.delay": 1000,
77
"[yaml]": {
88
"editor.formatOnSave": true
9-
}
9+
},
10+
"workbench.colorCustomizations": {
11+
"activityBar.activeBackground": "#3399ff",
12+
"activityBar.background": "#3399ff",
13+
"activityBar.foreground": "#15202b",
14+
"activityBar.inactiveForeground": "#15202b99",
15+
"activityBarBadge.background": "#bf0060",
16+
"activityBarBadge.foreground": "#e7e7e7",
17+
"commandCenter.border": "#e7e7e799",
18+
"sash.hoverBorder": "#3399ff",
19+
"statusBar.background": "#007fff",
20+
"statusBar.foreground": "#e7e7e7",
21+
"statusBarItem.hoverBackground": "#3399ff",
22+
"statusBarItem.remoteBackground": "#007fff",
23+
"statusBarItem.remoteForeground": "#e7e7e7",
24+
"titleBar.activeBackground": "#007fff",
25+
"titleBar.activeForeground": "#e7e7e7",
26+
"titleBar.inactiveBackground": "#007fff99",
27+
"titleBar.inactiveForeground": "#e7e7e799"
28+
},
29+
"peacock.color": "#007fff"
1030
}

0 commit comments

Comments
 (0)