-
Notifications
You must be signed in to change notification settings - Fork 469
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into cross-compile
- Loading branch information
Showing
6 changed files
with
113 additions
and
48 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 |
---|---|---|
@@ -1,21 +1,48 @@ | ||
name: Submodule Pin Check | ||
name: Merge Checks | ||
|
||
on: | ||
pull_request: | ||
pull_request_target: | ||
branches: [ master ] | ||
types: [synchronize, opened, reopened] | ||
|
||
permissions: | ||
statuses: write | ||
|
||
jobs: | ||
submodule-pin-check: | ||
name: Submodule Pin Check | ||
name: Check Submodule Pin | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
submodules: recursive | ||
submodules: true | ||
|
||
- name: Check all submodules are ancestors of origin/HEAD or configured branch | ||
run: ${{ github.workspace }}/.github/workflows/submodule-pin-check.sh | ||
run: | | ||
status_state="pending" | ||
if ${{ github.workspace }}/.github/workflows/submodule-pin-check.sh; then | ||
status_state="success" | ||
else | ||
resp="$(curl -sSL --fail-with-body \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
"https://api.github.com/repos/$GITHUB_REPOSITORY/commits/${{ github.event.pull_request.head.sha }}/statuses")" | ||
if ! jq -e '.[] | select(.context == "Submodule Pin Check")' > /dev/null <<< "$resp"; then | ||
# Submodule pin check is failling and no status exists | ||
# Keep it without a status to keep the green checkmark appearing | ||
# Otherwise, the commit and PR's CI will appear to be indefinitely pending | ||
# Merging will still be blocked until the required status appears | ||
exit 0 | ||
fi | ||
fi | ||
curl -sSL --fail-with-body \ | ||
-X POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
"https://api.github.com/repos/$GITHUB_REPOSITORY/statuses/${{ github.event.pull_request.head.sha }}" \ | ||
-d '{"context":"Submodule Pin Check","state":"'"$status_state"'"}' |
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
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
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
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
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