From 817d52f482eb05ddc91ea3faa89240b03fe74074 Mon Sep 17 00:00:00 2001 From: Tobias Burgherr Date: Mon, 15 Sep 2025 19:43:02 +0200 Subject: [PATCH 1/2] Check if NO_DOCKER label is used --- .github/workflows/docker.yml | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 58346de..3bcdfac 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -21,6 +21,25 @@ env: IMAGE_NAME: ${{ github.repository }} jobs: + check-label: + runs-on: ubuntu-latest + outputs: + skip: ${{ steps.labelcheck.outputs.skip }} + steps: + - name: Get PR for commit + id: pr + uses: actions-ecosystem/action-get-latest-pr@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + + - name: Check labels + id: labelcheck + run: | + if echo "${{ steps.pr.outputs.labels }}" | grep -q "NO_DOCKER"; then + echo "skip=true" >> $GITHUB_OUTPUT + else + echo "skip=false" >> $GITHUB_OUTPUT + fi build-and-push-image: runs-on: ubuntu-latest # Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. @@ -29,12 +48,8 @@ jobs: packages: write attestations: write id-token: write - pull-requests: read - if: > - !( - github.event_name == 'push' && - contains(steps.pr.outputs.labels, 'NO_DOCKER') - ) + needs: check-label + if: needs.check-label.outputs.skip != 'true' steps: - name: Checkout repository uses: actions/checkout@v4 From 178c20d71dc742abcc22db6d648c6ef74cf65c0c Mon Sep 17 00:00:00 2001 From: Tobias Burgherr Date: Mon, 15 Sep 2025 19:48:32 +0200 Subject: [PATCH 2/2] NEw lavbel test --- .github/workflows/docker.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 3bcdfac..cf518c9 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -27,19 +27,22 @@ jobs: skip: ${{ steps.labelcheck.outputs.skip }} steps: - name: Get PR for commit - id: pr - uses: actions-ecosystem/action-get-latest-pr@v1 + id: get_pr + uses: actions-ecosystem/action-get-merged-pull-request@v1 with: github_token: ${{ secrets.GITHUB_TOKEN }} - name: Check labels id: labelcheck run: | - if echo "${{ steps.pr.outputs.labels }}" | grep -q "NO_DOCKER"; then + LABELS="${{ steps.get_pr.outputs.labels }}" + echo "Labels: $LABELS" + if echo "$LABELS" | grep -q "NO_DOCKER"; then echo "skip=true" >> $GITHUB_OUTPUT else echo "skip=false" >> $GITHUB_OUTPUT fi + build-and-push-image: runs-on: ubuntu-latest # Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.