Closed andybroomfield closed 4 weeks ago
Thanks @andybroomfield I think when a branch is a version number the require should look like this which we need to look into;
composer --working-dir=./html require --with-all-dependencies localgovdrupal/localgov_alert_banner:"1.8.x-dev as 1.7.8"
whereas we currently do this which works fine for feature branches but doesn't for version number branches:
composer --working-dir=./html require --with-all-dependencies localgovdrupal/localgov_alert_banner:"dev-1.8.x as 1.7.8"
So dev-
prefix is only for named/feature branches, not for version numbers which should be like 1.8.x-dev
I wonder if this is because it is seeing the github.ref
as refs/pull/338/merge
so falls into the step Set composer branch reference for non-version branches
which then sets the composer ref as dev-1.8.x
rather than 1.8.x-dev
Maybe tweaking the two steps like this would work:
- name: Set composer branch reference for version branches
if: endsWith(github.ref, '.x') || endsWith(env.GIT_BRANCH, '.x')
run: echo "COMPOSER_REF=${GIT_BRANCH}-dev" >> $GITHUB_ENV
- name: Set composer branch reference for non-version branches
if: endsWith(github.ref, '.x') == false && endsWith(env.GIT_BRANCH, '.x') == false
run: echo "COMPOSER_REF=dev-${GIT_BRANCH}" >> $GITHUB_ENV
cc @stephen-cox for his thoughts on this also
It's now looking like feature branches are no longer able to install https://github.com/localgovdrupal/localgov_alert_banner/actions/runs/10348949039/job/28643317956 This is through a manual run.
Any way to test with #8?
Possibly, you could update that branch to use this shared workflow in a Draft PR:
uses: localgovdrupal/localgov_shared_workflows/.github/workflows/test-module.yml@fix/1.x/6-version-branch-tests-do-not-run
Test it and then revert back before merging
I think this is working now @millnut ! Nice one! See https://github.com/localgovdrupal/localgov_alert_banner/pull/338
See https://github.com/localgovdrupal/localgov_alert_banner/actions/runs/10265473963/job/28406315876?pr=338