feat(cb2-13814): remove 199 from central docs list (#1594) #1543
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: Tag Merge Conflicts | |
on: | |
push: | |
branches: ['develop'] | |
pull_request: | |
branches: ['develop'] | |
jobs: | |
merge-conflicts: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- uses: actions/github-script@v6 | |
with: | |
script: | | |
const pullRequests = (await github.rest.pulls.list({ | |
...context.repo | |
})).data | |
const addMergeConflictTag = async (pullRequests) => { | |
const promises = pullRequests.map(pr => { | |
const { number } = pr | |
return github.rest.pulls.get({ | |
...context.repo, | |
pull_number: number | |
}) | |
}) | |
const prs = await Promise.allSettled(promises) | |
const prsAwaitingCheck = [] | |
prs.forEach(pr => { | |
const data = pr.value.data | |
if (data.mergeable === false) { | |
github.rest.issues.addLabels({ | |
...context.repo, | |
issue_number: data.number, | |
labels: ["merge conflict"] | |
}) | |
} else if (data.mergeable === true | |
&& data.labels.some(label => label.name === "merge conflict")) { | |
github.rest.issues.removeLabel({ | |
...context.repo, | |
issue_number: data.number, | |
name: "merge conflict" | |
}) | |
} else if (data.mergeable === null) { | |
prsAwaitingCheck.push({...data}) | |
} | |
}) | |
if (prsAwaitingCheck.length) { | |
console.log("Some PRs are still waiting to calculate status...") | |
await new Promise(resolve => setTimeout(resolve, 5000)) | |
addMergeConflictTag(prsAwaitingCheck) | |
} | |
} | |
await addMergeConflictTag(pullRequests) |