-
-
Notifications
You must be signed in to change notification settings - Fork 237
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
Fixup changes/no changes exit codes for build-command #2381
Conversation
🦙 MegaLinter status:
|
Descriptor | Linter | Files | Fixed | Errors | Elapsed time |
---|---|---|---|---|---|
✅ BASH | bash-exec | 6 | 0 | 0.01s | |
✅ BASH | shellcheck | 6 | 0 | 0.14s | |
✅ BASH | shfmt | 6 | 0 | 0 | 0.35s |
✅ COPYPASTE | jscpd | yes | no | 2.74s | |
✅ DOCKERFILE | hadolint | 114 | 0 | 16.64s | |
✅ JSON | eslint-plugin-jsonc | 21 | 0 | 0 | 2.14s |
✅ JSON | jsonlint | 19 | 0 | 0.26s | |
✅ JSON | v8r | 21 | 0 | 11.92s | |
markdownlint | 309 | 4 | 230 | 6.15s | |
✅ MARKDOWN | markdown-link-check | 309 | 0 | 5.46s | |
✅ MARKDOWN | markdown-table-formatter | 309 | 4 | 0 | 17.85s |
✅ OPENAPI | spectral | 1 | 0 | 1.75s | |
bandit | 183 | 47 | 1.95s | ||
✅ PYTHON | black | 183 | 0 | 0 | 3.75s |
✅ PYTHON | flake8 | 183 | 0 | 1.87s | |
✅ PYTHON | isort | 183 | 0 | 0 | 0.78s |
✅ PYTHON | mypy | 183 | 0 | 6.77s | |
✅ PYTHON | pylint | 183 | 0 | 11.81s | |
pyright | 183 | 249 | 17.97s | ||
✅ REPOSITORY | checkov | yes | no | 28.93s | |
✅ REPOSITORY | git_diff | yes | no | 0.38s | |
✅ REPOSITORY | secretlint | yes | no | 14.45s | |
✅ REPOSITORY | trivy | yes | no | 26.46s | |
✅ SPELL | cspell | 745 | 0 | 18.86s | |
✅ SPELL | misspell | 566 | 0 | 0 | 0.87s |
✅ XML | xmllint | 3 | 0 | 0 | 0.35s |
✅ YAML | prettier | 81 | 0 | 0 | 3.34s |
✅ YAML | v8r | 23 | 0 | 58.32s | |
✅ YAML | yamllint | 82 | 0 | 1.08s |
See detailed report in MegaLinter reports
Giving up. The theory worked, the shell commands worked, but I wasn't able to get it working as expected on GH actions on my fork's branch (the status handling, it was even worse). So I just went and looked for an action that does what I wanted. Went for the first that seemed correct, did what I wanted, and that was not too sketchy/still alive, https://github.com/stefanzweifel/git-auto-commit-action. echoix#2 |
@nvuillam could you take a look at this? |
@echoix the culprit seems to be me. In workflows I started to pass the branch to the container (GITHUB_REF_NAME): megalinter/.github/workflows/deploy-DEV.yml Line 210 in e90b345
I do this because the remote tests use a url that was previously fixed to the
I don't know if it is because it is a fork the source of the PR but the url is weird, it equals to PR ID (2381): And it returns a 404: https://raw.githubusercontent.com/oxsecurity/megalinter/2381/merge/.automation/test/mega-linter-config-test/remote/custom.mega-linter.yml |
I see how it fails, and it seems we just need to find the correct variable/url to send. |
@echoix I fixed a CI issue in main branch, please can u merge it in your branch so it passes more easily ? |
these files don't can't change the flavors by themselves
…it-auto-commit-action
7dd13a0
to
573269a
Compare
@nvuillam Done :) |
@echoix these test cases do not fail in other branches... ^^ |
Because they come from a branch of the repo. This comes from a fork. |
See #2381 (comment) |
In the meantime could you merge to continue? |
Thanks! |
@nvuillam I don't understand now. What was working for even a PR in my branch, and that time I was sure (it's the third iteration of all what was supposed to work), still doesn't work on the PR #2380. My other option is to use the fetch depth of at least 2 instead of the default that is 1, since I read that detecting if changes were made may not always work if the fetch depth is 1. |
Or maybe there is something special with the dependabot PRs? |
There is, yes. They are essentially treated like PRs opened from a fork. |
Seems like the handling of the exit codes to determine if changes are to be committed didn't work well once used in an action.
Going simpler in bash, using onlygit diff
with--exit-code
in order to show the diff, but have the exit code. Then the exit code is handled by the outcome (using continue-on-error) to use thesuccess
orfailure
outcome of a step.~~https://docs.github.com/en/actions/learn-github-actions/contexts#steps-context ~~
https://docs.github.com/en/actions/creating-actions/setting-exit-codes-for-actions#about-exit-codeshttps://git-scm.com/docs/git-diff#Documentation/git-diff.txt---exit-codevs https://git-scm.com/docs/git-diff#Documentation/git-diff.txt---quietEdit:
Since this approach didn't end up going smoothly, I changed the approach and used the https://github.com/stefanzweifel/git-auto-commit-action to commit and set an output if there were changes. With this, it works as expected.
Proposed Changes
Readiness Checklist
Author/Contributor
Reviewing Maintainer
breaking
if this is a large fundamental changeautomation
,bug
,documentation
,enhancement
,infrastructure
, orperformance