Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Pull Request title filter to initial release workflow #262

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/entrypoint_preprod_base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ env:
jobs:
# https://github.com/orgs/community/discussions/26671, "can’t pass ENV variables to the reusable workflow"
init:
if: ${{ startsWith(github.event.pull_request.title, 'Release') }}
name: Initialize
runs-on: self-hosted
outputs:
Expand Down Expand Up @@ -57,7 +58,9 @@ jobs:
fi
cat $GITHUB_OUTPUT


code_check:
if: ${{ startsWith(github.event.pull_request.title, 'Release') }}
name: Code compliance check
uses: ./.github/workflows/sub_code_check.yml

Expand Down Expand Up @@ -128,7 +131,7 @@ jobs:
clean_runners:
name: Clean runner
needs: [ init, publish ]
if: always()
if: always() && ${{ startsWith(github.event.pull_request.title, 'Release') }}
# even if this job fails, it won't affect the success/fail status of the whole workflow
continue-on-error: true
strategy:
Expand Down Expand Up @@ -166,11 +169,12 @@ jobs:
HUB_TOKEN=$(curl --silent --header "Content-Type: application/json" --request POST --data "{\"username\": \"${{ secrets.DOCKER_USERNAME }}\", \"password\": \"${{ secrets.DOCKER_PASSWORD }}\"}" https://hub.docker.com/v2/users/login/ | jq -r .token)
curl --fail-with-body --include --request DELETE -H "Accept: application/json" --header "Authorization: JWT $HUB_TOKEN" https://hub.docker.com/v2/repositories/${{ env.INTERMEDIATE_IMAGES_BUILDS_REGISTRY }}/tags/${{ env.IMAGE_TAG }}-${{ needs.init.outputs.IMAGE_VERSION }}-${{ matrix.arch }}/


add_label:
name: Trigger image builds
needs: [ init, clean_registries ]
# running either if publish and clean_registries were a success, or if the image already existed on remote
if: always() && ( needs.clean_registries.result == 'success' || needs.init.outputs.image_exists == 'true' )
if: always() && ${{ startsWith(github.event.pull_request.title, 'Release') }} && ( needs.clean_registries.result == 'success' || needs.init.outputs.image_exists == 'true' )
runs-on: ubuntu-latest
# Cannot use secrets.GITHUB_TOKEN as it is the default "github-actions bot" token, and "An action in a workflow run can’t trigger a new workflow run."
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#about-workflow-events
Expand Down