Skip to content

Commit

Permalink
Skip several if checks and centralize checks in one step
Browse files Browse the repository at this point in the history
  • Loading branch information
spaceo committed Jun 3, 2024
1 parent 4a3d147 commit 75cbf71
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/create-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ jobs:
echo "BUILD_URL_IS_ACCEPTED=$BUILD_URL_IS_ACCEPTED" >> $GITHUB_ENV
if: ${{ github.event.action == 'create_pr' && github.event.client_payload.branch && github.event.client_payload.build_url && github.event.client_payload.dependency_package }}

- name: Stop workflow if any variables are missing
run: |
echo "::error::Some variable is missing. Have to stop..."
exit 1
if: ${{ !env.PR_BRANCH || !env.BUILD_URL && !env.PACKAGE || !env.GIT_USER_NAME || !env.GIT_USER_EMAIL || !vars.ACCEPTED_BUILD_URL_PREFIXES }}

- name: Stop workflow if build url is not valid
run: |
echo "::error::The build URL is not valid. Should match one of the accepted prefixes."
Expand All @@ -47,7 +53,6 @@ jobs:
uses: GuillaumeFalourd/branch-exists@v1
with:
branch: ${{ env.PR_BRANCH }}
if: ${{ env.PR_BRANCH }}

- name: Stop workflow if branch already exists
run: |
Expand All @@ -65,7 +70,6 @@ jobs:
composer remove ${{ env.PACKAGE }} \
&& composer require ${{ env.PACKAGE }}
attempt_limit: 200
if: ${{ env.BUILD_URL && env.PACKAGE}}

- name: Create branch and PR
id: create_pr
Expand Down

0 comments on commit 75cbf71

Please sign in to comment.