diff --git a/.github/workflows/comment.yml b/.github/workflows/comment.yml index 6518c81c..f058d4e1 100644 --- a/.github/workflows/comment.yml +++ b/.github/workflows/comment.yml @@ -30,24 +30,30 @@ jobs: uses: actions/github-script@v7 with: script: | + var fs = require('fs'); + var child_process = require('child_process'); var artifacts = await github.rest.actions.listWorkflowRunArtifacts({ owner: context.repo.owner, repo: context.repo.repo, run_id: ${{ github.event.workflow_run.id }}, }); - var matchArtifact = artifacts.data.artifacts.filter((artifact) => { - return artifact.name == "screenshots" - })[0]; - var download = await github.rest.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: matchArtifact.id, - archive_format: 'zip', + var matchingArtifacts = artifacts.data.artifacts.filter((artifact) => { + return artifact.name.startsWith("screenshots-"); }); - var fs = require('fs'); - fs.writeFileSync('${{github.workspace}}/screenshots.zip', Buffer.from(download.data)); - - run: unzip -d screenshots screenshots.zip + for (const artifact of matchingArtifacts) { + var download = await github.rest.actions.downloadArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: artifact.id, + archive_format: 'zip', + }); + fs.writeFileSync(`${{github.workspace}}/${artifact.name}.zip`, Buffer.from(download.data)); + // Unzip the artifact + child_process.execSync(`unzip -d screenshots ${artifact.name}.zip`, {cwd: process.env.GITHUB_WORKSPACE}); + // Remove the zip file + fs.unlinkSync(`${{github.workspace}}/${artifact.name}.zip`); + } - name: Compose comment env: diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 038adcf3..5ede4f61 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -172,9 +172,9 @@ jobs: mv screenshots/*.png screenshots/dist/$aw_server/$aw_version - name: Upload screenshots if: ${{ success() || steps.e2e.conclusion == 'failure'}} - uses: actions/upload-artifact@v3.1.2 + uses: actions/upload-artifact@v4 with: - name: screenshots + name: screenshots-${{ matrix.aw-server }}-${{ matrix.aw-version }} path: screenshots/dist/* - name: Print server logs to console if: ${{ always() }}