Skip to content

Commit ee1e0cc

Browse files
committed
docs: update README to include detailed usage and features for copy-discussions.js
1 parent b280310 commit ee1e0cc

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

scripts/README.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,45 @@ Configuration values to change in the script:
3232
- `gitEmail` = If using a GitHub App, combine the App's user ID (⚠️ this is different than App ID!) and name to form an email like: `149130343+josh-issueops-bot[bot]@users.noreply.github.com`. You can find the App's user ID number by calling: `gh api '/users/josh-issueops-bot[bot]' --jq .id`
3333
- `overwrite`: use `false` or `true` on whether it should overwrite the existing `dependabot.yml` file
3434

35-
## ado-workitems-to-github-issues.ps1
35+
## copy-discussions.js
36+
37+
Copy GitHub Discussions between repositories, including categories, labels, comments, and replies. This script can copy discussions across different GitHub instances and enterprises.
38+
39+
The script is expecting:
40+
41+
- environment variables `SOURCE_TOKEN` and `TARGET_TOKEN` with GitHub PATs that have `repo` and `read:discussion` scopes
42+
- dependencies installed via `npm i octokit`
43+
44+
Script usage:
45+
46+
```bash
47+
export SOURCE_TOKEN=ghp_abc
48+
export TARGET_TOKEN=ghp_xyz
49+
npm i octokit
50+
node ./copy-discussions.js source-org source-repo target-org target-repo
51+
```
52+
53+
Features:
54+
55+
- Automatically creates missing discussion categories in the target repository
56+
- Creates labels in the target repository if they don't exist
57+
- Copies all comments and threaded replies with proper attribution
58+
- Copies poll results as static snapshots (with table and optional Mermaid chart)
59+
- Handles rate limiting with exponential backoff
60+
- Provides colored console output for better visibility
61+
62+
Configuration:
63+
64+
- Set `INCLUDE_POLL_MERMAID_CHART = false` at the top of the script to disable Mermaid pie charts for polls
65+
66+
Notes:
67+
68+
- If a category doesn't exist in the target repository, discussions will be created in the "General" category
69+
- The script preserves discussion metadata by adding attribution text to the body and comments
70+
- Poll results are copied as static snapshots - voting is not available in copied discussions
71+
- Both source and target repositories must have GitHub Discussions enabled
72+
73+
## delete-branch-protection-rules.ps1
3674

3775
Migrate work items from Azure DevOps to GitHub issues - this just links out to a [separate repo](https://github.com/joshjohanning/ado_workitems_to_github_issues)
3876

0 commit comments

Comments
 (0)