-
Notifications
You must be signed in to change notification settings - Fork 7
ci: run integration tests on forks #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
cf28a5e
3eaa71d
6db57cd
f9fcf87
b100e93
f7d22eb
87741f6
ed16a4a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ | |
| name: Test Docker Agent Action | ||
|
|
||
| on: | ||
| pull_request: | ||
| pull_request_target: | ||
| types: [opened, synchronize, reopened] | ||
| branches: [main] | ||
| push: | ||
|
|
@@ -56,41 +56,26 @@ jobs: | |
| permissions: | ||
| contents: read | ||
| steps: | ||
| - name: Check if fork PR | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [HIGH] Fork-detection guards removed from This PR removes the "Check if fork PR" step and all Under This creates a single-commit path to a critical secret exfiltration vulnerability: applying the stated Suggested mitigation: Before or alongside the trigger change, add either:
|
||
| id: fork-check | ||
| run: | | ||
| # Use default empty string to handle edge cases (deleted branches, malformed events) | ||
| HEAD_REPO="${{ github.event.pull_request.head.repo.full_name || '' }}" | ||
| if [[ "${{ github.event_name }}" == "pull_request" && "$HEAD_REPO" != "${{ github.repository }}" && -n "$HEAD_REPO" ]]; then | ||
| echo "⏭️ Skipping - fork PR (secrets not available)" | ||
| echo "is_fork=true" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "is_fork=false" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Checkout code | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| ref: ${{ github.event.pull_request.head.sha }} | ||
|
derekmisler marked this conversation as resolved.
Outdated
|
||
|
|
||
| - name: Setup pnpm | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| uses: pnpm/action-setup@8912a9102ac27614460f54aedde9e1e7f9aec20d # v6.0.5 | ||
| with: | ||
| run_install: false | ||
|
|
||
| - name: Setup Node.js | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | ||
| with: | ||
| node-version: 24 | ||
| cache: pnpm | ||
|
|
||
| - name: Build action | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| run: pnpm install --frozen-lockfile && pnpm build | ||
|
|
||
| - name: Run test | ||
|
derekmisler marked this conversation as resolved.
|
||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [HIGH] The Today (with Note that |
||
| id: pirate | ||
| uses: ./ | ||
| with: | ||
|
|
@@ -99,7 +84,6 @@ jobs: | |
| openai-api-key: ${{ secrets.OPENAI_API_KEY }} | ||
|
|
||
| - name: Validate output and exit code | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| run: | | ||
| OUTPUT_FILE="${{ steps.pirate.outputs.output-file }}" | ||
|
|
||
|
|
@@ -153,6 +137,8 @@ jobs: | |
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| ref: ${{ github.event.pull_request.head.sha }} | ||
|
|
||
| - name: Setup pnpm | ||
| uses: pnpm/action-setup@8912a9102ac27614460f54aedde9e1e7f9aec20d # v6.0.5 | ||
|
|
@@ -205,45 +191,27 @@ jobs: | |
| env: | ||
| TEST_PR_NUMBER: ${{ github.event.pull_request.number || inputs.pr_number }} | ||
| steps: | ||
| - name: Check if fork PR | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [HIGH] Fork-detection guards removed from The "Check if fork PR" step and all However, the same concern applies: if the job-level guard is ever relaxed (e.g., to run on The |
||
| id: fork-check | ||
| run: | | ||
| # Use default empty string to handle edge cases (deleted branches, malformed events) | ||
| HEAD_REPO="${{ github.event.pull_request.head.repo.full_name || '' }}" | ||
| if [[ "${{ github.event_name }}" == "pull_request" && "$HEAD_REPO" != "${{ github.repository }}" && -n "$HEAD_REPO" ]]; then | ||
| echo "⏭️ Skipping - fork PR (secrets not available)" | ||
| echo "is_fork=true" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "is_fork=false" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Checkout code | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
|
|
||
| - name: Setup pnpm | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| uses: pnpm/action-setup@8912a9102ac27614460f54aedde9e1e7f9aec20d # v6.0.5 | ||
| with: | ||
| run_install: false | ||
|
|
||
| - name: Setup Node.js | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | ||
| with: | ||
| node-version: 24 | ||
| cache: pnpm | ||
|
|
||
| - name: Build action | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| run: pnpm install --frozen-lockfile && pnpm build | ||
|
|
||
| - name: Setup credentials | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| uses: docker/cagent-action/setup-credentials@367a30ddb41e0156459d03750f508eac03f3c38a # v1.5.5 | ||
|
|
||
| - name: Create anchor issue comment on current PR | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| id: create-anchor | ||
| env: | ||
| GH_TOKEN: ${{ env.GITHUB_APP_TOKEN || github.token }} | ||
|
|
@@ -256,7 +224,6 @@ jobs: | |
| echo "test_comment_id=$COMMENT_ID" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Write synthetic issue_comment event | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| run: | | ||
| COMMENT_ID="${{ steps.create-anchor.outputs.test_comment_id }}" | ||
| jq -n \ | ||
|
|
@@ -282,7 +249,6 @@ jobs: | |
| }' > /tmp/test-event-toplevel.json | ||
|
|
||
| - name: Run mention-reply handler | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| id: mention-handler | ||
| env: | ||
| INPUT_GITHUB-TOKEN: ${{ env.GITHUB_APP_TOKEN || github.token }} | ||
|
|
@@ -293,7 +259,6 @@ jobs: | |
| node "$GITHUB_WORKSPACE/dist/mention-reply.js" | ||
|
|
||
| - name: Assert should-reply output | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| run: | | ||
| SHOULD_REPLY="${{ steps.mention-handler.outputs.should-reply }}" | ||
| echo "should-reply=$SHOULD_REPLY" | ||
|
|
@@ -307,7 +272,7 @@ jobs: | |
| fi | ||
|
|
||
| - name: Run mention reply | ||
| if: steps.fork-check.outputs.is_fork != 'true' && steps.mention-handler.outputs.should-reply == 'true' | ||
| if: steps.mention-handler.outputs.should-reply == 'true' | ||
| id: run-reply | ||
| uses: ./review-pr/mention-reply | ||
| with: | ||
|
|
@@ -323,7 +288,7 @@ jobs: | |
| skip-auth: "true" | ||
|
|
||
| - name: Verify reply was posted | ||
| if: steps.fork-check.outputs.is_fork != 'true' && steps.mention-handler.outputs.should-reply == 'true' | ||
| if: steps.mention-handler.outputs.should-reply == 'true' | ||
| env: | ||
| GH_TOKEN: ${{ env.GITHUB_APP_TOKEN || github.token }} | ||
| run: | | ||
|
|
@@ -336,7 +301,7 @@ jobs: | |
| echo "✅ Reply posted successfully ($FOUND comment(s) found)" | ||
|
|
||
| - name: Cleanup test comments | ||
| if: always() && steps.fork-check.outputs.is_fork != 'true' | ||
| if: always() | ||
| continue-on-error: true | ||
| env: | ||
| GH_TOKEN: ${{ env.GITHUB_APP_TOKEN || github.token }} | ||
|
|
@@ -366,44 +331,27 @@ jobs: | |
| env: | ||
| TEST_PR_NUMBER: ${{ github.event.pull_request.number || inputs.pr_number }} | ||
| steps: | ||
| - name: Check if fork PR | ||
| id: fork-check | ||
| run: | | ||
| HEAD_REPO="${{ github.event.pull_request.head.repo.full_name || '' }}" | ||
| if [[ "${{ github.event_name }}" == "pull_request" && "$HEAD_REPO" != "${{ github.repository }}" && -n "$HEAD_REPO" ]]; then | ||
| echo "⏭️ Skipping - fork PR (secrets not available)" | ||
| echo "is_fork=true" >> $GITHUB_OUTPUT | ||
| else | ||
| echo "is_fork=false" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Checkout code | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
|
|
||
| - name: Setup pnpm | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| uses: pnpm/action-setup@8912a9102ac27614460f54aedde9e1e7f9aec20d # v6.0.5 | ||
| with: | ||
| run_install: false | ||
|
|
||
| - name: Setup Node.js | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | ||
| with: | ||
| node-version: 24 | ||
| cache: pnpm | ||
|
|
||
| - name: Build action | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| run: pnpm install --frozen-lockfile && pnpm build | ||
|
|
||
| - name: Setup credentials | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| uses: docker/cagent-action/setup-credentials@367a30ddb41e0156459d03750f508eac03f3c38a # v1.5.5 | ||
|
|
||
| - name: Create anchor review comment on current PR | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| id: create-anchor | ||
| env: | ||
| GH_TOKEN: ${{ env.GITHUB_APP_TOKEN || github.token }} | ||
|
|
@@ -428,7 +376,6 @@ jobs: | |
| echo "test_comment_id=$COMMENT_ID" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Write synthetic pull_request_review_comment event | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| run: | | ||
| COMMENT_ID="${{ steps.create-anchor.outputs.test_comment_id }}" | ||
| jq -n \ | ||
|
|
@@ -455,7 +402,6 @@ jobs: | |
| }' > /tmp/test-event-inline.json | ||
|
|
||
| - name: Run mention-reply handler | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| id: mention-handler | ||
| env: | ||
| INPUT_GITHUB-TOKEN: ${{ env.GITHUB_APP_TOKEN || github.token }} | ||
|
|
@@ -466,7 +412,6 @@ jobs: | |
| node "$GITHUB_WORKSPACE/dist/mention-reply.js" | ||
|
|
||
| - name: Assert should-reply output | ||
| if: steps.fork-check.outputs.is_fork != 'true' | ||
| run: | | ||
| SHOULD_REPLY="${{ steps.mention-handler.outputs.should-reply }}" | ||
| echo "should-reply=$SHOULD_REPLY" | ||
|
|
@@ -478,7 +423,7 @@ jobs: | |
| fi | ||
|
|
||
| - name: Assert inline outputs | ||
| if: steps.fork-check.outputs.is_fork != 'true' && steps.mention-handler.outputs.should-reply == 'true' | ||
| if: steps.mention-handler.outputs.should-reply == 'true' | ||
| run: | | ||
| IS_INLINE="${{ steps.mention-handler.outputs.is-inline }}" | ||
| IN_REPLY_TO_ID="${{ steps.mention-handler.outputs.in-reply-to-id }}" | ||
|
|
@@ -495,7 +440,7 @@ jobs: | |
| echo "✅ in-reply-to-id=$IN_REPLY_TO_ID (matches anchor comment)" | ||
|
|
||
| - name: Run mention reply | ||
| if: steps.fork-check.outputs.is_fork != 'true' && steps.mention-handler.outputs.should-reply == 'true' | ||
| if: steps.mention-handler.outputs.should-reply == 'true' | ||
| id: run-reply | ||
| uses: ./review-pr/mention-reply | ||
| with: | ||
|
|
@@ -511,7 +456,7 @@ jobs: | |
| skip-auth: "true" | ||
|
|
||
| - name: Verify inline reply was posted in thread | ||
| if: steps.fork-check.outputs.is_fork != 'true' && steps.mention-handler.outputs.should-reply == 'true' | ||
| if: steps.mention-handler.outputs.should-reply == 'true' | ||
| env: | ||
| GH_TOKEN: ${{ env.GITHUB_APP_TOKEN || github.token }} | ||
| ANCHOR_ID: ${{ steps.create-anchor.outputs.test_comment_id }} | ||
|
|
@@ -526,7 +471,7 @@ jobs: | |
| echo "✅ Inline reply posted successfully" | ||
|
|
||
| - name: Cleanup anchor comment and thread replies | ||
| if: always() && steps.fork-check.outputs.is_fork != 'true' | ||
| if: always() | ||
| continue-on-error: true | ||
| env: | ||
| GH_TOKEN: ${{ env.GITHUB_APP_TOKEN || github.token }} | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.