ci: avoid duplicate PR gate comments
This commit is contained in:
@@ -73,21 +73,32 @@ jobs:
|
|||||||
}
|
}
|
||||||
|
|
||||||
const gateMessage = enforceGate
|
const gateMessage = enforceGate
|
||||||
? 'This repository currently limits automated PR intake to contributors listed in `.github/APPROVED_CONTRIBUTORS`. This is a maintainer-safety control for code review and CI load, not a judgment on the contribution. A maintainer can reopen or grant access with `/lgtm` after review.'
|
? 'This repository currently limits automated PR intake to contributors listed in `.github/APPROVED_CONTRIBUTORS`. This is a maintainer-safety control for code review and CI load, not a judgment on the contribution. A maintainer can grant recurring PR access with `/lgtm` after review; once the generated allowlist PR is merged, this pull request can be reopened or resubmitted.'
|
||||||
: 'This repository is observing a maintainer-managed PR intake gate in dry-run mode, so this pull request is staying open. This note helps maintainers prepare the allowlist before any enforcement is considered.';
|
: 'This repository is observing a maintainer-managed PR intake gate in dry-run mode, so this pull request is staying open. This note helps maintainers prepare the allowlist before any enforcement is considered.';
|
||||||
|
|
||||||
await github.rest.issues.createComment({
|
const marker = '<!-- codewhale-pr-gate -->';
|
||||||
|
const { data: comments } = await github.rest.issues.listComments({
|
||||||
owner,
|
owner,
|
||||||
repo,
|
repo,
|
||||||
issue_number: pr.number,
|
issue_number: pr.number,
|
||||||
body: [
|
per_page: 100,
|
||||||
`Thanks @${pr.user.login} for taking the time to contribute.`,
|
|
||||||
'',
|
|
||||||
gateMessage,
|
|
||||||
'',
|
|
||||||
'Please read `CONTRIBUTING.md` for the expected contribution shape. A maintainer can grant recurring PR access by commenting `/lgtm` on a pull request.',
|
|
||||||
].join('\n'),
|
|
||||||
});
|
});
|
||||||
|
const alreadyNoted = comments.some(comment => (comment.body || '').includes(marker));
|
||||||
|
if (!alreadyNoted) {
|
||||||
|
await github.rest.issues.createComment({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
issue_number: pr.number,
|
||||||
|
body: [
|
||||||
|
marker,
|
||||||
|
`Thanks @${pr.user.login} for taking the time to contribute.`,
|
||||||
|
'',
|
||||||
|
gateMessage,
|
||||||
|
'',
|
||||||
|
'Please read `CONTRIBUTING.md` for the expected contribution shape. A maintainer can grant recurring PR access by commenting `/lgtm` on a pull request.',
|
||||||
|
].join('\n'),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (!enforceGate) return;
|
if (!enforceGate) return;
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
triage note and are never auto-closed by the contribution gate, while the PR
|
triage note and are never auto-closed by the contribution gate, while the PR
|
||||||
gate copy makes clear that dry-run observations are about maintainer safety,
|
gate copy makes clear that dry-run observations are about maintainer safety,
|
||||||
not contributor quality.
|
not contributor quality.
|
||||||
|
- Added a PR gate marker guard so reopened unapproved PRs do not get duplicate
|
||||||
|
intake comments, and clarified that PR reopening should happen after
|
||||||
|
allowlist approval is merged.
|
||||||
- Documented the agent and sub-agent stewardship ethos so future automation
|
- Documented the agent and sub-agent stewardship ethos so future automation
|
||||||
preserves human issue intake, careful PR review, and contributor credit.
|
preserves human issue intake, careful PR review, and contributor credit.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user