From f5e07d94bd201bf60c8a77287574bf962b72afd4 Mon Sep 17 00:00:00 2001 From: shishu314 Date: Tue, 21 Oct 2025 16:33:54 -0400 Subject: [PATCH] fix(infra) - Fix how we download and upload repo names (#11613) Co-authored-by: gemini-cli-robot --- .github/workflows/test_chained_e2e.yml | 56 +++++++++----------------- .github/workflows/trigger_e2e.yml | 2 +- 2 files changed, 21 insertions(+), 37 deletions(-) diff --git a/.github/workflows/test_chained_e2e.yml b/.github/workflows/test_chained_e2e.yml index f6a79d75ea..95674f6719 100644 --- a/.github/workflows/test_chained_e2e.yml +++ b/.github/workflows/test_chained_e2e.yml @@ -35,37 +35,27 @@ jobs: outputs: repo_name: '${{ steps.output-repo-name.outputs.repo_name }}' steps: - - name: 'Download artifact' - if: "${{ github.event_name == 'workflow_run' }}" - uses: 'actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd' # ratchet:actions/github-script@v8 + - name: 'Mock Repo Artifact' + if: "${{ github.event_name != 'workflow_run' }}" + env: + REPO_NAME: '${{ github.event.inputs.repo_name }}' + run: | + mkdir -p ./pr + echo '${{ env.REPO_NAME }}' > ./pr/repo_name + - uses: 'actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02' # ratchet:actions/upload-artifact@v4 with: - script: | - let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: context.payload.workflow_run.id, - }); - let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { - return artifact.name == "repo_name" - })[0]; - let download = await github.rest.actions.downloadArtifact({ - owner: context.repo.owner, - repo: context.repo.repo, - artifact_id: matchArtifact.id, - archive_format: 'zip', - }); - const fs = require('fs'); - const path = require('path'); - const temp = '${{ runner.temp }}/artifacts'; - if (!fs.existsSync(temp)){ - fs.mkdirSync(temp); - } - fs.writeFileSync(path.join(temp, 'repo_name.zip'), Buffer.from(download.data)); - - name: 'Unzip artifact' - if: "${{ github.event_name == 'workflow_run' }}" - run: 'unzip "${{ runner.temp }}/artifacts/repo_name.zip" -d "${{ runner.temp }}/artifacts"' + name: 'repo_name' + path: 'pr/' + - name: 'Download the repo_name artifact' + uses: 'actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0' # ratchet:actions/download-artifact@v5 + env: + RUN_ID: "${{ github.event_name == 'workflow_run' && github.event.workflow_run.id || github.run_id }}" + with: + github-token: '${{ secrets.GITHUB_TOKEN }}' + name: 'repo_name' + run-id: '${{ env.RUN_ID }}' + path: '${{ runner.temp }}/artifacts' - name: 'Output Repo Name' - if: "${{ github.event_name == 'workflow_run' }}" id: 'output-repo-name' uses: 'actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd' # ratchet:actions/github-script@v8 with: @@ -74,14 +64,8 @@ jobs: const fs = require('fs'); const path = require('path'); const temp = '${{ runner.temp }}/artifacts'; - const repo_name = Number(fs.readFileSync(path.join(temp, 'repo_name'))); + const repo_name = String(fs.readFileSync(path.join(temp, 'repo_name'))); core.setOutput('repo_name', repo_name); - - name: 'Output Input Repo Name' - if: "${{ github.event_name != 'workflow_run' }}" - id: 'output-input-repo-name' - run: | - echo "repo_name=${{ github.event.inputs.repo_name }}" >> "$GITHUB_OUTPUT" - shell: 'bash' e2e_linux: name: 'E2E Test (Linux) - ${{ matrix.sandbox }}' diff --git a/.github/workflows/trigger_e2e.yml b/.github/workflows/trigger_e2e.yml index 540a65bb64..dd6079cee2 100644 --- a/.github/workflows/trigger_e2e.yml +++ b/.github/workflows/trigger_e2e.yml @@ -19,7 +19,7 @@ jobs: REPO_NAME: '${{ github.event.repository.name }}' run: | mkdir -p ./pr - echo '$REPO_NAME' > ./pr/repo_name + echo '${{ env.REPO_NAME }}' > ./pr/repo_name - uses: 'actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02' # ratchet:actions/upload-artifact@v4 with: name: 'repo_name'