Open lukelloydagi opened 2 weeks ago
@lukelloydagi APPLY_FIXES only work with GitHub Actions, because it's based on other workflows
https://github.com/oxsecurity/megalinter/blob/c116434995ccc05fd6918bb8373e09f17fc5e26d/mega-linter-runner/generators/mega-linter/templates/mega-linter.yml#L154 (from line 154 to end)
It is probably possible to do the same with Azure Pipelines, would you like to give it a try ? :)
I didn't find some "git commit" task in out of the box azure tasks ( https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/?view=azure-pipelines ) but there is probably one somehere, otherwise we can also use custom bash to make the commit & push, but i'd prefer something maintained somewhere else that in each MegaLinter pipeline :D
Maybe in custom tasks on MarketPlace ? https://marketplace.visualstudio.com/search?term=git&target=AzureDevOps&category=Azure%20Pipelines&cost=free&sortBy=Relevance
Then, we just need to find a way for MegaLinter step to output the info that there are updates to apply or not
You're already using the git Python package by the looks of it for the git diff: https://github.com/oxsecurity/megalinter/blob/c116434995ccc05fd6918bb8373e09f17fc5e26d/megalinter/MegaLinter.py#L797
Could use it again I imagine to do a repo.git.add
etc if changed files are copied back to the root first?
@lukelloyd1985 it looks worth trying, and if it works it would also be applicable to Gitlab & Bitbucket :)
I can't remember why we did it externally ^^
Would you add code to megalinter/reporters/UpdatedSourcesReporter.py as that file seems to be doing the file moving or elsewhere as that's only a reporter?
Reporters can do things if they are configured to :)
Next silly question...😉
How would I go about testing changes to that file? Can I somehow get a docker image created for testing in my Azure Pipeline or just get that file injected somewhere somehow?
Make a PR to alpha branch then i'll be able to generate a MegaLinter alpha :)
@nvuillam, it's only gone and worked 😲😆
I'll do some dotting of i's and crossing of t's and raise a PR to beta. Is there anyone who has experience of Bitbucket who can test?
Describe the solution you'd like When
APPLY_FIXES: all
is set in Azure Pipeline it would be useful for the automatically fixed files to be committed to the PRWould it be better to have this as a toggle/environment variable to allow users to select what works for them?
Where would you go about implementing this? An existing file or a new separate file? If new how would that integrate to existing process?