From 763e2f5babb2898c7468509ad56bd10aeabd7069 Mon Sep 17 00:00:00 2001 From: hedger Date: Mon, 25 Mar 2024 10:51:09 +0400 Subject: [PATCH] github: additional pre-upload checks for doxygen workflow (#3526) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: あく --- .github/workflows/docs.yml | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 690bcbe19..1fa025085 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -11,9 +11,26 @@ env: DEFAULT_TARGET: f7 jobs: - doxygen: - if: ${{ !github.event.pull_request.head.repo.fork }} + check-secret: + if: ${{ github.event.pull_request.head.repo.fork == false }} runs-on: ubuntu-latest + outputs: + s3-valid-config: ${{ steps.check.outputs.s3-valid-config }} + + steps: + - name: 'Check if S3 key exists' + id: check + run: | + if [[ -z "${{ secrets.FW_DOCS_AWS_ACCESS_KEY }}" || -z "${{ secrets.FW_DOCS_AWS_SECRET_KEY }}" || -z "${{ secrets.FW_DOCS_AWS_BUCKET }}" ]]; then + echo "s3-valid-config=false" >> $GITHUB_OUTPUT; + else + echo "s3-valid-config=true" >> $GITHUB_OUTPUT; + fi + + doxygen: + if: ${{ github.event.pull_request.head.repo.fork == false }} + runs-on: ubuntu-latest + needs: check-secret steps: - name: 'Wipe workspace' run: find ./ -mount -maxdepth 1 -exec rm -rf {} \; @@ -48,7 +65,7 @@ jobs: doxyfile-path: './doxygen/Doxyfile-awesome.cfg' - name: 'Upload documentation' - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/dev' }} + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/dev' && needs.check-secret.outputs.s3-valid-config == 'true' }} uses: jakejarvis/s3-sync-action@v0.5.1 env: AWS_S3_BUCKET: "${{ secrets.FW_DOCS_AWS_BUCKET }}" @@ -59,4 +76,3 @@ jobs: DEST_DIR: "${{steps.names.outputs.branch_name}}" with: args: "--delete" -