From bb318f7e502094a3e790b4b3afe3103b5c78dae8 Mon Sep 17 00:00:00 2001 From: Sion Kang Date: Wed, 20 Nov 2024 13:52:48 +0900 Subject: [PATCH 1/3] ci: Remove labeled triggers for skip:ci --- .github/workflows/ci.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 48dbebba3f..2c79f14f50 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: @@ -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) @@ -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) @@ -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) From acacb096533cd7409c07b5746b5a14a7ecc9f4ce Mon Sep 17 00:00:00 2001 From: Sion Kang Date: Wed, 20 Nov 2024 13:53:32 +0900 Subject: [PATCH 2/3] ci: Workflow for using the skip:ci label in place of the removed labeled trigger --- .github/workflows/skip-ci.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/skip-ci.yml diff --git a/.github/workflows/skip-ci.yml b/.github/workflows/skip-ci.yml new file mode 100644 index 0000000000..365d492939 --- /dev/null +++ b/.github/workflows/skip-ci.yml @@ -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 "mu001@lablup.com" + git config --global user.name "octodog" + git commit --allow-empty -m "skip:ci" + git push + - name: Revok skip:ci + if: github.event.action == 'unlabeled' + run: + git config --global user.email "mu001@lablup.com" + 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 From 7d7cd42a3be174646a291229bfadf5c7316dff44 Mon Sep 17 00:00:00 2001 From: Sion Kang Date: Wed, 20 Nov 2024 13:57:28 +0900 Subject: [PATCH 3/3] Update .github/workflows/skip-ci.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/skip-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/skip-ci.yml b/.github/workflows/skip-ci.yml index 365d492939..2fb491570e 100644 --- a/.github/workflows/skip-ci.yml +++ b/.github/workflows/skip-ci.yml @@ -21,7 +21,7 @@ jobs: git config --global user.name "octodog" git commit --allow-empty -m "skip:ci" git push - - name: Revok skip:ci + - name: Revoke skip:ci if: github.event.action == 'unlabeled' run: git config --global user.email "mu001@lablup.com"