ci: trigger Dependabot auto-merge from workflow runs
This commit is contained in:
1 parent
d3aef1eace
commit
69fc36df33
1 file changed
+16
-11
@@ -1,18 +1,15 @@
|
|||||||
name: Dependabot Auto Merge
|
name: Dependabot Auto Merge
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request_target:
|
workflow_run:
|
||||||
|
workflows:
|
||||||
|
- "CodeQL"
|
||||||
types:
|
types:
|
||||||
- opened
|
- completed
|
||||||
- synchronize
|
|
||||||
- reopened
|
|
||||||
- ready_for_review
|
|
||||||
schedule:
|
|
||||||
- cron: "*/30 * * * *"
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
|
group: ${{ github.workflow }}-${{ github.event.workflow_run.head_branch || github.run_id }}
|
||||||
cancel-in-progress: false
|
cancel-in-progress: false
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
@@ -53,9 +50,17 @@ jobs:
|
|||||||
};
|
};
|
||||||
|
|
||||||
const findCandidatePulls = async () => {
|
const findCandidatePulls = async () => {
|
||||||
if (context.eventName === "pull_request_target") {
|
const branch = context.payload.workflow_run?.head_branch;
|
||||||
const pr = context.payload.pull_request;
|
if (context.eventName === "workflow_run" && branch) {
|
||||||
return pr?.user?.login === "dependabot[bot]" && pr?.state === "open" ? [pr] : [];
|
const { data: pulls } = await github.rest.pulls.list({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
state: "open",
|
||||||
|
head: owner + ":" + branch,
|
||||||
|
per_page: 10,
|
||||||
|
});
|
||||||
|
|
||||||
|
return pulls.filter((pr) => pr.user?.login === "dependabot[bot]");
|
||||||
}
|
}
|
||||||
|
|
||||||
const pulls = await github.paginate(github.rest.pulls.list, {
|
const pulls = await github.paginate(github.rest.pulls.list, {
|
||||||
|
|||||||
Reference in new issue
Block a user