Skip to content

Commit d0f4510

Browse files
committed
ci: fix canary-comment dependency
1 parent 8b5b74f commit d0f4510

File tree

2 files changed

+18
-37
lines changed

2 files changed

+18
-37
lines changed

.github/workflows/canary-comment.yml

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -43,30 +43,27 @@ jobs:
4343
console.log('No associated PR found');
4444
}
4545
46-
# Only continue if we found a PR and the workflow succeeded
47-
- name: Download canary info
46+
# Extract canary info from the workflow run
47+
- name: Extract canary info
4848
if: ${{ steps.pr-info.outputs.found == 'true' && github.event.workflow_run.conclusion == 'success' }}
49-
uses: actions/download-artifact@v4
49+
id: canary-info
50+
uses: actions/github-script@v7
5051
with:
51-
name: canary-info
52-
path: canary-info/
53-
run-id: ${{ github.event.workflow_run.id }}
54-
continue-on-error: true
52+
script: |
53+
const workflowRun = context.payload.workflow_run;
5554
56-
- name: Read canary info
57-
if: ${{ steps.pr-info.outputs.found == 'true' && github.event.workflow_run.conclusion == 'success' }}
58-
id: canary-info
59-
run: |
60-
if [ -f "canary-info/canary-tags.txt" ]; then
61-
# Read the first tag (DockerHub) from the tags
62-
FIRST_TAG=$(head -n1 canary-info/canary-tags.txt)
63-
echo "tag=$FIRST_TAG" >> $GITHUB_OUTPUT
64-
echo "found=true" >> $GITHUB_OUTPUT
65-
echo "commit-sha=$(cat canary-info/commit-sha.txt)" >> $GITHUB_OUTPUT
66-
else
67-
echo "found=false" >> $GITHUB_OUTPUT
68-
fi
69-
continue-on-error: true
55+
// Extract PR number from the branch name or workflow run
56+
const prNumber = '${{ steps.pr-info.outputs.pr_number }}';
57+
const commitSha = workflowRun.head_sha;
58+
59+
// Generate the canary tag based on the pattern used in canary-deploy.yml
60+
const canaryTag = `supabase/postgres-meta:canary-pr-${prNumber}-${commitSha}`;
61+
62+
core.setOutput('tag', canaryTag);
63+
core.setOutput('found', 'true');
64+
core.setOutput('commit-sha', commitSha);
65+
66+
console.log(`Generated canary tag: ${canaryTag}`);
7067
7168
# Find existing comment
7269
- name: Find existing comment

.github/workflows/canary-deploy.yml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -105,19 +105,3 @@ jobs:
105105
org.opencontainers.image.revision=${{ github.event.pull_request.head.sha }}
106106
canary.pr.number=${{ github.event.pull_request.number }}
107107
canary.pr.author=${{ github.event.pull_request.user.login }}
108-
109-
# Save canary info for the comment workflow
110-
- name: Save canary info
111-
run: |
112-
mkdir -p canary-info
113-
echo "${{ steps.meta.outputs.tags }}" > canary-info/canary-tags.txt
114-
echo "${{ github.event.pull_request.number }}" > canary-info/pr-number.txt
115-
echo "${{ github.event.pull_request.head.sha }}" > canary-info/commit-sha.txt
116-
echo "postgres-meta" > canary-info/package-name.txt
117-
118-
- name: Upload canary info
119-
uses: actions/upload-artifact@v4
120-
with:
121-
name: canary-info
122-
path: canary-info/
123-
retention-days: 7

0 commit comments

Comments
 (0)