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

Fix /build slash command to checkout the correct PR branch #2542

Merged
merged 58 commits into from
Apr 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
ac8953f
Update slash-command-dispatch.yml
echoix Apr 4, 2023
74ac9da
Update build-command.yml
echoix Apr 4, 2023
1e8bb1e
Merge pull request #4 from echoix/slash-cmd-ref
echoix Apr 4, 2023
80450d6
Update slash-command-dispatch.yml
echoix Apr 5, 2023
bb03758
Update build-command.yml
echoix Apr 5, 2023
b5eee02
Update build-command.yml
echoix Apr 5, 2023
faf0166
Merge pull request #6 from echoix/slash-cmd-ref
echoix Apr 5, 2023
fdd4762
Dummy update descriptor
echoix Apr 4, 2023
e1fc725
Update slash-command-dispatch.yml
echoix Apr 5, 2023
2e7d286
Update build-command.yml
echoix Apr 5, 2023
5c4d9e4
Merge branch 'main' into slash-cmd-ref
echoix Apr 5, 2023
9b868a6
Merge pull request #7 from echoix/slash-cmd-ref
echoix Apr 5, 2023
3f32807
[build-command] Update generated files
echoix Apr 5, 2023
3d03323
Update slash-command-dispatch.yml
echoix Apr 5, 2023
ea8793f
Merge pull request #8 from echoix/slash-cmd-ref
echoix Apr 5, 2023
4e96161
Merge branch 'main' into slash-cmd-ref-test
echoix Apr 5, 2023
ec6dd3b
Update slash-command-dispatch.yml
echoix Apr 5, 2023
6a00da2
Update slash-command-dispatch.yml
echoix Apr 5, 2023
44706cc
Merge pull request #9 from echoix/slash-cmd-ref
echoix Apr 5, 2023
bc179b9
Update slash-command-dispatch.yml
echoix Apr 5, 2023
bf8674c
Merge pull request #10 from echoix/slash-cmd-ref
echoix Apr 5, 2023
cd18df0
Update slash-command-dispatch.yml
echoix Apr 5, 2023
383a2ba
Merge pull request #11 from echoix/slash-cmd-ref
echoix Apr 5, 2023
a5c250b
Merge branch 'main' into slash-cmd-ref-test
echoix Apr 5, 2023
7f1a853
Update slash-command-dispatch.yml
echoix Apr 5, 2023
374b2e7
Merge pull request #12 from echoix/slash-cmd-ref
echoix Apr 5, 2023
9f9ce7e
Merge branch 'main' into slash-cmd-ref-test
echoix Apr 5, 2023
0ea9cd5
Update slash-command-dispatch.yml
echoix Apr 5, 2023
0635469
Merge pull request #13 from echoix/slash-cmd-ref
echoix Apr 5, 2023
6a4b70c
Merge branch 'main' into slash-cmd-ref-test
echoix Apr 5, 2023
8effe98
Update slash-command-dispatch.yml
echoix Apr 8, 2023
6ba32c4
Merge pull request #14 from echoix/slash-cmd-ref
echoix Apr 8, 2023
aaddcee
Merge branch 'main' into slash-cmd-ref-test
echoix Apr 8, 2023
c2ab0bb
Update slash-command-dispatch.yml
echoix Apr 8, 2023
f7b6c66
Merge branch 'main' into slash-cmd-ref
echoix Apr 8, 2023
ede9e8e
Merge pull request #15 from echoix/slash-cmd-ref
echoix Apr 8, 2023
176ce6b
Merge branch 'main' into slash-cmd-ref-test
echoix Apr 8, 2023
7e05c31
Update slash-command-dispatch.yml
echoix Apr 8, 2023
64109b1
Merge branch 'main' into slash-cmd-ref
echoix Apr 8, 2023
4a7431f
Merge pull request #16 from echoix/slash-cmd-ref
echoix Apr 8, 2023
d3faca9
Merge branch 'main' into slash-cmd-ref-test
echoix Apr 8, 2023
5df0267
Update slash-command-dispatch.yml
echoix Apr 8, 2023
261ae1e
Merge branch 'main' into slash-cmd-ref
echoix Apr 8, 2023
7a4f986
Merge pull request #17 from echoix/slash-cmd-ref
echoix Apr 8, 2023
989ba40
Merge branch 'main' into slash-cmd-ref-test
echoix Apr 8, 2023
1315a1c
Merge pull request #5 from echoix/slash-cmd-ref-test
echoix Apr 8, 2023
6d47693
Revert "Dummy update descriptor"
echoix Apr 8, 2023
9d5eb27
Merge pull request #18 from echoix/revert-5-slash-cmd-ref-test
echoix Apr 8, 2023
870adcc
Update slash-command-dispatch.yml
echoix Apr 8, 2023
6b6f31a
Update slash-command-dispatch.yml
echoix Apr 8, 2023
4df0673
Merge branch 'main' into slash-cmd-ref
echoix Apr 8, 2023
8b87cb9
Merge pull request #20 from echoix/slash-cmd-ref
echoix Apr 8, 2023
820aa7a
Update build-command.yml
echoix Apr 8, 2023
cd2a427
Update slash-command-dispatch.yml
echoix Apr 8, 2023
e6c60de
Merge branch 'main' into slash-cmd-ref
echoix Apr 8, 2023
9ce1b41
Merge pull request #22 from oxsecurity/main
echoix Apr 8, 2023
76cc69b
Update CHANGELOG.md
echoix Apr 8, 2023
bfd950b
Merge branch 'main' into slash-cmd-ref
bdovaz Apr 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions .github/workflows/build-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ on:
actor:
description: "The user who executed the slash command"
required: true
checkout-ref:
description: "The reference to pass to 'ref' to checkout action"
required: true
checkout-repository:
description: "The repository to pass to 'repository' to tcheckout action"
required: false
repository_dispatch:
types: [build-command]
jobs:
Expand Down Expand Up @@ -47,17 +53,21 @@ jobs:
env:
PAYLOAD_CONTEXT: ${{ toJson(github.event.client_payload) }}
run: echo "$PAYLOAD_CONTEXT"
- name: Dump the inputs payload context
env:
INPUTS_CONTEXT: ${{ toJson(github.event.inputs) }}
run: echo "$INPUTS_CONTEXT"
# Checkout the pull request branch
- uses: actions/checkout@v3
with:
token: ${{ secrets.PAT }}
repository: ${{ github.event.client_payload.pull_request.head.repo.full_name }}
ref: ${{ github.event.client_payload.pull_request.head.ref }}
repository: ${{ github.event.inputs.checkout-repository }}
ref: ${{ github.event.inputs.checkout-ref }}
- name: Setup Python
uses: actions/setup-python@v4.5.0
with:
# Version range or exact version of Python or PyPy to use, using SemVer's version range syntax. Reads from .python-version if unset.
python-version: 3.11.2 # optional
python-version: 3.11.3 # optional
# Used to specify a package manager for caching in the default directory. Supported values: pip, pipenv, poetry.
cache: pip # optional
- run: pip install -r requirements.dev.txt
Expand Down
31 changes: 30 additions & 1 deletion .github/workflows/slash-command-dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,36 @@ jobs:
slashCommandDispatch:
runs-on: ubuntu-latest
steps:
- name: Slash Command Dispatch
- name: Dump the event payload context
env:
EVENT_CONTEXT: ${{ toJson(github.event) }}
run: echo "$EVENT_CONTEXT"
- uses: actions/github-script@v6
id: get-pr
with:
script: |
const request = {
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
}
core.info(`Getting PR #${request.pull_number} from ${request.owner}/${request.repo}`)
try {
const result = await github.rest.pulls.get(request);
core.setOutput('head_ref', result.data.head.ref);
core.setOutput('head_repo_full_name', result.data.head.repo.full_name);
return result.data;
} catch (err) {
core.setFailed(`Request failed with error ${err}`)
}
- name: Dump the get-pr payload context
env:
GETPR_OUTPUTS: ${{ toJson(steps.get-pr.outputs) }}
run: echo "$GETPR_OUTPUTS"
- name: Slash Command Dispatch PR
uses: peter-evans/slash-command-dispatch@v3
id: scd
if: success()
with:
token: ${{ secrets.PAT }}
commands: |
Expand All @@ -21,6 +48,8 @@ jobs:
comment-id=${{ github.event.comment.id }}
issue-number=${{ github.event.issue.number }}
actor=${{ github.actor }}
checkout-ref=${{ steps.get-pr.outputs.head_ref }}
checkout-repository=${{ steps.get-pr.outputs.head_repo_full_name }}
- name: Edit comment with error message
if: steps.scd.outputs.error-message
uses: peter-evans/create-or-update-comment@v3
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-l
- Fix issue preventing plugins to work with flavors
- Upgrade create-pull-request and create-or-update-comment GitHub Actions
- Increase auto-update-linters GitHub Action timeout
- Fix `/build` slash command to checkout the correct branch when called from PR, by @echoix in <https://github.com/oxsecurity/megalinter/pull/2542>
- Fix crash in case of unreachable symlinks

- Documentation
Expand Down