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

Apply pr2957 to mega-linter-runner/.../mega-linter.yml #3033

Closed
wants to merge 3 commits into from

Conversation

rasa
Copy link
Contributor

@rasa rasa commented Oct 21, 2023

Per #2957 (comment) .

This also adds

&& ! contains(github.event.head_commit.message, 'skip fix')

to all the variants. This line was in some of the mega-linter.yml variants, but not all of them, and the one I started from didn't have it, so I missed it.

See
5f5959d#diff-2a390738250fd23bc48f50e25700e0b2f06b62072aef23258772b1897a9b431b

My apologies for not catching this sooner.

@rasa rasa temporarily deployed to dev October 21, 2023 18:08 — with GitHub Actions Inactive
@rasa rasa temporarily deployed to dev October 21, 2023 18:08 — with GitHub Actions Inactive
@echoix
Copy link
Collaborator

echoix commented Oct 21, 2023

From what I recall, the skip fix wasn't a recommended or documented feature of mega-linter. It was an old quick and dirty way @nvuillam used alone when he wanted to not have MegaLinter run (and fail) on his commits. It isn't something we would have for all users, it was his customization.

Edit: I really looked and I didn't see much usage in here, but it was publicly written in the changelog and was in the template generator. So, it was in the documentation, but not really documented.

So... yah, it would be breaking to remove it, but it is really only a GitHub Actions feature that can be customized, not really MegaLinter itself.

@echoix
Copy link
Collaborator

echoix commented Oct 21, 2023

I see that this PR would cause a couple conflicts to #3032 if it was merged before, and vice-versa.
Since #3032 is like a complete refactor, do you think it would be best to just make the missing suggestions as comments in that PR so that the commits would still be attributed to you? Either of you would have big merge conflicts to solve.

Comment on lines +128 to +129
) &&
!contains(github.event.head_commit.message, 'skip fix')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

@echoix echoix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll finish comparing later, have to go!

Comment on lines +128 to +130
) &&
!contains(github.event.head_commit.message, 'skip fix')

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +123 to +124
) &&
!contains(github.event.head_commit.message, 'skip fix')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rasa please propose a change for this in #3032 and I will accept.

Copy link
Contributor Author

@rasa rasa Oct 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer the || solution, but it's more important that we apply this the same logic across all five (?) instances of mega-linter.yml.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... but it's more important that we apply this logic across all five (?) instances of mega-linter.yml.

Seems weird like that. We have one that is our own for dogfooding (the python@beta), another one for the second project (the node mega-linter-runner) again for dogfooding, then there is the one that is for the template for users, and all the duplicatas built into the documentation... I expect that these update from their sources when running ./build.sh, except if I'm wrong (and we should fix it).

Comment on lines +6 to +7
# Trigger mega-linter at every push. Action will also be visible from Pull
# Requests to main
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -41,16 +41,17 @@ jobs:
runs-on: ubuntu-latest

# Give the default GITHUB_TOKEN write permission to commit and push, comment
# issues, and post new Pull Requests; remove the ones you do not need
# issues & post new PR; remove the ones you do not need
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +51 to +54

# Git Checkout
- name: Checkout Code
uses: actions/checkout@v3
uses: actions/checkout@v4
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@andrewvaughan andrewvaughan Oct 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@echoix one thing to consider with an upgrade to checkout@v4 is it may break workflows for people who use local linting. I'm thinking about tools like https://github.com/nektos/act - they're falling pretty far behind in keeping up with GitHub on server images. @catthehacker is the user that was maintaining those and they have left GitHub. It is possible that an upgrade to actions/checkout@v4, which, if I recall correctly upgrades the node version required, could break MegaLinter's ability to run locally via act.

It's something we need to earmark for a test (and I have with the change I proposed) prior to merging this into MegaLinter's next release.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that the most important use case isn't with act, and thus, it way more important to not use a node version that is EOL since Sept 11, 2023 (node 16 used in actions/checkout@v3). Running locally with act, even if I have done it a couple of times in the past (when doing big changes in the docker building actions and multiplatform builds, iterating on GitHub was way too long), remains more of a hack than a supported (by us) use-case. Having an up to date runner image for act seems like the way to solve your interrogation.

I don't understand the meaning of your last sentence, especially "earmark for a test", and what do you expect before a next release (that should be due soon IMO, maybe wait a little after we settled and merged the big template changes and other link changes PRs).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have pretty up-to-date nodejs on images.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should have pretty up-to-date nodejs on images.

