Skip to content

Commit 1b0f71a

Browse files
committed
feat: replace fork IT trigger comment with pull_request_target approval gate
Fork PRs now automatically trigger integration test workflows on each push. A lightweight gate job pauses execution pending approval by a committer via the fork-pr-integration-test GitHub environment. Same-repo PRs skip the gate and run tests immediately. Removes the fork-integration-trigger.yml workflow and report-fork-status action, both of which were only needed for the old dispatch-based approach.
1 parent 198acae commit 1b0f71a

8 files changed

Lines changed: 100 additions & 236 deletions

File tree

.github/actions/report-fork-status/action.yml

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

.github/workflows/alioss-integration.yml

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,38 @@ name: Alioss Integration Tests
22

33
on:
44
workflow_dispatch:
5-
inputs:
6-
pr_ref:
7-
description: 'SHA of the PR head commit (for fork PRs)'
8-
required: false
9-
default: ''
10-
pull_request:
5+
workflow_call:
6+
pull_request_target:
117
push:
128
branches:
139
- main
14-
workflow_call:
1510

1611
concurrency:
1712
group: alioss-integration
1813
cancel-in-progress: false
1914

2015
jobs:
21-
alioss-general-integration-tests:
22-
name: Alioss General Integration Tests
16+
gate:
17+
name: Approval gate (fork PRs only)
2318
runs-on: ubuntu-latest
24-
# Skip fork PRs; run for all other triggers (push, dispatch, workflow_call, schedule, etc.)
2519
if: >
26-
github.event_name != 'pull_request' ||
27-
github.event.pull_request.head.repo.full_name == github.repository
28-
permissions:
29-
statuses: write
20+
github.event_name == 'pull_request_target' &&
21+
github.event.pull_request.head.repo.full_name != github.repository
22+
environment: fork-pr-integration-test
23+
steps:
24+
- run: echo "Fork PR approved, proceeding with integration tests"
25+
26+
alioss-general-integration-tests:
27+
name: Alioss General Integration Tests
28+
runs-on: ubuntu-latest
29+
needs: [gate]
30+
if: always() && (needs.gate.result == 'success' || needs.gate.result == 'skipped')
3031
steps:
3132
- name: Checkout code
3233
uses: actions/checkout@v7
3334
with:
34-
ref: ${{ inputs.pr_ref || github.sha }}
35+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
36+
allow-unsafe-pr-checkout: true
3537
- name: Set up Go
3638
uses: actions/setup-go@v7
3739
with:
@@ -56,9 +58,3 @@ jobs:
5658
export access_key_id="${{ secrets.ALI_ACCESS_KEY_ID }}"
5759
export access_key_secret="${{ secrets.ALI_ACCESS_KEY_SECRET }}"
5860
./.github/scripts/alioss/teardown.sh
59-
- name: Report fork PR status
60-
if: always() && inputs.pr_ref != ''
61-
uses: ./.github/actions/report-fork-status
62-
with:
63-
pr_ref: ${{ inputs.pr_ref }}
64-
name: Alioss General Integration Tests

.github/workflows/azurebs-integration.yml

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,38 @@ name: Azurebs Integration Tests
22

33
on:
44
workflow_dispatch:
5-
inputs:
6-
pr_ref:
7-
description: 'SHA of the PR head commit (for fork PRs)'
8-
required: false
9-
default: ''
10-
pull_request:
5+
workflow_call:
6+
pull_request_target:
117
push:
128
branches:
139
- main
14-
workflow_call:
1510

1611
concurrency:
1712
group: azurebs-integration
1813
cancel-in-progress: false
1914

