-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SUITEDEV-35237 Co-authored-by: davidSchuppa <[email protected]> Co-authored-by: megamegax <[email protected]> Co-authored-by: Andras Sarro <[email protected]> Co-authored-by: matusekma <[email protected]>
- Loading branch information
1 parent
5e42455
commit 0390e8f
Showing
6 changed files
with
289 additions
and
465 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Auto-Merge Dependabot PRs on CI Success | ||
|
||
on: | ||
repository_dispatch: | ||
types: [ checks-complete ] | ||
jobs: | ||
auto-merge: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: echo "PR_NUMBER=${{ toJson(github.event.client_payload.prNumber) }}" >> $GITHUB_ENV | ||
- name: Wait for 10 seconds | ||
run: sleep 10 | ||
- name: Check CI status and Merge PR | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
const prNumber = process.env.PR_NUMBER; | ||
if (!prNumber) { | ||
console.log("No PR number found."); | ||
return; | ||
} | ||
const { data: pullRequest } = await github.rest.pulls.get({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
pull_number: prNumber, | ||
}); | ||
if(pullRequest.merged) { | ||
console.log(`PR #${prNumber} is already merged.`); | ||
return; | ||
} | ||
const { data: listCheckRuns } = await github.rest.checks.listForRef({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: pullRequest.head.sha, | ||
}); | ||
console.log("checks: ", listCheckRuns); | ||
const allChecksPassed = listCheckRuns.check_runs.every(check => check.conclusion === 'success' || check.name === 'Inclusive Language' || check.conclusion === 'skipped'); | ||
if (allChecksPassed) { | ||
await github.rest.pulls.merge({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
pull_number: prNumber, | ||
}); | ||
console.log(`Merged PR #${prNumber}`); | ||
} else { | ||
console.log(`Not all checks passed for PR #${prNumber}`); | ||
} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.