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

Could we add a workflow to auto-fix the Lint? #321

Open
abelsiqueira opened this issue Jul 4, 2024 · 4 comments
Open

Could we add a workflow to auto-fix the Lint? #321

abelsiqueira opened this issue Jul 4, 2024 · 4 comments
Labels

Comments

@abelsiqueira
Copy link
Owner

Description

It could be the Lint itself:

Failing run:

  • Run the lint
  • If fails, commit the changes
  • Run lint again
  • If passes, create PR

However, I think there will be a problem because actions can't trigger actions. So this fix would not be tested until someone opens and closes the PR.

Also, it would not work for forks, since it will require write permissions to create the PR.

@suvayu any opinions on the feasibility of this?

Validation and testing

No response

Motivation

No response

Target audience

No response

Can you help?

No response

@suvayu
Copy link
Collaborator

suvayu commented Jul 4, 2024

However, I think there will be a problem because actions can't trigger actions. So this fix would not be tested until someone opens and closes the PR.

Why do you say that? We can just call the reusable test workflow as a follow-up step with needs: lint. Depending on what we want, it the create PR step can be conditional on whether tests passed.

@abelsiqueira
Copy link
Owner Author

I'm thinking of this: https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow

The example that I have is CompatHelper (e.g. https://github.com/TulipaEnergy/TulipaEnergyModel.jl/pull/648/checks). It creates the PR but because it was generated by a workflow with default permissions, it doesn't run the other workflows.

That being said, according to the docs I linked, maybe we just need to use a separate SSH key - and we have one, DOCUMENTER_KEY, that we can reuse.

@suvayu
Copy link
Collaborator

suvayu commented Jul 4, 2024

I see what you mean, my suggestion essentially duplicates the test workflow. Is that a bad thing since the other option requires complicated setup (storing secrets, etc)?

@abelsiqueira
Copy link
Owner Author

Ok, I get what you mean now. It would not future-proof - although a great use of the reusable workflow - because if we have more tests to run, then we can't add it to the Linter.
That being said, the normal approach is to close and re-open the PR to trigger the tests, which might not be an overburden.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

No branches or pull requests

2 participants