Skip to content

Commit

Permalink
Artiweb workflow fix (#3098)
Browse files Browse the repository at this point in the history
Fix script syntax errors
  • Loading branch information
jwiesler committed Apr 3, 2023
2 parents d0047a4 + cdbedad commit 63adb58
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions .github/workflows/artiweb.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: Artiweb Comment

on:
workflow_run:
workflows: [Tests]
Expand All @@ -10,6 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: 'Download artifact'
id: da
uses: actions/github-script@v6
with:
script: |
Expand All @@ -21,6 +24,7 @@ jobs:
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "pr-number"
})[0];
core.debug("Found artifact id: " + matchArtifact.id);
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
Expand All @@ -32,35 +36,38 @@ jobs:
let testArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "test-results"
})[0];
echo "TEST_ARTIFACT_NUMBER={testArtifact.id}" >> $GITHUB_ENV
core.debug("Found test artifact id: " + testArtifact.id);
core.setOutput("test-artifact-id", testArtifact.id);
- name: 'Unzip artifact'
run: unzip pr_number.zip

- name: 'Read pr number'
id: rpn
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
let fs = require('fs');
let issue_number = Number(fs.readFileSync('./pr_number'));
echo "PR_NUMBER={issue_number}" >> $GITHUB_ENV
core.debug("Found pr number " + issue_number);
core.setOutput("pr-number", issue_number);
- name: Find Comment
uses: peter-evans/find-comment@v2
id: fc
with:
issue-number: ${{ env.PR_NUMBER }}
issue-number: ${{ steps.da.test-artifact-id }}
comment-author: 'KiKi'
body-includes: Artiweb

- name: Create or update comment
uses: peter-evans/create-or-update-comment@v2
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ env.PR_NUMBER }}
issue-number: ${{ steps.rpn.pr-number }}
body: |
Test artifacts will be available on [Artiweb](https://keyproject.github.io/artiweb/${env.PR_NUMBER}/).
Test artifacts are available on [Artiweb](https://keyproject.github.io/artiweb/${steps.rpn.pr-number}/).
The newest artifact is [here](https://keyproject.github.io/artiweb/${env.PR_NUMBER}/${env.TEST_ARTIFACT_NUMBER}/).
The newest artifact is [here](https://keyproject.github.io/artiweb/${steps.rpn.pr-number}/${steps.da.test-artifact-id}/).
edit-mode: replace

0 comments on commit 63adb58

Please sign in to comment.