Validating submodules with their corresponding branch
This issue comes after some discussions present at the following PR
https://github.com/rest-for-physics/axionlib/pull/56#issuecomment-1517527380
I think a way around to solve this problem could be having a script that identifies if the present branch associtated to the PR that is being validated exists in the framework and returns master if not.
Something like:
echo "branchAtRepositoryExists.sh framework ${{ env.BRANCH_NAME }}"
Thus, in the submodule framework validation frameworkValidation.yml we would do something like:
echo "branchAtRepositoryExists.sh framework ${{ env.BRANCH_NAME }}" >> $VALIDATION_BRANCH
uses: rest-for-physics/framework/.github/workflows/validation.yml@$VALIDATION_BRANCH
Then we would change the following lines at the framework/validation.yml as follows:
https://github.com/rest-for-physics/framework/blob/babeff3be96b7e433ebcf42e4c55b4ae82530275/.github/workflows/validation.yml#L656
echo "branchAtRepositoryExists.sh axionlib ${{ env.BRANCH_NAME }}" >> $VALIDATION_BRANCH
uses: rest-for-physics/axionlib/.github/workflows/validation.yml@$VALIDATION_BRANCH
Then, as soon as we create a branch at the framework with the same name as the branch associated to the submodule PR, the submodule PR will trigger the pipelines at framework and submodules that have the same name as the PR, and if it does not exist it will use master.
EDIT: Probably the script needs to receive the name of the repository. Thus two arguments would be necessary:
branchAtRepositoryExists.sh framework ${{ env.BRANCH_NAME }}
echo "branchAtRepositoryExists.sh framework ${{ env.BRANCH_NAME }}" >> $VALIDATION_BRANCH uses: rest-for-physics/framework/.github/workflows/validation.yml@$VALIDATION_BRANCH
It seems that the solution you propose is not supported by github actions, we can try some work around to trigger an action that triggers the workflow run from the appropiate branch, but seems rather complicated...