mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11:09 +00:00
[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 <ben@parity.io>
This commit is contained in:
@@ -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 }}
|
||||
@@ -89,7 +89,16 @@ variables:
|
||||
- /^pre-v[0-9]+\.[0-9]+-[0-9a-f]+$/
|
||||
- web
|
||||
|
||||
#### stage: .pre
|
||||
|
||||
skip-if-draft:
|
||||
image: parity/tools:latest
|
||||
<<: *kubernetes-build
|
||||
stage: .pre
|
||||
only:
|
||||
- /^[0-9]+$/ # Pull requests
|
||||
script:
|
||||
- ./.maintain/gitlab/skip_if_draft.sh
|
||||
|
||||
#### stage: test
|
||||
|
||||
|
||||
Executable
+14
@@ -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
|
||||
Reference in New Issue
Block a user