Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Remove labeled triggers for skip:ci #3122

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
tags:
- '[0-9][0-9].0[39].*'
pull_request:
types: [labeled, unlabeled, opened, synchronize, reopened]
types: [opened, synchronize, reopened]
merge_group:

concurrency:
Expand Down Expand Up @@ -77,7 +77,8 @@ jobs:
lint:
if: |
!(
contains(github.event.pull_request.labels.*.name, 'skip:ci')
contains(toJSON(github.event.commits.*.msg), 'skip:ci')
|| contains(github.event.pull_request.labels.*.name, 'skip:ci')
|| needs.optimize-ci.outputs.skip == 'true'
)
&& !contains(fromJSON('["flow:merge-queue", "flow:hotfix"]'), github.event.label.name)
Expand Down Expand Up @@ -182,7 +183,8 @@ jobs:
typecheck:
if: |
!(
contains(github.event.pull_request.labels.*.name, 'skip:ci')
contains(toJSON(github.event.commits.*.msg), 'skip:ci')
|| contains(github.event.pull_request.labels.*.name, 'skip:ci')
|| needs.optimize-ci.outputs.skip == 'true'
)
&& !contains(fromJSON('["flow:merge-queue", "flow:hotfix"]'), github.event.label.name)
Expand Down Expand Up @@ -254,7 +256,8 @@ jobs:
test:
if: |
!(
contains(github.event.pull_request.labels.*.name, 'skip:ci')
contains(toJSON(github.event.commits.*.msg), 'skip:ci')
|| contains(github.event.pull_request.labels.*.name, 'skip:ci')
|| needs.optimize-ci.outputs.skip == 'true'
)
&& !contains(fromJSON('["flow:merge-queue", "flow:hotfix"]'), github.event.label.name)
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/skip-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: skip-ci

on:
pull_request:
types: [labeled, unlabeled]

jobs:
skip_ci:
if: contains(github.event.pull_request.labels.*.name, 'skip:ci')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.OCTODOG }}
- name: Skip CI
if: github.event.action == 'labeled'
run:
git config --global user.email "[email protected]"
git config --global user.name "octodog"
git commit --allow-empty -m "skip:ci"
git push
- name: Revoke skip:ci
if: github.event.action == 'unlabeled'
run:
git config --global user.email "[email protected]"
git config --global user.name "octodog"
previous_commit_message=$(git log -n 1 --pretty=format:%s --skip 1)
if [[ "$previous_commit_message" == "skip:ci" ]]; then
git log -n 1 --pretty=format:%H --skip 1 | xargs git revert --no-edit
git push
fi
Loading