-
-
Notifications
You must be signed in to change notification settings - Fork 242
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
Fix /build
slash command to checkout the correct PR branch
#2542
Conversation
Add checkout-ref and checkout-repository
Add checkout-ref and checkout-repository inputs
Slash cmd ref
Slash cmd ref2
Slash cmd ref3
Update slash-command-dispatch.yml 4
Slash cmd ref
Update slash-command-dispatch.yml
Update slash-command-dispatch.yml
Update slash-command-dispatch.yml 8
Update slash-command-dispatch.yml9
Revert "Dummy update descriptor"
Update slash-command-dispatch.yml
Change Python version
Update slash-cmd-ref from oxsecurity/megalinter main
🦙 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.42s |
✅ COPYPASTE | jscpd | yes | no | 2.83s | |
✅ DOCKERFILE | hadolint | 116 | 0 | 19.72s | |
✅ JSON | eslint-plugin-jsonc | 21 | 0 | 0 | 2.44s |
✅ JSON | jsonlint | 19 | 0 | 0.22s | |
✅ JSON | v8r | 21 | 0 | 14.69s | |
markdownlint | 312 | 0 | 230 | 7.83s | |
✅ MARKDOWN | markdown-link-check | 312 | 0 | 6.22s | |
✅ MARKDOWN | markdown-table-formatter | 312 | 0 | 0 | 24.1s |
✅ OPENAPI | spectral | 1 | 0 | 1.51s | |
bandit | 185 | 54 | 2.25s | ||
✅ PYTHON | black | 185 | 0 | 0 | 5.17s |
✅ PYTHON | flake8 | 185 | 0 | 1.88s | |
✅ PYTHON | isort | 185 | 0 | 0 | 0.88s |
✅ PYTHON | mypy | 185 | 0 | 8.07s | |
✅ PYTHON | pylint | 185 | 0 | 12.66s | |
pyright | 185 | 251 | 17.96s | ||
✅ PYTHON | ruff | 185 | 0 | 0 | 0.47s |
✅ REPOSITORY | checkov | yes | no | 37.87s | |
✅ REPOSITORY | git_diff | yes | no | 0.4s | |
✅ REPOSITORY | secretlint | yes | no | 15.93s | |
✅ REPOSITORY | trivy | yes | no | 34.77s | |
✅ SPELL | cspell | 753 | 0 | 23.19s | |
✅ SPELL | misspell | 572 | 0 | 0 | 1.07s |
✅ XML | xmllint | 3 | 0 | 0 | 0.42s |
✅ YAML | prettier | 81 | 0 | 0 | 3.21s |
✅ YAML | v8r | 23 | 0 | 61.35s | |
✅ YAML | yamllint | 82 | 0 | 1.3s |
See detailed report in MegaLinter reports
Limitations I forgot/couldn’t easily test yet:
|
Please squash-merge rather than merge this PR. I had to make a lot of commits (and merge what changing the dispatcher to test) since it was Actions-related work |
I think as long as the proper |
That's not really what I meant actually. It's that when testing, the final state that I'm adding is like my 4th or 5th approach, and one of the failed attempts that was working was using a ref of |
Was |
Yes, that's what I'm not sure. And yes, the issue-number is the PR number. There is no distinction on that matter api-wise |
I edited my reply to basically say, in that case it sounds like you did the right thing. |
I think it is ready to merge, there's nothing left to do. |
@echoix except conflict it's ok :) |
The /build slash command was not checking out the correct branch when used. It was always using the base branch of the upstream repo. This was because it was called from a workflow_dispatch, so not tied to any event, nor pull request. The dispatcher (another workflow run), only had access to an issue event context, that doesn’t include information from the repo of the pull request. So, in order to hand the checkout action appropriate inputs, the build command is passed additional inputs, for the ref and repo name. These are obtained by using an api call from the pull request number in the repo (since it is available), and extracting the fields from the json.
I tried using some pre-made actions, but didn’t get the repo name easily, and they weren’t mainstream. So, it is just using a custom script with actions/github-script to do the api call, and set outputs.
Documentation for the usage is the same, it should do exactly the same as expected.
Fixes # … I’m not sure we reported it officially, but we (maintainers) are aware that it didn’t work directly as wanted.
Proposed Changes
Readiness Checklist
Author/Contributor
Reviewing Maintainer
breaking
if this is a large fundamental changeautomation
,bug
,documentation
,enhancement
,infrastructure
, orperformance