Skip to content

Commit 5f35e05

Browse files
committed
feat(linter): add annotation from action pinning errors
Signed-off-by: Emilien Escalle <emilien.escalle@escemi.com>
1 parent d0360be commit 5f35e05

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

.github/workflows/linter.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,17 +173,42 @@ jobs:
173173
}
174174
175175
const files = actionFiles.map((file) => path.relative(process.env.GITHUB_WORKSPACE, file));
176-
177176
const filesOutput = [...new Set(files)].join(" ").trim();
178177
178+
if (filesOutput.length === 0) {
179+
return;
180+
}
181+
179182
core.setOutput("files", filesOutput);
180183
184+
// Add problem matcher for ratchet
185+
// FIXME: should retrieve ratchet file and line. See https://github.com/sethvargo/ratchet/issues/103.
186+
const problemMatcher = {
187+
"problemMatcher": [
188+
{
189+
"owner": "ratchet",
190+
"pattern": [
191+
{ "regexp": "^found (\\d) unpinned refs: \\[([^\\]]+)\\]$", "message": 0 }
192+
]
193+
}
194+
]
195+
};
196+
197+
fs.writeFileSync("ratchet-problem-matcher.json", JSON.stringify(problemMatcher, null, 2));
198+
199+
# FIXME: use actions/github-script, needs: https://github.com/actions/toolkit/pull/2001
200+
- if: ${{ steps.get-files-to-lint.outputs.files }}
201+
run: echo "::add-matcher::ratchet-problem-matcher.json"
202+
181203
- id: ratchet
182204
uses: "docker://ghcr.io/sethvargo/ratchet:0.10.2@sha256:78f70ed0c85830a78bd9eeb265f49aa375d71887e4245aebc5da9c641d76b245" # v0.10.2
183205
if: ${{ steps.get-files-to-lint.outputs.files }}
184206
with:
185207
args: "check ${{ steps.get-files-to-lint.outputs.files }}"
186208

209+
- if: ${{ always() && steps.get-files-to-lint.outputs.files }}
210+
run: echo "::remove-matcher owner=ratchet::"
211+
187212
- if: ${{ failure() && steps.get-files-to-lint.outputs.files }}
188213
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
189214
with:

0 commit comments

Comments
 (0)