2015
jobs:
21-
azurecloud-environment-integration-tests:
22-
name: AzureCloud Environment Integration Tests
16+
gate:
17+
name: Approval gate (fork PRs only)
2318
runs-on: ubuntu-latest
24-
# Skip fork PRs; run for all other triggers (push, dispatch, workflow_call, schedule, etc.)
2519
if: >
26-
github.event_name != 'pull_request' ||
27-
github.event.pull_request.head.repo.full_name == github.repository
28-
permissions:
29-
statuses: write
20+
github.event_name == 'pull_request_target' &&
21+
github.event.pull_request.head.repo.full_name != github.repository
22+
environment: fork-pr-integration-test
23+
steps:
24+
- run: echo "Fork PR approved, proceeding with integration tests"
25+
26+
azurecloud-environment-integration-tests:
27+
name: AzureCloud Environment Integration Tests
28+
runs-on: ubuntu-latest
29+
needs: [gate]
30+
if: always() && (needs.gate.result == 'success' || needs.gate.result == 'skipped')
3031
steps:
3132
- name: Checkout code
3233
uses: actions/checkout@v7
3334
with:
34-
ref: ${{ inputs.pr_ref || github.sha }}
35+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
36+
allow-unsafe-pr-checkout: true
3537
- name: Set up Go
3638
uses: actions/setup-go@v7
3739
with:
@@ -54,9 +56,3 @@ jobs:
5456
export azure_storage_account="${{ secrets.AZURE_STORAGE_ACCOUNT }}"
5557
export azure_storage_key="${{ secrets.AZURE_STORAGE_KEY }}"
5658
./.github/scripts/azurebs/teardown.sh
57-
- name: Report fork PR status
58-
if: always() && inputs.pr_ref != ''
59-
uses: ./.github/actions/report-fork-status
60-
with:
61-
pr_ref: ${{ inputs.pr_ref }}
62-
name: AzureCloud Environment Integration Tests

.github/workflows/dav-integration.yml

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,38 @@ name: DAV Integration Tests
22

33
on:
44
workflow_dispatch:
5-
inputs:
6-
pr_ref:
7-
description: 'SHA of the PR head commit (for fork PRs)'
8-
required: false
9-
default: ''
10-
pull_request:
5+
workflow_call:
6+
pull_request_target:
117
push:
128
branches:
139
- main
14-
workflow_call:
1510

1611
concurrency:
1712
group: dav-integration
1813
cancel-in-progress: false
1914

2015
jobs:
16+
gate:
17+
name: Approval gate (fork PRs only)
18+
runs-on: ubuntu-latest
19+
if: >
20+
github.event_name == 'pull_request_target' &&
21+
github.event.pull_request.head.repo.full_name != github.repository
22+
environment: fork-pr-integration-test
23+
steps:
24+
- run: echo "Fork PR approved, proceeding with integration tests"
25+
2126
dav-integration:
2227
name: DAV Integration Tests
2328
runs-on: ubuntu-latest
24-
# Skip fork PRs; run for all other triggers (push, dispatch, workflow_call, schedule, etc.)
25-
if: >
26-
github.event_name != 'pull_request' ||
27-
github.event.pull_request.head.repo.full_name == github.repository
28-
permissions:
29-
statuses: write
29+
needs: [gate]
30+
if: always() && (needs.gate.result == 'success' || needs.gate.result == 'skipped')
3031
steps:
3132
- name: Checkout code
3233
uses: actions/checkout@v7
3334
with:
34-
ref: ${{ inputs.pr_ref || github.sha }}
35+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
36+
allow-unsafe-pr-checkout: true
3537

3638
- name: Set up Go
3739
uses: actions/setup-go@v7
@@ -43,10 +45,3 @@ jobs:
4345

4446
- name: Run DAV Integration Tests
4547
run: ginkgo -r dav/integration/
46-
47-
- name: Report fork PR status
48-
if: always() && inputs.pr_ref != ''
49-
uses: ./.github/actions/report-fork-status
50-
with:
51-
pr_ref: ${{ inputs.pr_ref }}
52-
name: DAV Integration Tests

.github/workflows/fork-integration-trigger.yml

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

.github/workflows/gcs-integration.yml

Lines changed: 22 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,36 +2,38 @@ name: GCS Integration Tests
22