I wasn't able to run checkout@v4 on the latest images as Node 20 wasn't available, IIRC.

uses: <%= GITHUB_ACTION_NAME %>@<%= GITHUB_ACTION_VERSION %>

id: ml

# All available variables are described in documentation
# https://megalinter.io/latest/config-file/
# https://megalinter.io/configuration/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original would be the correct link, #2986

@andrewvaughan
Copy link
Contributor

I see that this PR would cause a couple conflicts to #3032 if it was merged before, and vice-versa. Since #3032 is like a complete refactor, do you think it would be best to just make the missing suggestions as comments in that PR so that the commits would still be attributed to you? Either of you would have big merge conflicts to solve.

I just caught up on this thread - @rasa I think we could definitely get your changes incorporated. #3032 is primarily a formatting change, so if you make some proposed changes there, I can pretty easily accept them and ensure your credit is maintained. Let me know if you have any questions or concerns.

@rasa
Copy link
Contributor Author

rasa commented Oct 22, 2023

your credit is maintained. Let me know if you have any questions or concerns.

@andrewvaughan Don't need credit. Whatever's easiest. If you want to merge in #3032 first, and have me rebase this PR after, that works. Or vice versa.

@andrewvaughan
Copy link
Contributor

your credit is maintained. Let me know if you have any questions or concerns.

@andrewvaughan Don't need credit. Whatever's easiest. If you want to merge in #3032 first, and have me rebase this PR after, that works. Or vice versa.

I think we're going to finalize that issue today - keep an eye on it for a rebase.

Copy link
Contributor

This pull request has been automatically marked as stale because it has not had recent activity.
It will be closed in 14 days if no further activity occurs.
Thank you for your contributions.

If you think this pull request should stay open, please remove the O: stale 🤖 label or comment on the pull request.

@github-actions github-actions bot added the O: stale 🤖 This issue or pull request is stale, it will be closed if there is no activity label Nov 23, 2023
@github-actions github-actions bot removed the O: stale 🤖 This issue or pull request is stale, it will be closed if there is no activity label Nov 24, 2023
@rasa
Copy link
Contributor Author

rasa commented Dec 6, 2023

Happy to let this close, if that’s the consensus. No worries.

@nvuillam
Copy link
Member

nvuillam commented Dec 6, 2023

Nah, I love this PR, I'm jsut afraid of regressions ^^

Has it been tested on multiple repos ? :)

@echoix
Copy link
Collaborator

echoix commented Dec 6, 2023

If I recall correctly, wasn't the most of the changes of this PR superseded by #3032, that completely rewrites the template and docs?

@nvuillam
Copy link
Member

nvuillam commented Dec 6, 2023

I love both PRs 👍
but maybe the other one is more advanced... a mix of the 2, with more comments and less copy-paste would be a dream ^^

@andrewvaughan
Copy link
Contributor

Not sure what more is needed from me here for my PR, but happy to help - just point me in the direction you need!

@echoix
Copy link
Collaborator

echoix commented Dec 7, 2023

I started something out, but my node skills are pretty rudimentary, but the process was a bit the same as how the linter helps are placed in our docs when building. We call the tool, take the output, and replace the contents between two markers.

#3073

The difficulty that existed with the generator tool was that calling it interactively wasn't obvious from their docs. It kinda changed over time, and I drafted a POC that was able to call and get the contents in a temporary file. The rest is to finish to integrate into a working whole.

So yes, what is used for the generator is authoritative.

@echoix
Copy link
Collaborator

echoix commented Dec 7, 2023

Q: To that end, is https://github.com/oxsecurity/megalinter/blob/main/TEMPLATES/mega-linter.yml considered to be our authoritative version?

I think
https://github.com/oxsecurity/megalinter/blob/main/mega-linter-runner/generators/mega-linter/templates/mega-linter.yml
should be the source, since it has placeholders that can be used to generate the other files. The other way around would mean loosing that generalization.

And there's files for the other CI platforms that could be synced in the same way into the docs.

@rasa
Copy link
Contributor Author

rasa commented Dec 7, 2023

I think https://github.com/oxsecurity/megalinter/blob/main/mega-linter-runner/generators/mega-linter/templates/mega-linter.yml should be the source...

Gotcha. My apologies, but I didn't update this file in either #2888 or #2957, so once #3032 is merged, I will draft a PR to sync up all our various versions, if need be.

Closing this PR, but its work will not be forgotten.

@rasa rasa closed this Dec 7, 2023
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

Successfully merging this pull request may close these issues.

5 participants