From 91757335ac06e38f35ec7a829ac1d36e721a1df3 Mon Sep 17 00:00:00 2001 From: Julien Neuhart Date: Wed, 14 May 2025 09:37:42 +0200 Subject: [PATCH] ci: make it work for forks too --- .github/actions/build-test-push/action.yml | 4 +++- .github/workflows/continuous-integration.yml | 19 ++++++++++++++++++- .github/workflows/pull-request-cleanup.yml | 1 + 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/.github/actions/build-test-push/action.yml b/.github/actions/build-test-push/action.yml index 78a017d6..767bb76b 100644 --- a/.github/actions/build-test-push/action.yml +++ b/.github/actions/build-test-push/action.yml @@ -48,6 +48,7 @@ runs: uses: actions/checkout@v4 - name: Log in to Docker Hub + if: inputs.docker_hub_username != '' uses: docker/login-action@v3 with: username: ${{ inputs.docker_hub_username }} @@ -64,7 +65,7 @@ runs: --dry-run "${{ inputs.dry_run }}" - name: Run integration tests - if: ${{ inputs.skip_integrations_tests != 'true' }} + if: inputs.skip_integrations_tests != 'true' shell: bash run: | .github/actions/build-test-push/test.sh \ @@ -74,6 +75,7 @@ runs: --dry-run "${{ inputs.dry_run }}" - name: Push + if: inputs.docker_hub_username != '' shell: bash run: | .github/actions/build-test-push/push.sh \ diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index abccd254..11e515fa 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -161,12 +161,29 @@ jobs: platform: linux/arm/v7 alternate_repository: snapshot - merge_clean_snapshot_tags: + merge_clean_snapshot_guard: needs: - snapshot_amd64 - snapshot_386 - snapshot_arm64 - snapshot_arm_v7 + name: Secrets access check + runs-on: ubuntu-latest + outputs: + continue: ${{ steps.check.outputs.continue }} + steps: + - name: Check + id: check + run: | + if [ -n "${{ secrets.DOCKERHUB_USERNAME }}" ]; then + echo "continue=true" >> "$GITHUB_OUTPUT" + else + echo "continue=false" >> "$GITHUB_OUTPUT" + fi + + merge_clean_snapshot_tags: + if: needs.merge_clean_snapshot_guard.outputs.continue == 'true' + needs: merge_clean_snapshot_guard name: Merge and clean snapshot tags runs-on: ubuntu-latest steps: diff --git a/.github/workflows/pull-request-cleanup.yml b/.github/workflows/pull-request-cleanup.yml index dad5e1c3..4f3a9de6 100644 --- a/.github/workflows/pull-request-cleanup.yml +++ b/.github/workflows/pull-request-cleanup.yml @@ -11,6 +11,7 @@ jobs: cleanup: name: Cleanup Docker images runs-on: ubuntu-latest + continue-on-error: true steps: - name: Check out code uses: actions/checkout@v4