The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
ci: auto-close external PRs failing `issue-link` check (#35697)
Mason Daugherty5b1b37e9f269
diff --git a/.github/workflows/require_issue_link.yml b/.github/workflows/require_issue_link.ymlindex 382d5dd70c..0d524cada4 100644--- a/.github/workflows/require_issue_link.yml+++ b/.github/workflows/require_issue_link.yml@@ -107,7 +107,7 @@ jobs:if (error.status !== 404) throw error;}- - name: Post comment and fail+ - name: Post comment, close PR, and failif: steps.check-link.outputs.has-link != 'true' || steps.check-link.outputs.is-assigned != 'true'uses: actions/github-script@v8with:@@ -122,21 +122,22 @@ jobs:if (!hasLink) {lines = [marker,- '**This PR is missing a linked issue.** All external contributions must reference an approved issue or discussion.',+ '**This PR has been automatically closed** because it does not link to an approved issue.','',- 'Please add one of the following to your PR description:',- '- `Fixes #<issue_number>`',- '- `Closes #<issue_number>`',- '- `Resolves #<issue_number>`',- '',- 'If no issue exists yet, [open one](https://github.com/' + owner + '/' + repo + '/issues/new/choose) and wait for maintainer approval before proceeding.',+ 'All external contributions must reference an approved issue or discussion. Please:',+ '1. Find or [open an issue](https://github.com/' + owner + '/' + repo + '/issues/new/choose) describing the change',+ '2. Wait for a maintainer to approve and assign you',+ '3. Add `Fixes #<issue_number>`, `Closes #<issue_number>`, or `Resolves #<issue_number>` to your PR description',+ '4. Ask a maintainer to reopen this PR',];} else {lines = [marker,- '**You are not assigned to the linked issue.** External contributors must be assigned to an issue before opening a PR for it.',+ '**This PR has been automatically closed** because you are not assigned to the linked issue.','',- 'Please comment on the issue to request assignment from a maintainer, then update this PR once you have been assigned.',+ 'External contributors must be assigned to an issue before opening a PR for it. Please:',+ '1. Comment on the linked issue to request assignment from a maintainer',+ '2. Once assigned, ask a maintainer to reopen this PR',];}@@ -169,6 +170,17 @@ jobs:console.log('Comment already exists — skipping');}+ // Close the PR+ if (context.payload.pull_request.state === 'open') {+ await github.rest.pulls.update({+ owner,+ repo,+ pull_number: prNumber,+ state: 'closed',+ });+ console.log(`Closed PR #${prNumber}`);+ }+const reason = !hasLink? 'PR must reference an issue using auto-close keywords (e.g., "Fixes #123").': 'PR author must be assigned to the linked issue.';