Skip to content

Commit 1c72c8c

Browse files
committed
Merge branch 'main' into release-next
2 parents d7be326 + 1eaf8d3 commit 1c72c8c

File tree

3 files changed

+132
-0
lines changed

3 files changed

+132
-0
lines changed

.github/workflows/close-v2-issues.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: 🚪 Close v2 Issues
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
prior_to_date:
7+
required: true
8+
9+
concurrency: ${{ github.workflow }}-${{ github.ref }}
10+
11+
jobs:
12+
experimental:
13+
name: 🚪 Close v2 Issues
14+
if: github.repository == 'remix-run/remix'
15+
runs-on: ubuntu-latest
16+
env:
17+
CI: "true"
18+
GH_TOKEN: ${{ github.token }}
19+
steps:
20+
- name: ⬇️ Checkout repo
21+
uses: actions/checkout@v4
22+
23+
- name: 📦 Setup pnpm
24+
uses: pnpm/[email protected]
25+
26+
- name: ⎔ Setup node
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version-file: ".nvmrc"
30+
cache: "pnpm"
31+
32+
- name: 📥 Install deps
33+
run: pnpm install --frozen-lockfile
34+
35+
- name: 🚪 Close Issues
36+
run: node ./scripts/close-v2-issues.mjs --date ${{ github.event.inputs.prior_to_date }}

scripts/close-v2-issues-comment.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Thank you for opening this issue, and our apologies we haven't gotten around to it yet!
2+
3+
With the release of [React Router v7](https://remix.run/blog/react-router-v7) we are sun-setting continued development/maintenance on Remix v2. If you have not already [upgraded to React Router v7](https://reactrouter.com/upgrading/remix), we recommend you do so. We've tried to make the upgrade process as smooth as possible with our [Future Flags](https://remix.run/docs/en/main/start/future-flags). We are now in the process of cleaning up outdated issues and pull requests to improve the overall hygiene of our repositories.
4+
5+
We plan to continue to address 2 types of issues in Remix v2:
6+
7+
- Bugs that pose security concerns
8+
- Bugs that prevent upgrading to React Router v7
9+
10+
If you believe this issue meets one of those criteria, please respond or [create a new issue](https://github.com/remix-run/remix/issues/new?template=bug_report.yml).
11+
12+
For all other issues, ongoing maintenance will be happening in React Router v7, so:
13+
14+
- If this is a bug, please reopen this issue [in that repo](https://github.com/remix-run/react-router/issues/new?template=bug_report.yml) with a new [minimal reproduction](https://reactrouter.com/new) against v7
15+
- If this is a feature request, please open a new [Proposal Discussion](https://github.com/remix-run/react-router/discussions/new?category=proposals) in React Router, and if it gets enough community support it can be considered for implementation
16+
17+
If you have any questions you can always reach out on [Discord](https://rmx.as/discord). Thanks again for providing feedback and helping us make our framework even better!

scripts/close-v2-issues.mjs

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import { execSync } from "node:child_process";
2+
import { parseArgs } from "node:util";
3+
4+
const CI = process.env.CI === "true";
5+
6+
let oneYearAgo = new Date(Date.now() - 365 * 24 * 60 * 60 * 1000);
7+
8+
const { values: args } = parseArgs({
9+
options: {
10+
date: {
11+
type: "string",
12+
short: "d",
13+
default: new Date(oneYearAgo).toISOString().substring(0, 10),
14+
},
15+
},
16+
strict: true,
17+
});
18+
19+
if (!args.date || !/^\d{4}-\d{2}-\d{2}$/.test(args.date)) {
20+
console.error("Missing or invalid date - expected YYYY-MM-DD.");
21+
process.exit(1);
22+
} else {
23+
run();
24+
}
25+
26+
async function run() {
27+
/** @type {(ms: number) => Promise<void>} */
28+
let sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
29+
30+
/** @type {(q: string) => string} */
31+
let getIssuesCmd = (q) => `gh issue list --search "${q}" --json number`;
32+
33+
/** @type {(n: number) => string} */
34+
let getCommentCmd = (n) =>
35+
`gh issue comment ${n} -F ./scripts/close-v2-issues-comment.md`;
36+
37+
/** @type {(n: number) => string} */
38+
let getCloseCmd = (n) => `gh issue close ${n} -r "not planned"`;
39+
40+
let issueCmd = getIssuesCmd(`is:issue state:open updated:<${args.date}`);
41+
console.log(`Executing command: ${issueCmd}`);
42+
let result = execSync(issueCmd).toString();
43+
console.log(`Result: ${result}`);
44+
45+
let issues = JSON.parse(result).map((i) => i.number);
46+
if (issues.length > 50) {
47+
console.log("❌ Refusing to close more than 50 issues at once, exiting.");
48+
process.exit(1);
49+
}
50+
51+
console.log(`Parsed ${issues.length} issues`);
52+
53+
for (let issue of issues) {
54+
console.log(`--- Processing issue #${issue} ---`);
55+
let commentResult = runCmdIfTokenExists(getCommentCmd(issue));
56+
console.log(`Commented on issue #${issue}: ${commentResult}`);
57+
await sleep(250);
58+
59+
runCmdIfTokenExists(getCloseCmd(issue));
60+
// No log here since the GH CLI already logs for issue close
61+
await sleep(250);
62+
}
63+
64+
console.log("Done!");
65+
}
66+
67+
/**
68+
* @param {string} cmd
69+
* @return {string}
70+
*/
71+
function runCmdIfTokenExists(cmd) {
72+
if (CI) {
73+
console.log();
74+
return execSync(cmd).toString();
75+
} else {
76+
console.log(`⚠️ Local run, skipping command: ${cmd}`);
77+
return "<skipped>";
78+
}
79+
}

0 commit comments

Comments
 (0)