33
on:
44
workflow_dispatch:
5-
inputs:
6-
pr_ref:
7-
description: 'SHA of the PR head commit (for fork PRs)'
8-
required: false
9-
default: ''
10-
pull_request:
5+
workflow_call:
6+
pull_request_target:
117
push:
128
branches:
139
- "main"
14-
workflow_call:
1510

1611
concurrency:
1712
group: gcs-integration
1813
cancel-in-progress: false
1914

2015
jobs:
21-
gcs-integration-fast-tests:
22-
name: GCS Integation Fast Tests
16+
gate:
17+
name: Approval gate (fork PRs only)
2318
runs-on: ubuntu-latest
24-
# Skip fork PRs; run for all other triggers (push, dispatch, workflow_call, schedule, etc.)
2519
if: >
26-
github.event_name != 'pull_request' ||
27-
github.event.pull_request.head.repo.full_name == github.repository
28-
permissions:
29-
statuses: write
20+
github.event_name == 'pull_request_target' &&
21+
github.event.pull_request.head.repo.full_name != github.repository
22+
environment: fork-pr-integration-test
23+
steps:
24+
- run: echo "Fork PR approved, proceeding with integration tests"
25+
26+
gcs-integration-fast-tests:
27+
name: GCS Integation Fast Tests
28+
runs-on: ubuntu-latest
29+
needs: [gate]
30+
if: always() && (needs.gate.result == 'success' || needs.gate.result == 'skipped')
3031
steps:
3132
- name: Checkout code
3233
uses: actions/checkout@v7
3334
with:
34-
ref: ${{ inputs.pr_ref || github.sha }}
35+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
36+
allow-unsafe-pr-checkout: true
3537
- name: Set up Go
3638
uses: actions/setup-go@v7
3739
with:
@@ -55,27 +57,18 @@ jobs:
5557
echo "${{ secrets.GCP_SERVICE_ACCOUNT_BASE64 }}" | base64 -d > /tmp/gcp-key.json
5658
export google_json_key_data="$(cat /tmp/gcp-key.json)"
5759
./.github/scripts/gcs/teardown.sh
58-
- name: Report fork PR status
59-
if: always() && inputs.pr_ref != ''
60-
uses: ./.github/actions/report-fork-status
61-
with:
62-
pr_ref: ${{ inputs.pr_ref }}
63-
name: GCS Integation Fast Tests
6460
6561
gcs-integration-all-tests:
66-
name: GCS Integation All Tests
62+
name: GCS Integation All Tests
6763
runs-on: ubuntu-latest
68-
# Skip fork PRs; run for all other triggers (push, dispatch, workflow_call, schedule, etc.)
69-
if: >
70-
github.event_name != 'pull_request' ||
71-
github.event.pull_request.head.repo.full_name == github.repository
72-
permissions:
73-
statuses: write
64+
needs: [gate]
65+
if: always() && (needs.gate.result == 'success' || needs.gate.result == 'skipped')
7466
steps:
7567
- name: Checkout code
7668
uses: actions/checkout@v7
7769
with:
78-
ref: ${{ inputs.pr_ref || github.sha }}
70+
ref: ${{ github.event.pull_request.head.sha || github.sha }}
71+
allow-unsafe-pr-checkout: true
7972
- name: Set up Go
8073
uses: actions/setup-go@v7
8174
with:
@@ -98,9 +91,3 @@ jobs:
9891
echo "${{ secrets.GCP_SERVICE_ACCOUNT_BASE64 }}" | base64 -d > /tmp/gcp-key.json
9992
export google_json_key_data="$(cat /tmp/gcp-key.json)"
10093
./.github/scripts/gcs/teardown.sh
101-
- name: Report fork PR status
102-
if: always() && inputs.pr_ref != ''
103-
uses: ./.github/actions/report-fork-status
104-
with:
105-
pr_ref: ${{ inputs.pr_ref }}
106-
name: GCS Integation All Tests

0 commit comments

Comments
 (0)