[pull] master from ray-project:master #646
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
name: Pull request synchronized | |
on: | |
pull_request_target: | |
types: | |
- synchronize | |
branches: | |
- "master" | |
- "releases/**" | |
jobs: | |
disable-automerge: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/github-script@v7 | |
with: | |
script: | | |
const prQuery = `query PullRequest($owner: String!, $repo: String!, $pullRequestNumber: Int!) { | |
repository(owner: $owner, name: $repo) { | |
pullRequest(number: $pullRequestNumber) { | |
id | |
autoMergeRequest { | |
enabledAt | |
} | |
} | |
} | |
}`; | |
const prVariables = { | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
pullRequestNumber: context.issue.number | |
} | |
const prResult = await github.graphql(prQuery, prVariables) | |
if (!prResult.repository.pullRequest.autoMergeRequest) { | |
console.log('Auto merge is not enabled') | |
return | |
} | |
const automergeQuery = `mutation DisablePullRequestAutoMerge($pullRequestId: ID!) { | |
disablePullRequestAutoMerge(input: {pullRequestId: $pullRequestId}) { | |
pullRequest { | |
id | |
} | |
} | |
}`; | |
const automergeVariables = { | |
pullRequestId: prResult.repository.pullRequest.id | |
} | |
const result = await github.graphql(automergeQuery, automergeVariables) | |
console.log(result) |