-
Notifications
You must be signed in to change notification settings - Fork 159
33 lines (31 loc) · 1012 Bytes
/
skip-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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