-
Notifications
You must be signed in to change notification settings - Fork 18
Description
Consider the ruff-action test.yml
, which has a purposefully failing test that generates Annotations using Problem Matchers
Notably, note that the Would reformat
annotations are on #L1
for line 1, and show up both in the Actions menu and in the Pull Request files view (the latter is where it's actually useful)
https://github.com/astral-sh/ruff-action/actions/runs/14531202637/job/40771137207
https://github.com/astral-sh/ruff-action/pull/123/files


Here's the bonkers thing. If you actually try and use astral-sh/ruff-action@v3
in a minimal repo, then the Would reformat
file annotation is attributed to #L0
(???) and only shows up in the Actions menu, but doesn't show up in the Pull Request files menu! Presumably this is because line 0 doesn't actually exist in the file, so it has nowhere to put the annotation in the Pull Request files view.
DavisVaughan/ruff-action-test#1


I have to imagine this is some kind of weird GitHub bug somehow. It should probably either be line 0 in both cases, or line 1 in both cases.
So, IIUC, the formatting problem matcher added in #26 hasn't actually been triggering (I could be wrong here, but I can't get it to trigger)!
Two possible solutions:
-
Maybe you can specify
line
in the problem matcher and force it to line 1, but I'm not sure if you can do that -
Ruff itself gets a change, and a new
ruff format --check --output-format=github
would directly emit github workflow commands. I think in theory you wouldn't even need the problem matcher then, and you could specifyline=1
there.