fix(infra) - Fix how we download and upload repo names (#11613)

Co-authored-by: gemini-cli-robot <gemini-cli-robot@google.com>
This commit is contained in:
shishu314
2025-10-21 16:33:54 -04:00
committed by GitHub
parent dd3b1cb653
commit f5e07d94bd
2 changed files with 21 additions and 37 deletions

View File

@@ -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 }}'

View File

@@ -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'