From 49fa0653aae99367eef8d347a0af7c1e561f0942 Mon Sep 17 00:00:00 2001 From: nerdCopter <56646290+nerdCopter@users.noreply.github.com> Date: Tue, 20 Feb 2024 15:51:18 -0600 Subject: [PATCH] Github Actions - Link Artifacts in PR comments --- .github/workflows/link-PR-artifacts.yml | 8 ++++---- .github/workflows/upload-PR-artifacts.yml | 13 ++++--------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/.github/workflows/link-PR-artifacts.yml b/.github/workflows/link-PR-artifacts.yml index 2d310b63d5..9e796accd1 100644 --- a/.github/workflows/link-PR-artifacts.yml +++ b/.github/workflows/link-PR-artifacts.yml @@ -20,7 +20,7 @@ jobs: run_id: context.payload.workflow_run.id, }); let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { - return artifact.name == "pr_number" + return artifact.name == "PR_ARTIFACTS" })[0]; let download = await github.rest.actions.downloadArtifact({ owner: context.repo.owner, @@ -29,10 +29,10 @@ jobs: archive_format: 'zip', }); let fs = require('fs'); - fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/pr_number.zip`, Buffer.from(download.data)); + fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/PR_ARTIFACTS.zip`, Buffer.from(download.data)); - name: 'Unzip artifact' - run: unzip pr_number.zip + run: unzip PR_ARTIFACTS.zip - name: 'Comment on PR' uses: actions/github-script@v6 @@ -40,7 +40,7 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} script: | let fs = require('fs'); - let issue_number = Number(fs.readFileSync('./pr_number')); + let issue_number = Number(fs.readFileSync('./PR_ARTIFACTS')); await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, diff --git a/.github/workflows/upload-PR-artifacts.yml b/.github/workflows/upload-PR-artifacts.yml index 9b573ddd33..f13cd48de1 100644 --- a/.github/workflows/upload-PR-artifacts.yml +++ b/.github/workflows/upload-PR-artifacts.yml @@ -8,13 +8,8 @@ jobs: runs-on: ubuntu-latest steps: - - name: Save PR number - env: - PR_NUMBER: ${{ github.event.number }} - run: | - mkdir -p ./pr - echo $PR_NUMBER > ./pr/pr_number - - uses: actions/upload-artifact@v4 + - name: Upload Artifacts + uses: actions/upload-artifact@v4 with: - name: pr_number - path: pr/ + name: PR_ARTIFACTS + path: obj/*.hex