diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 54922794f6..c6621edefc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -87,8 +87,8 @@ jobs: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV continue-on-error: true - - name: Make artifact name - id: make_artifactname + - name: set artifact name + id: set_artifactname run: | if [[ "${{ github.REPOSITORY }}" == "emuflight/EmuFlight" ]] ; then ARTIFACT_NAME="EmuFlight-${{ env.VERSION }}-${{ github.run_number }}" diff --git a/.github/workflows/link-PR-artifacts.yml b/.github/workflows/link-PR-artifacts.yml index 9e796accd1..4a53917e5f 100644 --- a/.github/workflows/link-PR-artifacts.yml +++ b/.github/workflows/link-PR-artifacts.yml @@ -10,6 +10,17 @@ jobs: download: runs-on: ubuntu-latest steps: + - name: set artifact name + id: set_artifactname + run: | + if [[ "${{ github.REPOSITORY }}" == "emuflight/EmuFlight" ]] ; then + ARTIFACT_NAME="EmuFlight-${{ env.VERSION }}-${{ github.run_number }}" + else + ARTIFACT_NAME="EmuFlight-${{ env.VERSION }}-${{ github.ACTOR }}-${{ github.run_number }}" + fi + echo "${ARTIFACT_NAME}" + echo "ARTIFACT_NAME=${ARTIFACT_NAME}" >> $GITHUB_ENV + - name: 'Download artifact' uses: actions/github-script@v6 with: @@ -20,7 +31,7 @@ jobs: run_id: context.payload.workflow_run.id, }); let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { - return artifact.name == "PR_ARTIFACTS" + return artifact.name == `${ARTIFACT_NAME}` })[0]; let download = await github.rest.actions.downloadArtifact({ owner: context.repo.owner, @@ -29,10 +40,10 @@ jobs: archive_format: 'zip', }); let fs = require('fs'); - fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/PR_ARTIFACTS.zip`, Buffer.from(download.data)); + fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/${ARTIFACT_NAME}.zip`, Buffer.from(download.data)); - name: 'Unzip artifact' - run: unzip PR_ARTIFACTS.zip + run: unzip `${ARTIFACT_NAME}.zip` - name: 'Comment on PR' uses: actions/github-script@v6 @@ -40,7 +51,7 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} script: | let fs = require('fs'); - let issue_number = Number(fs.readFileSync('./PR_ARTIFACTS')); + let issue_number = Number(fs.readFileSync(`./${ARTIFACT_NAME}`)); await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo,