This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CI] Add check for draft PRs (#5800)
* Add check for draft PRs * Add necessary gitlab-ci boilerplate * fix github API url (oops!) * Add github action to retrigger pipeline * fix workflow trigger * rename trigger job Co-authored-by: Benjamin Kampmann <[email protected]>
- Loading branch information
Showing
3 changed files
with
43 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Trigger pipeline for review | ||
|
||
on: | ||
pull_request: | ||
types: [ready_for_review] | ||
|
||
jobs: | ||
trigger: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Trigger pipeline | ||
run: | | ||
curl -X POST \ | ||
-F token="$TOKEN" \ | ||
-F ref="$REF" \ | ||
https://gitlab.parity.io/api/v4/projects/145/trigger/pipeline | ||
env: | ||
REF: ${{ github.event.number }} | ||
TOKEN: ${{ secrets.GITLAB_TRIGGER_TOKEN }} |
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,14 @@ | ||
#!/bin/sh | ||
url="https://api.github.com/repos/paritytech/substrate/pulls/${CI_COMMIT_REF_NAME}" | ||
echo "[+] API URL: $url" | ||
|
||
draft_state=$(curl "$url" | jq -r .draft) | ||
echo "[+] Draft state: $draft_state" | ||
|
||
if [ "$draft_state" = 'true' ]; then | ||
echo "[!] PR is currently a draft, stopping pipeline" | ||
exit 1 | ||
else | ||
echo "[+] PR is not a draft. Proceeding with CI pipeline" | ||
exit 0 | ||
fi |