Skip to content

Commit e72da60

Browse files
committed
Check repo visibility before uploading report
Currently, after the GitHub Action runs CBMC proofs, the proof reports are compressed and uploaded to GitHub storage for users to download and view. This commit turns this functionality off if the repository is private, i.e. it cannot be reached over the public internet. This fixes #192.
1 parent c3e266b commit e72da60

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/cbmc_starter_kit/template-for-ci-workflow/proof_ci.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,18 @@ jobs:
156156
EXTERNAL_SAT_SOLVER: kissat
157157
working-directory: ${{ env.PROOFS_DIR }}
158158
run: ${{ env.RUN_CBMC_PROOFS_COMMAND }}
159+
- name: Check repository visibility
160+
shell: bash
161+
run: |
162+
VIZ="${{ fromJson(toJson(github.event.repository)).visibility }}";
163+
echo "REPO_VISIBILITY=${VIZ}" | tee -a "${GITHUB_ENV}";
159164
- name: Set name for zip artifact with CBMC proof results
160165
id: artifact
161-
if: ${{ env.AWS_CLOUDFRONT_DOMAIN == '' }}
166+
if: ${{ env.REPO_VISIBILITY == 'public' }}
162167
run: |
163168
echo "name=cbmc_proof_results_${{ fromJson(toJson(github.event.repository)).name }}_$(date +%Y_%m_%d_%H_%M_%S)" >> $GITHUB_OUTPUT
164169
- name: Create zip artifact with CBMC proof results
165-
if: ${{ env.AWS_CLOUDFRONT_DOMAIN == '' }}
170+
if: ${{ env.REPO_VISIBILITY == 'public' }}
166171
shell: bash
167172
run: |
168173
FINAL_REPORT_DIR=$PROOFS_DIR/output/latest/html
@@ -171,7 +176,7 @@ jobs:
171176
&& popd \
172177
&& mv $FINAL_REPORT_DIR/${{ steps.artifact.outputs.name }}.zip .
173178
- name: Upload zip artifact of CBMC proof results to GitHub Actions
174-
if: ${{ env.AWS_CLOUDFRONT_DOMAIN == '' }}
179+
if: ${{ env.REPO_VISIBILITY == 'public' }}
175180
uses: actions/upload-artifact@v3
176181
with:
177182
name: ${{ steps.artifact.outputs.name }}

0 commit comments

Comments
 (0)