-
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
16 additions
and
24 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 |
---|---|---|
@@ -1,33 +1,25 @@ | ||
name: "Auto approve Pull Requests and enable auto-merge" | ||
on: | ||
pull_request_target | ||
permissions: | ||
pull-requests: write | ||
jobs: | ||
worker: | ||
runs-on: ubuntu-latest | ||
if: github.actor == 'dependabot[bot]' | ||
steps: | ||
- name: automerge | ||
uses: actions/[email protected] | ||
- name: Dependabot metadata | ||
id: metadata | ||
uses: dependabot/[email protected] | ||
with: | ||
github-token: "${{ secrets.GH_TOKEN }}" | ||
script: | | ||
await github.pulls.createReview({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
pull_number: context.issue.number, | ||
event: 'APPROVE' | ||
}) | ||
const res = await github.graphql(`query { | ||
repository(owner: "${context.repo.owner}", name: "${context.repo.repo}") { | ||
pullRequest(number: ${context.issue.number}) { | ||
id | ||
} | ||
} | ||
}`) | ||
await github.graphql(`mutation { | ||
enablePullRequestAutoMerge(input: { pullRequestId: "${res.repository.pullRequest.id}", mergeMethod: SQUASH }) { | ||
clientMutationId | ||
} | ||
}`) | ||
github-token: ${{secrets.GH_TOKEN}} | ||
- name: Approve | ||
run: gh pr review --approve $PR_URL | ||
env: | ||
PR_URL: ${{github.event.pull_request.html_url}} | ||
GITHUB_TOKEN: ${{secrets.GH_TOKEN}} | ||
- name: Enable auto-merge | ||
run: gh pr merge --auto --squash $PR_URL | ||
env: | ||
PR_URL: ${{github.event.pull_request.html_url}} | ||
GITHUB_TOKEN: ${{secrets.GH_TOKEN}} |