Skip to content

Commit

Permalink
[TASK] Use simplier and working checkout ref determination
Browse files Browse the repository at this point in the history
With the introduction of non-main branch scheduled workflow
execution a adjusted checkout part in the `ci.yml` workflow
file has been added to allow to define which branch should
be checked out.

That breaks pipeline execution for pull-requests opened from
repository forks.

This change replaces the old detection with a more simplified
implementation, only setting the custom ref in case of github
workflow_dispatch event execution using `''` as fallback which
allows custom branch selection for workflow dispatching while
keeping default repostiory and branch checkout intact.

Releases: main, 8, 7
  • Loading branch information
sbuerk committed Nov 11, 2024
1 parent 2df1e91 commit 2419797
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,10 @@ jobs:
php: [ '8.1' , '8.2', '8.3', '8.4']
steps:

- name: Extract branch name
shell: bash
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
id: extract_branch

- name: Checkout ${{ steps.extract_branch.outputs.branch }}
- name: Checkout ${{ github.event_name == 'workflow_dispatch' && github.head_ref || '' }}
uses: actions/checkout@v4
with:
ref: ${{ steps.extract_branch.outputs.branch }}
ref: ${{ github.event_name == 'workflow_dispatch' && github.head_ref || '' }}

- name: Composer install
run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s composerUpdate
Expand Down

0 comments on commit 2419797

Please sign in to comment.