Skip to content

Commit 8b35454

Browse files
mtfishmanclaude
andauthored
Add fork-aware skip for private downstream tests and update trigger (#48)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f98e63c commit 8b35454

2 files changed

Lines changed: 53 additions & 7 deletions

File tree

.github/workflows/IntegrationTest.yml

Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ on:
2222
default: false
2323
required: false
2424
type: boolean
25+
is-fork-pr:
26+
description: "When true, skip URL-based (private/unregistered) packages and post a notification comment instead. Callers should set this to the result of comparing PR head and base repo names."
27+
default: false
28+
required: false
29+
type: boolean
2530
secrets:
2631
TAGBOT_PAT:
2732
description: "GitHub PAT for cloning private repositories via HTTPS."
@@ -38,22 +43,62 @@ jobs:
3843
os: [ubuntu-latest]
3944

4045
steps:
46+
- name: "Check if private downstream test should be skipped"
47+
id: skip-check
48+
run: |
49+
pkg="${{ inputs.pkg }}"
50+
is_fork="${{ inputs.is-fork-pr }}"
51+
if [[ "$is_fork" == "true" ]] && { [[ "$pkg" == https://* ]] || [[ "$pkg" == git@* ]]; }; then
52+
echo "should-skip=true" >> $GITHUB_OUTPUT
53+
# Derive a comment tag from the full URL for deduplication
54+
tag="integration-skip-$(echo "$pkg" | sed 's|[^a-zA-Z0-9]|-|g')"
55+
echo "comment-tag=$tag" >> $GITHUB_OUTPUT
56+
else
57+
echo "should-skip=false" >> $GITHUB_OUTPUT
58+
fi
59+
60+
- name: "Find existing skip notification comment"
61+
if: steps.skip-check.outputs.should-skip == 'true'
62+
id: find-comment
63+
uses: peter-evans/find-comment@v3
64+
with:
65+
issue-number: ${{ github.event.pull_request.number }}
66+
body-includes: "<!-- ${{ steps.skip-check.outputs.comment-tag }} -->"
67+
68+
- name: "Post skip notification comment"
69+
if: steps.skip-check.outputs.should-skip == 'true'
70+
uses: peter-evans/create-or-update-comment@v4
71+
with:
72+
comment-id: ${{ steps.find-comment.outputs.comment-id }}
73+
issue-number: ${{ github.event.pull_request.number }}
74+
body: |
75+
<!-- ${{ steps.skip-check.outputs.comment-tag }} -->
76+
Private downstream test for `${{ inputs.pkg }}` was skipped (PR was made from a fork). A maintainer can run:
77+
```
78+
/integrationtest ${{ inputs.pkg }}
79+
```
80+
edit-mode: replace
81+
82+
- name: "Private downstream test skipped (fork PR)"
83+
if: steps.skip-check.outputs.should-skip == 'true'
84+
run: echo "Skipped — PR was made from a fork. Use /integrationtest to trigger manually."
85+
4186
- name: "No downstream packages configured"
42-
if: inputs.pkg == '__none__'
87+
if: inputs.pkg == '__none__' && steps.skip-check.outputs.should-skip != 'true'
4388
run: echo "No downstream integration tests configured."
4489
- uses: actions/checkout@v4
45-
if: inputs.pkg != '__none__'
90+
if: inputs.pkg != '__none__' && steps.skip-check.outputs.should-skip != 'true'
4691
- uses: julia-actions/setup-julia@v2
47-
if: inputs.pkg != '__none__'
92+
if: inputs.pkg != '__none__' && steps.skip-check.outputs.should-skip != 'true'
4893
with:
4994
version: ${{ inputs.julia-version }}
5095
arch: x64
5196
- uses: julia-actions/julia-buildpkg@latest
52-
if: inputs.pkg != '__none__'
97+
if: inputs.pkg != '__none__' && steps.skip-check.outputs.should-skip != 'true'
5398
with:
5499
localregistry: "${{ inputs.localregistry }}"
55100
- name: "Configure git authentication for private repository"
56-
if: inputs.pkg != '__none__'
101+
if: inputs.pkg != '__none__' && steps.skip-check.outputs.should-skip != 'true'
57102
env:
58103
TOKEN: ${{ secrets.TAGBOT_PAT }}
59104
run: |
@@ -64,7 +109,7 @@ jobs:
64109
fi
65110
fi
66111
- name: Run the downstream tests
67-
if: inputs.pkg != '__none__'
112+
if: inputs.pkg != '__none__' && steps.skip-check.outputs.should-skip != 'true'
68113
shell: julia --color=yes --project=downstream {0}
69114
run: |
70115
using Pkg

.github/workflows/IntegrationTestRequest.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
inputs:
66
trigger:
77
description: "Required trigger for requesting the test suite"
8-
default: "@integrationtests"
8+
default: "/integrationtest"
99
required: false
1010
type: string
1111
localregistry:
@@ -41,6 +41,7 @@ jobs:
4141
with:
4242
localregistry: "${{ inputs.localregistry }}"
4343
pkg: "${{ needs.get-pr-comment.outputs.pkg || ''}}"
44+
secrets: inherit
4445

4546
report:
4647
needs: [get-pr-comment, runtests]

0 commit comments

Comments
 (0)