Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub Actions output is missing file names and line numbers #1693

Closed
charliermarsh opened this issue Jan 6, 2023 · 10 comments
Closed

GitHub Actions output is missing file names and line numbers #1693

charliermarsh opened this issue Jan 6, 2023 · 10 comments

Comments

@charliermarsh
Copy link
Member

See: pypa/hatch#702 (comment).

Here's an example: https://github.com/pypa/hatch/actions/runs/3853184547/jobs/6565955257.

The action comments appear in the right spot in the "Files changed" tabs, but should the locations also be visible in the logs?

@ofek
Copy link
Contributor

ofek commented Jan 6, 2023

I think it should also be visible in the logs because the errors are from a newly released version of Ruff rather than any files I actually changed

@charliermarsh
Copy link
Member Author

Are you suggesting that the line numbers and such were visible before, but are no longer visible?

@ofek
Copy link
Contributor

ofek commented Jan 6, 2023

Yes definitely but I don't remember how long ago

@charliermarsh
Copy link
Member Author

Thanks, I'll look into it today.

@charliermarsh
Copy link
Member Author

Relevant: golangci/golangci-lint-action#119

@charliermarsh
Copy link
Member Author

I think this is "working as intended" from the perspective of GitHub's workflow commands.

Users can disable workflow commands (so they won't get inline comments, just build logs) with --format text or setting GITHUB_ACTIONS=false when invoking Ruff.

But the other thing we can do is add explicit additional text to the logs, even if it won't be picked up by GitHub, like:

Screen Shot 2023-01-06 at 12 22 00 PM

@ofek
Copy link
Contributor

ofek commented Jan 6, 2023

Yes that would be nice! Do you know why in that example output the first error was showing the file and line numbers and the rest weren't? Was the first error just malformed and was accidentally being printed?

@charliermarsh
Copy link
Member Author

charliermarsh commented Jan 6, 2023

I'm wondering that too. Not sure yet... Debugging it now.

charliermarsh added a commit that referenced this issue Jan 6, 2023
This ensures that if you look at the GitHub Actions _logs_, you see the
entire message, including the location:

![Screen Shot 2023-01-06 at 3 08 06
PM](https://user-images.githubusercontent.com/1309177/211091772-df6f1deb-c741-435c-be2e-6ee22347a073.png)

The downside is that the location gets repeated inline:

![Screen Shot 2023-01-06 at 3 08 30
PM](https://user-images.githubusercontent.com/1309177/211091800-57020736-95fa-4e41-acb3-eb11c848ba7e.png)

See: #1693.
@charliermarsh
Copy link
Member Author

Two fixes here:

  • The GitHub reporting is now opt-in (ruff --format=github .) instead of auto-detecting via the GITHUB_ACTIONS env var.
  • When running with --format=github, we now preserve the location information:

Screen Shot 2023-01-06 at 3 08 06 PM

@ofek
Copy link
Contributor

ofek commented Jan 6, 2023

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants