3131 ${{ github.repository != 'google-github-actions/.github' }}
3232 outputs :
3333 lint-targets : ' ${{ steps.lint-targets.outputs.lint-targets }}'
34- gomod-dirs : ' ${{ steps.lint-targets.outputs.gomod-dirs }}'
35- packagejson-dirs : ' ${{ steps.lint-targets.outputs.packagejson-dirs }}'
34+ ratchet-files : ' ${{ steps.lint-targets.outputs.ratchet-files }}'
3635 steps :
3736 - name : ' Checkout'
3837 uses : ' actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683' # ratchet:actions/checkout@v4
@@ -48,14 +47,15 @@ jobs:
4847 run : |-
4948 set -euo pipefail
5049
51- # match_files determines if the current git repository has any files
52- # matching the given pattern. This has been performance tested
53- # against a shallow checkout of chromium (future changes should be
54- # tested in the same manner).
50+ find_files() {
51+ local filepattern="${1}"
52+ git ls-tree -r --name-only "${REF}" | grep -E "${filepattern}" | sort || true
53+ }
54+
5555 match_files() {
5656 local filepattern="${1}"
5757 matches="$(git ls-tree -r --name-only "${REF}" | grep -m 1 -E "${filepattern}")"
58- code="$? "
58+ code="${?} "
5959 if [[ -n "${matches}" ]]; then
6060 # Ignore exit codes because we found a match.
6161 # Exit code 141 and higher may occur because we exit early.
6868 if match_files '.*(\.dockerfile|Dockerfile)$'; then
6969 TARGETS+=("docker")
7070 fi
71- if match_files '. github/(actions|workflows)/.*\.(yaml|yml)$'; then
71+ if match_files '(action\.(yaml|yml))|(\. github/(actions|workflows)/.*\.(yaml|yml) )$'; then
7272 TARGETS+=("github" "ratchet")
73+ RATCHET_FILES="$(find_files '(action\.(yaml|yml))|(\.github/(actions|workflows)/.*\.(yaml|yml))$' | tr '\n' ' ')"
74+ echo "::debug::Found ratchetable files: ${RATCHET_FILES}"
75+ echo "ratchet-files=${RATCHET_FILES}" >> "${GITHUB_OUTPUT}"
7376 fi
7477 if match_files 'go.mod$'; then
7578 TARGETS+=("go")
@@ -157,7 +160,7 @@ jobs:
157160 ${{ matrix.lint-target == 'ratchet' }}
158161 uses : ' sethvargo/ratchet@main' # ratchet:exclude
159162 with :
160- files : ' ./.github/actions/**/*.yml ./.github/workflows/*.yml '
163+ files : ' ${{ needs.init.outputs.ratchet-files }} '
161164
162165 - name : ' Lint (Shell)'
163166 if : |-
0 commit comments