Skip to content

Commit

Permalink
ci: Remove labeled triggers for skip:ci (#3122) (#3264)
Browse files Browse the repository at this point in the history
Co-authored-by: Sion Kang <[email protected]>
Co-authored-by: Copilot <[email protected]>
  • Loading branch information
3 people authored Dec 17, 2024
1 parent 423b1a3 commit 778ea71
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 4 deletions.
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

0 comments on commit 778ea71

Please sign in to comment.