mirror of
https://github.com/Z3Prover/z3
synced 2026-04-27 06:13:35 +00:00
Merge pull request #8959 from Z3Prover/copilot/create-workflow-mark-prs-ready
Add workflow to mark all draft PRs ready for review
This commit is contained in:
commit
588b07f5ad
1 changed files with 59 additions and 0 deletions
59
.github/workflows/mark-prs-ready-for-review.yml
vendored
Normal file
59
.github/workflows/mark-prs-ready-for-review.yml
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
||||||
|
name: Mark Pull Requests Ready for Review
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [opened]
|
||||||
|
workflow_dispatch:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * *'
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
mark-ready:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
pull-requests: write
|
||||||
|
steps:
|
||||||
|
- name: Mark all draft pull requests ready for review
|
||||||
|
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
async function markReady(nodeId, number, title) {
|
||||||
|
core.info(`Marking PR #${number} "${title}" ready for review.`);
|
||||||
|
try {
|
||||||
|
await github.graphql(`
|
||||||
|
mutation($id: ID!) {
|
||||||
|
markPullRequestReadyForReview(input: { pullRequestId: $id }) {
|
||||||
|
pullRequest { number isDraft }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`, { id: nodeId });
|
||||||
|
} catch (err) {
|
||||||
|
core.warning(`Failed to mark PR #${number} ready for review: ${err.message}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (context.eventName === 'pull_request') {
|
||||||
|
const pr = context.payload.pull_request;
|
||||||
|
if (pr.draft) {
|
||||||
|
await markReady(pr.node_id, pr.number, pr.title);
|
||||||
|
} else {
|
||||||
|
core.info(`PR #${pr.number} is already ready for review. Nothing to do.`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const pulls = await github.paginate(github.rest.pulls.list, {
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
state: 'open',
|
||||||
|
});
|
||||||
|
|
||||||
|
const drafts = pulls.filter(pr => pr.draft);
|
||||||
|
core.info(`Found ${drafts.length} draft pull request(s).`);
|
||||||
|
|
||||||
|
for (const pr of drafts) {
|
||||||
|
await markReady(pr.node_id, pr.number, pr.title);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
core.info('Done.');
|
||||||
Loading…
Add table
Add a link
Reference in a new issue