From b13f9b1a6fb3031914374ae2b806ef7fd7999b9d Mon Sep 17 00:00:00 2001 From: Van Nguyen Date: Mon, 19 Oct 2026 23:46:53 +0700 Subject: [PATCH] ci: skip the stack jobs on pull requests that change only docs --- .github/workflows/ci.yml | 21 +++++++++++++++++++++ .repokeeper.yml | 6 ++++++ .repokeeper/lock.json | 15 ++++++++++++++- 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 13ee99d..5345509 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,9 +15,30 @@ jobs: commits: uses: vannt-dev/repokeeper/.github/workflows/commitlint.yml@v0 ruby: + needs: changes + if: ${{ !cancelled() && needs.changes.outputs.code != 'false' }} uses: vannt-dev/repokeeper/.github/workflows/stack-ruby.yml@v0 with: ruby-versions: '["3.3","3.4"]' os: '["ubuntu-latest"]' install-command: bundle install commands: '["bundle exec rake test"]' + changes: + runs-on: ubuntu-latest + permissions: + pull-requests: read + outputs: + code: ${{ steps.files.outputs.code }} + steps: + - id: files + env: + GH_TOKEN: ${{ github.token }} + EVENT: ${{ github.event_name }} + PR: ${{ github.event.pull_request.number }} + run: | + code=true + if [ "$EVENT" = pull_request ] && files=$(gh api --paginate "repos/$GITHUB_REPOSITORY/pulls/$PR/files" --jq '.[].filename'); then + printf '%s\n' "$files" + if [ -n "$files" ] && ! printf '%s\n' "$files" | grep -Evq '^([^/]*\.md|docs/.*|LICENSE)$'; then code=false; fi + fi + echo "code=$code" >> "$GITHUB_OUTPUT" diff --git a/.repokeeper.yml b/.repokeeper.yml index 39fcfb2..2bda7cf 100644 --- a/.repokeeper.yml +++ b/.repokeeper.yml @@ -21,3 +21,9 @@ modules: - "@vannt-dev" owned: [] stack_options: {} +github: + ci: + skip_when_only: + - "*.md" + - "docs/**" + - LICENSE diff --git a/.repokeeper/lock.json b/.repokeeper/lock.json index 781e4be..ba89e70 100644 --- a/.repokeeper/lock.json +++ b/.repokeeper/lock.json @@ -171,6 +171,19 @@ ] } }, + { + "id": "yaml:.github/workflows/ci.yml#[\"jobs\",\"changes\"]", + "module": "ci", + "hash": "2466a89fb7d82be9933737b9edc251479ccc130f0750365b670609117bc378ef", + "target": { + "kind": "yaml", + "path": ".github/workflows/ci.yml", + "keyPath": [ + "jobs", + "changes" + ] + } + }, { "id": "yaml:.github/workflows/ci.yml#[\"jobs\",\"commits\"]", "module": "ci", @@ -187,7 +200,7 @@ { "id": "yaml:.github/workflows/ci.yml#[\"jobs\",\"ruby\"]", "module": "ci", - "hash": "268bde899b04eaa56b5fd1bbd4cbfda45d8cf7a01597aa75af266fe439c0d183", + "hash": "99368fc57c2a2626d6a4adcebeb30cf6dd5fff88830438c96f5f0cfa820cff93", "target": { "kind": "yaml", "path": ".github/workflows/ci.yml",