-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try to use a composite action to reduce duplication
- Loading branch information
Showing
2 changed files
with
43 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: 'Check submodule reference' | ||
description: 'Check that submodule references a commit in a submodule repository's branch' | ||
|
||
inputs: | ||
submodule_path: | ||
description: 'directory with the submodule' | ||
required: true | ||
branch: | ||
description: 'branch in the submodule repository' | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
|
||
steps: | ||
- name: Check ${{ inputs.submodule_path }} submodule reference | ||
shell: bash -euxo pipefail {0} | ||
run: | | ||
cd ${{ inputs.submodule_path }} | ||
git fetch origin "refs/heads/${{ inputs.branch }}:refs/heads/origin/${{ inputs.branch }}" | ||
RC=$(git merge-base --is-ancestor origin/${{ inputs.branch }} HEAD; echo $?) | ||
if [ "$RC" != "0" ]; then | ||
echo "${{ inputs.submodule_path }} submodule is not an ancestor of the ${{ inputs.branch }} branch. Please rebase it" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters