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

add a way to retrieve the output #78

Open
nicola-lunghi opened this issue Feb 7, 2025 · 6 comments
Open

add a way to retrieve the output #78

nicola-lunghi opened this issue Feb 7, 2025 · 6 comments

Comments

@nicola-lunghi
Copy link

Hi I need to save the output of the ruff check in a file.
Is it possible?

also how can I not run anything but just install the ruff command for later use? I need to use it in a script

@eifinger
Copy link
Collaborator

eifinger commented Feb 7, 2025

Please see this comment for saving to a file: #28 (comment)

@eifinger
Copy link
Collaborator

eifinger commented Feb 7, 2025

also how can I not run anything but just install the ruff command for later use? I need to use it in a script

Using it like this will invoke ruff to only print the version.

- uses: astral-sh/ruff-action@v3
  with:
    args: "--version"

I will maybe add a feature that you can set args to an empty string so ruff is not invoked at all, e.g. args: ""

@nicola-lunghi
Copy link
Author

Thanks!!!

@nicola-lunghi
Copy link
Author

one thing is not clear how can I get the output in the pr as annotations?

@eifinger
Copy link
Collaborator

one thing is not clear how can I get the output in the pr as annotations?

Have you followed the issue I linked but you still don't see annotations?

@nicola-lunghi
Copy link
Author

Hi I've changed my action to:

  ruff-linter:
    runs-on: [self-hosted, Ubuntu-22.04]
    permissions:
      contents: read
      pull-requests: write
    steps:
      # need to go first as it cleans the directory
      - uses: actions/checkout@v4
        with:
          clean: true
      - uses: actions-ext/astral-sh-ruff-action@v3
        with:
          version: ${{ env.RUFF_VERSION }}

  ruff-format:
    runs-on: [self-hosted, Ubuntu-22.04]
    permissions:
      contents: read
      pull-requests: write
    steps:
      # need to go first as it cleans the directory
      - uses: actions/checkout@v4
        with:
          clean: true
      - uses: actions-ext/astral-sh-ruff-action@v3
        with:
          version: ${{ env.RUFF_VERSION }}
          args: "format --diff"

Now I get the annotations.

questions:

  1. its possible to get the annotations on the pr page as well?
  2. how to get annotation for the ruff format check?

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