Skip to content

Commit ae56320

Browse files
authored
set warning upload artifacts when check-artifact step return error (#6286)
related to issue: pytorch/executorch#8125 example run: https://github.com/pytorch/executorch/actions/runs/13275229180/job/37063477575 Set defult warning for missing artifact ![image](https://github.com/user-attachments/assets/f627f63e-a960-4cf1-ad78-57ce91a06447) add test for no artifacts
1 parent 0c4b50f commit ae56320

File tree

4 files changed

+42
-8
lines changed

4 files changed

+42
-8
lines changed

.github/workflows/linux_job.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,6 @@ jobs:
306306
if [[ -d "artifacts-to-be-uploaded" ]]; then
307307
mv -v artifacts-to-be-uploaded/* "${RUNNER_ARTIFACT_DIR}/"
308308
fi
309-
# Set to fail upload step if there are no files for upload and expected files for upload
310-
echo 'if-no-files-found=error' >> "${GITHUB_OUTPUT}"
311309
fi
312310
313311
upload_docs=0
@@ -328,7 +326,6 @@ jobs:
328326
with:
329327
name: ${{ inputs.upload-artifact }}
330328
path: ${{ runner.temp }}/artifacts/
331-
if-no-files-found: ${{ steps.check-artifacts.outputs.if-no-files-found }}
332329

333330
# NB: This only works with our AWS runners
334331
- name: Upload artifacts to S3 (if any)
@@ -339,7 +336,6 @@ jobs:
339336
s3-bucket: gha-artifacts
340337
s3-prefix: |
341338
${{ env.REPOSITORY }}/${{ github.run_id }}/artifacts
342-
if-no-files-found: ${{ steps.check-artifacts.outputs.if-no-files-found }}
343339
path: ${{ runner.temp }}/artifacts/
344340

345341
- name: Upload documentation to S3 (if any)

.github/workflows/linux_job_v2.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,6 @@ jobs:
306306
if [[ -d "artifacts-to-be-uploaded" ]]; then
307307
mv -v artifacts-to-be-uploaded/* "${RUNNER_ARTIFACT_DIR}/"
308308
fi
309-
# Set to fail upload step if there are no files for upload and expected files for upload
310-
echo 'if-no-files-found=error' >> "${GITHUB_OUTPUT}"
311309
fi
312310
313311
upload_docs=0
@@ -328,7 +326,6 @@ jobs:
328326
with:
329327
name: ${{ inputs.upload-artifact }}
330328
path: ${{ runner.temp }}/artifacts/
331-
if-no-files-found: ${{ steps.check-artifacts.outputs.if-no-files-found }}
332329

333330
# NB: This only works with our AWS runners
334331
- name: Upload artifacts to S3 (if any)
@@ -339,7 +336,6 @@ jobs:
339336
s3-bucket: gha-artifacts
340337
s3-prefix: |
341338
${{ env.REPOSITORY }}/${{ github.run_id }}/artifacts
342-
if-no-files-found: ${{ steps.check-artifacts.outputs.if-no-files-found }}
343339
path: ${{ runner.temp }}/artifacts/
344340

345341
- name: Upload documentation to S3 (if any)

.github/workflows/test_linux_job.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,15 @@ jobs:
117117
upload-artifact: my-cool-artifact
118118
script: |
119119
echo "hello" > "${RUNNER_ARTIFACT_DIR}/cool_beans"
120+
test-upload-artifact-no-artifact:
121+
uses: ./.github/workflows/linux_job.yml
122+
with:
123+
runner: linux.2xlarge
124+
test-infra-repository: ${{ github.repository }}
125+
test-infra-ref: ${{ github.ref }}
126+
upload-artifact: my-cool-artifact
127+
script: |
128+
echo "hello"
120129
test-upload-artifact-s3:
121130
uses: ./.github/workflows/linux_job.yml
122131
with:
@@ -127,6 +136,16 @@ jobs:
127136
upload-artifact-to-s3: true
128137
script: |
129138
echo "hello" > "${RUNNER_ARTIFACT_DIR}/cool_beans"
139+
test-upload-artifact-s3-no-artifact:
140+
uses: ./.github/workflows/linux_job.yml
141+
with:
142+
runner: linux.2xlarge
143+
test-infra-repository: ${{ github.repository }}
144+
test-infra-ref: ${{ github.ref }}
145+
upload-artifact: my-cool-artifact
146+
upload-artifact-to-s3: true
147+
script: |
148+
echo "hello"
130149
test-download-artifact:
131150
needs: test-upload-artifact
132151
uses: ./.github/workflows/linux_job.yml

.github/workflows/test_linux_job_v2.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,17 @@ jobs:
102102
upload-artifact: my-cool-artifact
103103
script: |
104104
echo "hello" > "${RUNNER_ARTIFACT_DIR}/cool_beans"
105+
test-upload-artifact-no-artifact:
106+
uses: ./.github/workflows/linux_job_v2.yml
107+
permissions:
108+
id-token: write
109+
with:
110+
runner: linux.2xlarge
111+
test-infra-repository: ${{ github.repository }}
112+
test-infra-ref: ${{ github.ref }}
113+
upload-artifact: my-cool-artifact
114+
script: |
115+
echo "hello"
105116
test-upload-artifact-s3:
106117
uses: ./.github/workflows/linux_job_v2.yml
107118
permissions:
@@ -114,6 +125,18 @@ jobs:
114125
upload-artifact-to-s3: true
115126
script: |
116127
echo "hello" > "${RUNNER_ARTIFACT_DIR}/cool_beans"
128+
test-upload-artifact-s3-no-artifact:
129+
uses: ./.github/workflows/linux_job_v2.yml
130+
permissions:
131+
id-token: write
132+
with:
133+
runner: linux.2xlarge
134+
test-infra-repository: ${{ github.repository }}
135+
test-infra-ref: ${{ github.ref }}
136+
upload-artifact: my-cool-artifact
137+
upload-artifact-to-s3: true
138+
script: |
139+
echo "hello"
117140
test-download-artifact:
118141
needs: test-upload-artifact
119142
uses: ./.github/workflows/linux_job_v2.yml

0 commit comments

Comments
 (0)