88 paths :
99 - " elixir-orchestration/**"
1010 - " .github/workflows/elixir-ci.yml"
11+ # No pull_request paths-filter: 'benchee scripts compile' and 'hex audit' are
12+ # REQUIRED status checks, so they must report on every PR (a path-filtered required
13+ # check deadlocks PRs that don't touch its paths). The "Detect relevant changes"
14+ # step in each job gates the heavy work; non-required jobs are gated the same way so
15+ # they don't run on every unrelated PR.
1116 pull_request :
1217 branches : [main, master]
13- paths :
14- - " elixir-orchestration/**"
15- - " .github/workflows/elixir-ci.yml"
1618 workflow_dispatch :
1719
1820permissions :
1921 contents : read
22+ pull-requests : read # change-detector reads the PR's file list
2023
2124env :
2225 MIX_ENV : test
@@ -40,22 +43,46 @@ jobs:
4043 otp : " 27"
4144 steps :
4245 - uses : actions/checkout@9f698171ed81b15d1823a05fc7211befd50c8ae0 # v6.0.3
43- - uses : erlef/setup-beam@e6d7c94229049569db56a7ad5a540c051a010af9 # v1.20.4
46+ - name : Detect relevant changes
47+ id : detect
48+ working-directory : ${{ github.workspace }}
49+ env :
50+ GH_TOKEN : ${{ github.token }}
51+ run : |
52+ set -euo pipefail
53+ PATTERN='^elixir-orchestration/'
54+ if [ "${{ github.event_name }}" = "pull_request" ]; then
55+ FILES=$(gh api "repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" --paginate --jq '.[].filename')
56+ if printf '%s\n' "$FILES" | grep -qE "$PATTERN"; then
57+ echo "relevant=true" >> "$GITHUB_OUTPUT"
58+ else
59+ echo "relevant=false" >> "$GITHUB_OUTPUT"; echo "No elixir-orchestration changes — pass-through (required-check shim)."
60+ fi
61+ else
62+ echo "relevant=true" >> "$GITHUB_OUTPUT"
63+ fi
64+ - if : steps.detect.outputs.relevant == 'true'
65+ uses : erlef/setup-beam@e6d7c94229049569db56a7ad5a540c051a010af9 # v1.20.4
4466 with :
4567 elixir-version : ${{ matrix.elixir }}
4668 otp-version : ${{ matrix.otp }}
47- - uses : actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
69+ - if : steps.detect.outputs.relevant == 'true'
70+ uses : actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
4871 with :
4972 path : |
5073 elixir-orchestration/deps
5174 elixir-orchestration/_build
5275 key : ${{ runner.os }}-mix-${{ matrix.elixir }}-${{ matrix.otp }}-${{ hashFiles('elixir-orchestration/mix.lock') }}
5376 restore-keys : |
5477 ${{ runner.os }}-mix-${{ matrix.elixir }}-${{ matrix.otp }}-
55- - run : mix deps.get
56- - run : mix format --check-formatted
57- - run : mix compile --warnings-as-errors
58- - run : mix test
78+ - if : steps.detect.outputs.relevant == 'true'
79+ run : mix deps.get
80+ - if : steps.detect.outputs.relevant == 'true'
81+ run : mix format --check-formatted
82+ - if : steps.detect.outputs.relevant == 'true'
83+ run : mix compile --warnings-as-errors
84+ - if : steps.detect.outputs.relevant == 'true'
85+ run : mix test
5986
6087 coverage :
6188 # Unit-test coverage only: the federation adapters are exercised by the
@@ -69,19 +96,42 @@ jobs:
6996 working-directory : elixir-orchestration
7097 steps :
7198 - uses : actions/checkout@9f698171ed81b15d1823a05fc7211befd50c8ae0 # v6.0.3
72- - uses : erlef/setup-beam@e6d7c94229049569db56a7ad5a540c051a010af9 # v1.20.4
99+ - name : Detect relevant changes
100+ id : detect
101+ working-directory : ${{ github.workspace }}
102+ env :
103+ GH_TOKEN : ${{ github.token }}
104+ run : |
105+ set -euo pipefail
106+ PATTERN='^elixir-orchestration/'
107+ if [ "${{ github.event_name }}" = "pull_request" ]; then
108+ FILES=$(gh api "repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" --paginate --jq '.[].filename')
109+ if printf '%s\n' "$FILES" | grep -qE "$PATTERN"; then
110+ echo "relevant=true" >> "$GITHUB_OUTPUT"
111+ else
112+ echo "relevant=false" >> "$GITHUB_OUTPUT"; echo "No elixir-orchestration changes — pass-through (required-check shim)."
113+ fi
114+ else
115+ echo "relevant=true" >> "$GITHUB_OUTPUT"
116+ fi
117+ - if : steps.detect.outputs.relevant == 'true'
118+ uses : erlef/setup-beam@e6d7c94229049569db56a7ad5a540c051a010af9 # v1.20.4
73119 with :
74120 elixir-version : " 1.17"
75121 otp-version : " 27"
76- - uses : actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
122+ - if : steps.detect.outputs.relevant == 'true'
123+ uses : actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
77124 with :
78125 path : |
79126 elixir-orchestration/deps
80127 elixir-orchestration/_build
81128 key : ${{ runner.os }}-mix-coverage-${{ hashFiles('elixir-orchestration/mix.lock') }}
82- - run : mix deps.get
83- - run : mix coveralls.json
84- - uses : codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
129+ - if : steps.detect.outputs.relevant == 'true'
130+ run : mix deps.get
131+ - if : steps.detect.outputs.relevant == 'true'
132+ run : mix coveralls.json
133+ - if : steps.detect.outputs.relevant == 'true'
134+ uses : codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
85135 with :
86136 files : elixir-orchestration/cover/excoveralls.json
87137 flags : elixir
@@ -97,18 +147,40 @@ jobs:
97147 working-directory : elixir-orchestration
98148 steps :
99149 - uses : actions/checkout@9f698171ed81b15d1823a05fc7211befd50c8ae0 # v6.0.3
100- - uses : erlef/setup-beam@e6d7c94229049569db56a7ad5a540c051a010af9 # v1.20.4
150+ - name : Detect relevant changes
151+ id : detect
152+ working-directory : ${{ github.workspace }}
153+ env :
154+ GH_TOKEN : ${{ github.token }}
155+ run : |
156+ set -euo pipefail
157+ PATTERN='^elixir-orchestration/'
158+ if [ "${{ github.event_name }}" = "pull_request" ]; then
159+ FILES=$(gh api "repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" --paginate --jq '.[].filename')
160+ if printf '%s\n' "$FILES" | grep -qE "$PATTERN"; then
161+ echo "relevant=true" >> "$GITHUB_OUTPUT"
162+ else
163+ echo "relevant=false" >> "$GITHUB_OUTPUT"; echo "No elixir-orchestration changes — pass-through (required-check shim)."
164+ fi
165+ else
166+ echo "relevant=true" >> "$GITHUB_OUTPUT"
167+ fi
168+ - if : steps.detect.outputs.relevant == 'true'
169+ uses : erlef/setup-beam@e6d7c94229049569db56a7ad5a540c051a010af9 # v1.20.4
101170 with :
102171 elixir-version : " 1.17"
103172 otp-version : " 27"
104- - uses : actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
173+ - if : steps.detect.outputs.relevant == 'true'
174+ uses : actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
105175 with :
106176 path : |
107177 elixir-orchestration/deps
108178 elixir-orchestration/_build
109179 key : ${{ runner.os }}-mix-bench-${{ hashFiles('elixir-orchestration/mix.lock') }}
110- - run : mix deps.get
180+ - if : steps.detect.outputs.relevant == 'true'
181+ run : mix deps.get
111182 - name : Syntax check all bench scripts
183+ if : steps.detect.outputs.relevant == 'true'
112184 run : |
113185 for f in bench/*.exs; do
114186 elixir -e "Code.string_to_quoted!(File.read!(\"$f\"))"
@@ -124,11 +196,32 @@ jobs:
124196 working-directory : elixir-orchestration
125197 steps :
126198 - uses : actions/checkout@9f698171ed81b15d1823a05fc7211befd50c8ae0 # v6.0.3
127-
128- - uses : erlef/setup-beam@e6d7c94229049569db56a7ad5a540c051a010af9 # v1.20.4
199+ - name : Detect relevant changes
200+ id : detect
201+ working-directory : ${{ github.workspace }}
202+ env :
203+ GH_TOKEN : ${{ github.token }}
204+ run : |
205+ set -euo pipefail
206+ PATTERN='^elixir-orchestration/'
207+ if [ "${{ github.event_name }}" = "pull_request" ]; then
208+ FILES=$(gh api "repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files" --paginate --jq '.[].filename')
209+ if printf '%s\n' "$FILES" | grep -qE "$PATTERN"; then
210+ echo "relevant=true" >> "$GITHUB_OUTPUT"
211+ else
212+ echo "relevant=false" >> "$GITHUB_OUTPUT"; echo "No elixir-orchestration changes — pass-through (required-check shim)."
213+ fi
214+ else
215+ echo "relevant=true" >> "$GITHUB_OUTPUT"
216+ fi
217+ - if : steps.detect.outputs.relevant == 'true'
218+ uses : erlef/setup-beam@e6d7c94229049569db56a7ad5a540c051a010af9 # v1.20.4
129219 with :
130220 elixir-version : " 1.17"
131221 otp-version : " 27"
132- - run : mix deps.get
133- - run : mix hex.audit
134- - run : mix deps.unlock --check-unused
222+ - if : steps.detect.outputs.relevant == 'true'
223+ run : mix deps.get
224+ - if : steps.detect.outputs.relevant == 'true'
225+ run : mix hex.audit
226+ - if : steps.detect.outputs.relevant == 'true'
227+ run : mix deps.unlock --check-unused
0 commit comments