Created
August 3, 2021 19:24
-
-
Save bendavies/3d6542d59f5546b11b95f7a7ccf12330 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# https://docs.github.com/en/actions | |
name: "Dependabot Merge" | |
on: | |
workflow_run: | |
workflows: ["Integrate"] | |
types: | |
- completed | |
jobs: | |
merge: | |
name: "Merge" | |
runs-on: "ubuntu-latest" | |
if: > | |
github.event.workflow_run.event == 'pull_request' && | |
github.event.workflow_run.conclusion == 'success' && | |
github.actor == 'dependabot[bot]' | |
steps: | |
- name: "Request review from @robotowsy" | |
uses: "actions/[email protected]" | |
with: | |
github-token: "${{ secrets.ROBOT_GITHUB_OAUTH_TOKEN }}" | |
script: | | |
const pullRequest = context.payload.workflow_run.pull_requests[0] | |
const repository = context.repo | |
const reviewers = [ | |
"robotowsy", | |
] | |
await github.pulls.requestReviewers({ | |
owner: repository.owner, | |
repo: repository.repo, | |
pull_number: pullRequest.number, | |
reviewers: reviewers, | |
}) | |
- name: "Assign @robotowsy" | |
uses: "actions/[email protected]" | |
with: | |
github-token: "${{ secrets.ROBOT_GITHUB_OAUTH_TOKEN }}" | |
script: | | |
const pullRequest = context.payload.workflow_run.pull_requests[0] | |
const repository = context.repo | |
const assignees = [ | |
"robotowsy", | |
] | |
await github.issues.addAssignees({ | |
owner: repository.owner, | |
repo: repository.repo, | |
assignees: assignees, | |
issue_number: pullRequest.number | |
}) | |
- name: "Approve pull request" | |
uses: "actions/[email protected]" | |
with: | |
github-token: "${{ secrets.ROBOT_GITHUB_OAUTH_TOKEN }}" | |
script: | | |
const pullRequest = context.payload.workflow_run.pull_requests[0] | |
const repository = context.repo | |
await github.pulls.createReview({ | |
event: "APPROVE", | |
owner: repository.owner, | |
repo: repository.repo, | |
pull_number: pullRequest.number, | |
}) | |
- name: "Merge pull request" | |
uses: "actions/[email protected]" | |
with: | |
github-token: "${{ secrets.ROBOT_GITHUB_OAUTH_TOKEN }}" | |
script: | | |
const pullRequest = context.payload.workflow_run.pull_requests[0] | |
const repository = context.repo | |
await github.pulls.merge({ | |
merge_method: "merge", | |
owner: repository.owner, | |
pull_number: pullRequest.number, | |
repo: repository.repo, | |
}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment