From c0ffb8c509eebe914efc49520a4c1567e3bff9ea Mon Sep 17 00:00:00 2001 From: dlaw4608 Date: Tue, 23 Jul 2024 14:16:37 +0100 Subject: [PATCH] Fixed line-breaks, included concurrency, and added job to remove labels once the workflow has ran --- .github/workflows/build-images-base.yaml | 3 ++- .github/workflows/build-images-pr.yaml | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-images-base.yaml b/.github/workflows/build-images-base.yaml index a54aef142..e9d65d961 100644 --- a/.github/workflows/build-images-base.yaml +++ b/.github/workflows/build-images-base.yaml @@ -207,4 +207,5 @@ jobs: username: ${{ secrets.IMG_REGISTRY_USERNAME }} password: ${{ secrets.IMG_REGISTRY_TOKEN }} - name: Print Image URL - run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}" \ No newline at end of file + run: echo "Image pushed to ${{ steps.push-to-quay.outputs.registry-paths }}" + \ No newline at end of file diff --git a/.github/workflows/build-images-pr.yaml b/.github/workflows/build-images-pr.yaml index 807a465f9..070788301 100644 --- a/.github/workflows/build-images-pr.yaml +++ b/.github/workflows/build-images-pr.yaml @@ -4,12 +4,26 @@ on: pull_request_target: types: [labeled, opened, synchronize, reopened] +concurrency: + group: pr-conditional-build-${{ github.event.pull_request.number }} + cancel-in-progress: true + jobs: workflow-build: - if: ${{ github.event_name == 'pull_request_target' && contains(github.event.pull_request.labels.*.name, 'forked_image_approved') }} + if: ${{ contains(github.event.pull_request.labels.*.name, 'forked_image_approved') }} name: Calls build-images-base workflow uses: ./.github/workflows/build-images-base.yaml secrets: inherit with: kuadrantOperatorVersion: ${{ github.event.pull_request.user.login }}-${{ github.event.pull_request.number }} - kuadrantOperatorTag: ${{ github.event.pull_request.user.login }}-${{ github.event.pull_request.number }} \ No newline at end of file + kuadrantOperatorTag: ${{ github.event.pull_request.user.login }}-${{ github.event.pull_request.number }} + + remove-label: + runs-on: ubuntu-latest + needs: workflow-build + steps: + - name: Remove forked_image_approved label + - uses: actions-ecosystem/action-remove-labels@v1 + with: + labels: forked_image_approved + repo-token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file