Skip to content

Commit 57864e4

Browse files
authored
Merge branch 'master' into add-subpath-support
2 parents 3a96f57 + 7435378 commit 57864e4

File tree

4 files changed

+113
-114
lines changed

4 files changed

+113
-114
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Execute CI on PRs with ok-to-test label
2+
3+
# This workflow executes CI for fork PRs that have the 'ok-to-test' label.
4+
# Once labeled, all subsequent commits will have their CI runs auto-approved.
5+
6+
on:
7+
pull_request_target:
8+
types: [labeled, synchronize]
9+
10+
permissions:
11+
actions: write
12+
contents: read
13+
pull-requests: read
14+
15+
jobs:
16+
auto-approve:
17+
runs-on: ubuntu-latest
18+
# Only run for fork PRs with ok-to-test label
19+
if: >
20+
github.event.pull_request.head.repo.full_name != github.repository &&
21+
contains(join(github.event.pull_request.labels.*.name, ','), 'ok-to-test')
22+
steps:
23+
- name: Approve pending workflow runs
24+
env:
25+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
PR_SHA: ${{ github.event.pull_request.head.sha }}
27+
run: |
28+
echo "Looking for workflow runs requiring approval for SHA: $PR_SHA"
29+
30+
# Wait a moment for workflow runs to be created
31+
sleep 5
32+
33+
# Get all workflow runs for this commit that need approval
34+
runs=$(curl -s -H "Authorization: Bearer $GH_TOKEN" \
35+
-H "Accept: application/vnd.github.v3+json" \
36+
"https://api.github.com/repos/${{ github.repository }}/actions/runs?head_sha=$PR_SHA" | \
37+
jq -r '.workflow_runs[] | select(.status == "action_required") | .id')
38+
39+
if [[ -z "$runs" ]]; then
40+
echo "No workflow runs found requiring approval."
41+
exit 0
42+
fi
43+
44+
echo "Found workflow runs requiring approval: $runs"
45+
46+
# Approve each workflow run
47+
for run_id in $runs; do
48+
echo "Approving workflow run: $run_id"
49+
curl -X POST -H "Authorization: Bearer $GH_TOKEN" \
50+
-H "Accept: application/vnd.github.v3+json" \
51+
"https://api.github.com/repos/${{ github.repository }}/actions/runs/$run_id/approve"
52+
done
53+
54+
echo "All pending runs approved."
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: /ok-to-test -> label
2+
3+
# When a maintainer comments /ok-to-test, this adds the 'ok-to-test' label.
4+
# The ok-to-test-ci.yml workflow then automatically executes CI for labeled PRs.
5+
6+
# Please note, the google-oss-prow bot also converts /ok-to-test comments to
7+
# labels. As a result, this is technically redundant, but I'm adding it in case
8+
# we decide to move away from prow.
9+
10+
on:
11+
issue_comment:
12+
types:
13+
- created
14+
15+
permissions: read-all
16+
17+
jobs:
18+
# Notify non-members that they cannot use privileged commands
19+
unauthorized:
20+
runs-on: ubuntu-latest
21+
if: >-
22+
contains(github.event.comment.body, '/ok-to-test') &&
23+
!(github.event.comment.author_association == 'MEMBER' ||
24+
github.event.comment.author_association == 'OWNER')
25+
permissions:
26+
issues: write
27+
steps:
28+
- name: Notify commenter of insufficient permissions
29+
env:
30+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
MESSAGE: |
32+
🚫 This command cannot be processed. Only organization members or owners can use `/ok-to-test`.
33+
Once a maintainer applies the `ok-to-test` label, CI will run automatically on all future commits.
34+
run: |
35+
gh issue comment "${{ github.event.issue.number }}" --repo "${{ github.repository }}" --body "${MESSAGE}"
36+
37+
# Add ok-to-test label when a maintainer comments /ok-to-test
38+
ok-to-test:
39+
runs-on: ubuntu-latest
40+
if: >-
41+
github.event.issue.pull_request &&
42+
contains(github.event.comment.body, '/ok-to-test') &&
43+
(github.event.comment.author_association == 'MEMBER' ||
44+
github.event.comment.author_association == 'OWNER')
45+
permissions:
46+
pull-requests: write
47+
issues: write
48+
steps:
49+
- name: Add ok-to-test label
50+
env:
51+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
run: |
53+
gh pr edit "${{ github.event.issue.number }}" \
54+
--repo "${{ github.repository }}" \
55+
--add-label "ok-to-test"
56+
57+
gh issue comment "${{ github.event.issue.number }}" \
58+
--repo "${{ github.repository }}" \
59+
--body "✅ Added \`ok-to-test\` label. CI will now run automatically on all commits to this PR."

.github/workflows/pr-commands.yml

Lines changed: 0 additions & 113 deletions
This file was deleted.

manifests/kustomize/env/cert-manager/platform-agnostic-multi-user-k8s-native/patches/deployment.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ spec:
1010
ports:
1111
- containerPort: 8443
1212
name: webhook
13-
image: domain.local/apiserver:local
1413
command:
1514
- "/bin/apiserver"
1615
args:

0 commit comments

Comments
 (0)