Skip to content

Commit 1936b52

Browse files
authored
Merge pull request #4 from CopilotKit/fix/pr-tarball-publish-skip-non-pr
fix(ci): skip PR tarball publish on non-PR workflow runs
2 parents 719e51d + 195078e commit 1936b52

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

.github/workflows/pr-tarball-publish.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,29 @@ jobs:
2828
PR_NUMBER=$(gh api "repos/${REPO}/actions/runs/${RUN_ID}" \
2929
--jq '.pull_requests[0].number')
3030
if [[ -z "$PR_NUMBER" || "$PR_NUMBER" == "null" ]]; then
31-
echo "::error::Could not determine PR number from workflow run"
32-
exit 1
31+
echo "No PR associated with this workflow run (likely a push to main). Skipping."
32+
echo "skip=true" >> "$GITHUB_OUTPUT"
33+
exit 0
3334
fi
3435
echo "number=$PR_NUMBER" >> "$GITHUB_OUTPUT"
3536
3637
- name: Download tarball artifact
38+
if: steps.pr.outputs.skip != 'true'
3739
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
3840
with:
3941
name: pr-tarball
4042
run-id: ${{ github.event.workflow_run.id }}
4143
github-token: ${{ github.token }}
4244

4345
- name: Get tarball info
46+
if: steps.pr.outputs.skip != 'true'
4447
id: tarball
4548
run: |
4649
TARBALL_NAME=$(ls *.tgz | head -1 | xargs basename)
4750
echo "name=$TARBALL_NAME" >> "$GITHUB_OUTPUT"
4851
4952
- name: Create or update PR release
53+
if: steps.pr.outputs.skip != 'true'
5054
id: release
5155
env:
5256
GH_TOKEN: ${{ github.token }}
@@ -72,6 +76,7 @@ jobs:
7276
echo "url=$DOWNLOAD_URL" >> "$GITHUB_OUTPUT"
7377
7478
- name: Comment on PR
79+
if: steps.pr.outputs.skip != 'true'
7580
uses: marocchino/sticky-pull-request-comment@0ea0beb66eb9baf113663a64ec522f60e49231c0 # v3.0.4
7681
with:
7782
number: ${{ steps.pr.outputs.number }}

0 commit comments

Comments
 (0)