-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #767 from roboflow/qol/do-not-run-tests-if-branch-…
…not-up-to-date-with-main Do not run tests if branch is not up to date with main
- Loading branch information
Showing
15 changed files
with
118 additions
and
0 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Check if PR is mergeable | ||
|
||
on: | ||
workflow_call: | ||
outputs: | ||
mergeable_state: | ||
description: "Set to 'clean' if branch is mergeable, otherwise set to 'not_clean'" | ||
value: ${{ jobs.is_mergeable.outputs.mergeable_state }} | ||
|
||
jobs: | ||
is_mergeable: | ||
outputs: | ||
mergeable_state: ${{ steps.mergeable_check.outputs.mergeable_state }} | ||
runs-on: | ||
labels: depot-ubuntu-22.04-8 | ||
group: public-depot | ||
timeout-minutes: 15 | ||
steps: | ||
- name: 🛎️ Checkout main | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: ${{ env.FETCH_DEPTH }} | ||
ref: main | ||
- name : Store main sha in context | ||
run: echo "main_sha=$(git rev-parse main)" >> "${GITHUB_ENV}" | ||
- name: Calculate depth | ||
run: echo "FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> "${GITHUB_ENV}" | ||
- name: 🛎️ Checkout branch with all history | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: ${{ env.FETCH_DEPTH }} | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
- name: Check and store mergable state | ||
id: mergeable_check | ||
run: | | ||
echo "Check if main is ancestor of ${{ github.event.pull_request.head.sha }} (branch HEAD)"; | ||
if $(git merge-base --is-ancestor ${{ env.main_sha }} ${{ github.event.pull_request.head.sha }}); then | ||
echo "Branch is mergeable"; | ||
echo "mergeable_state=clean" >> "$GITHUB_OUTPUT"; | ||
else | ||
echo "Branch needs to be updated"; | ||
echo "mergeable_state=not_clean" >> "$GITHUB_OUTPUT"; | ||
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
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
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