Skip to content

Commit

Permalink
fixing github comment action
Browse files Browse the repository at this point in the history
  • Loading branch information
aatmanvaidya committed Sep 18, 2023
1 parent d3cf74e commit db535f6
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions .github/workflows/test-chrome.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,6 @@ jobs:
name: extension
path: browser-extension/plugin/extension.zip

- name: Download and Comment Artifact Link
id: download-artifact
uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
name: extension

- name: Create PR Comment with Artifact Link
uses: actions/github-script@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const artifact_url = `${{ steps.download-artifact.outputs.download_url }}/extension.zip`;
const comment_body = `You can download the extension artifact [here](${artifact_url}).`;
await github.rest.issues.createComment({
issue_number: context.payload.pull_request.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment_body
});
# - name: Create PR Comment with Artifact Link
# uses: actions/github-script@v5
# with:
Expand All @@ -71,3 +50,24 @@ jobs:
# repo: context.repo.repo,
# body: comment_body
# });
- name: Create PR Comment with Artifact Link
uses: actions/github-script@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const artifacts_url = `${{ github.event.workflow_run.artifacts_url }}`;
const response = await github.request(artifacts_url, {
headers: {
Accept: "application/vnd.github+json",
Authorization: `Bearer ${{ secrets.GITHUB_TOKEN }}`
}
});
const artifact = response.data.artifacts.find(a => a.name === "extension");
const artifact_url = artifact.archive_download_url;
const comment_body = `You can download the extension artifact here.`;
await github.rest.issues.createComment({
issue_number: context.payload.pull_request.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: comment_body
});

0 comments on commit db535f6

Please sign in to comment.