From 1faeb9b3244e9d4cc8fc710d201b4748eebcd44a Mon Sep 17 00:00:00 2001 From: syuilo <4439005+syuilo@users.noreply.github.com> Date: Sat, 27 Jun 2026 11:53:36 +0900 Subject: [PATCH] refactor(dev): use actions/download-artifact --- .github/workflows/report-api-diff.yml | 36 +++++++-------------- .github/workflows/report-backend-memory.yml | 35 ++++++-------------- 2 files changed, 21 insertions(+), 50 deletions(-) diff --git a/.github/workflows/report-api-diff.yml b/.github/workflows/report-api-diff.yml index 08af192303..67d163d697 100644 --- a/.github/workflows/report-api-diff.yml +++ b/.github/workflows/report-api-diff.yml @@ -11,36 +11,22 @@ jobs: runs-on: ubuntu-latest if: ${{ github.event.workflow_run.conclusion == 'success' }} permissions: + actions: read pull-requests: write # api-artifact steps: - - name: Download artifact - uses: actions/github-script@v9 + - name: Download artifacts + uses: actions/download-artifact@v8 with: - script: | - const fs = require('fs'); - let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: context.payload.workflow_run.id, - }); - let matchArtifacts = allArtifacts.data.artifacts.filter((artifact) => { - return artifact.name.startsWith("api-artifact-") || artifact.name == "api-artifact" - }); - await Promise.all(matchArtifacts.map(async (artifact) => { - let download = await github.rest.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: artifact.id, - archive_format: 'zip', - }); - await fs.promises.writeFile(`${process.env.GITHUB_WORKSPACE}/${artifact.name}.zip`, Buffer.from(download.data)); - })); - - name: Extract all artifacts - run: | - find . -mindepth 1 -maxdepth 1 -type f -name '*.zip' -exec unzip {} -d artifacts ';' - ls -la + pattern: api-artifact-* + path: artifacts + merge-multiple: true + github-token: ${{ github.token }} + repository: ${{ github.repository }} + run-id: ${{ github.event.workflow_run.id }} + - name: Check artifacts + run: ls -lh artifacts/ - name: Load PR Number id: load-pr-num run: echo "pr-number=$(cat artifacts/pr_number)" >> "$GITHUB_OUTPUT" diff --git a/.github/workflows/report-backend-memory.yml b/.github/workflows/report-backend-memory.yml index 78461f6a27..147e20d4d6 100644 --- a/.github/workflows/report-backend-memory.yml +++ b/.github/workflows/report-backend-memory.yml @@ -19,32 +19,17 @@ jobs: - name: Checkout uses: actions/checkout@v6.0.2 - - name: Download artifact - uses: actions/github-script@v9 + - name: Download artifacts + uses: actions/download-artifact@v8 with: - script: | - const fs = require('fs'); - let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: context.payload.workflow_run.id, - }); - let matchArtifacts = allArtifacts.data.artifacts.filter((artifact) => { - return artifact.name.startsWith("memory-artifact-") || artifact.name == "memory-artifact" - }); - await Promise.all(matchArtifacts.map(async (artifact) => { - let download = await github.rest.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: artifact.id, - archive_format: 'zip', - }); - await fs.promises.writeFile(`${process.env.GITHUB_WORKSPACE}/${artifact.name}.zip`, Buffer.from(download.data)); - })); - - name: Extract all artifacts - run: | - find . -mindepth 1 -maxdepth 1 -type f -name '*.zip' -exec unzip {} -d artifacts ';' - ls -la artifacts/ + pattern: memory-artifact-* + path: artifacts + merge-multiple: true + github-token: ${{ github.token }} + repository: ${{ github.repository }} + run-id: ${{ github.event.workflow_run.id }} + - name: Check artifacts + run: ls -lh artifacts/ - name: Load PR Number id: load-pr-num run: echo "pr-number=$(cat artifacts/pr_number)" >> "$GITHUB_OUTPUT"