Skip to content

Commit

Permalink
Use pull request number for automation
Browse files Browse the repository at this point in the history
  • Loading branch information
josevalim committed Jan 3, 2025
1 parent 218a3da commit 658524b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
workflows: ["CI"]
types:
- completed
branches-ignore:
- main

permissions:
pull-requests: write
Expand All @@ -26,13 +28,14 @@ jobs:
throw new Error('Expected one artifact')
}
const pullNumber = context.payload.workflow_run.pull_requests[0].number;
const artifactUrl = artifacts.data.artifacts[0].archive_download_url;
const commentBody = `<!-- build-artifact-comment -->\n📦 Docs artifacts are ready: ${artifactUrl}`;
const comments = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
issue_number: pullNumber
});
const botComment = comments.data.find(comment =>
Expand All @@ -51,7 +54,7 @@ jobs:
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
issue_number: pullNumber,
body: commentBody
});
}

0 comments on commit 658524b

Please sign in to comment.