ci: skip CI for draft and WIP PRs

Let only the init stage run so that we have a link on PRs to the CI and
can trigger it manually if desired. PR template updated with this info.
Also use yaml anchors for rules to reduce duplication.
This commit is contained in:
Jakub Rusz 2022-02-10 15:05:31 +01:00 committed by Ondřej Budai
parent ae07093404
commit ba4f49078a
3 changed files with 51 additions and 38 deletions

View file

@ -23,4 +23,14 @@ test/README.md and add these additional items:
- [ ] QE has approved reproducer/new tests and
- [ ] Subsequent commits provide bug fixes without modifying the reproducer; CI reports PASS and
- [ ] QE approves this PR; RHBZ status is set to `MODIFIED + Verified=Tested`
Information regarding our GitLab pipeline (Schutzbot):
CI will not be ran automatically if WIP label is applied or the PR is in DRAFT state, instead only
a link will be provided to the pipeline which can then be triggered manually if desired. To run the
CI automatically either switch the PR to ready or apply WIP+test label.
Outside contributors need manual approval from one of the osbuild-composer maintainers.
Schutzbot will only be triggered if all Tests jobs in GitHub workflow succeed.
-->

View file

@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
env:
SCHUTZBOT_SSH_KEY: ${{ secrets.SCHUTZBOT_SSH_KEY }}
SKIP_CI: ${{ github.event.pull_request.draft == true || contains(github.event.pull_request.labels.*.name, 'WIP') }}
SKIP_CI: ${{ (github.event.pull_request.draft == true || contains(github.event.pull_request.labels.*.name, 'WIP')) && !contains(github.event.pull_request.labels.*.name, 'WIP+test') }}
steps:
- name: Report status
uses: haya14busa/action-workflow_run-status@v1
@ -59,5 +59,5 @@ jobs:
touch ~/.ssh/known_hosts
ssh-keyscan -t rsa gitlab.com >> ~/.ssh/known_hosts
git remote add ci git@gitlab.com:osbuild/ci/osbuild-composer.git
[[ "${SKIP_CI}" == true ]] && PUSH_OPTION="-o ci.skip" || PUSH_OPTION=""
[[ "${SKIP_CI}" == true ]] && PUSH_OPTION='-o ci.variable="SKIP_CI=true"' || PUSH_OPTION=""
git push -f ${PUSH_OPTION} ci