Skip to content

Commit a916977

Browse files
authored
Add repo migration notice workflows (#3127)
# Description of Changes Added a repo migration notice workflow to each repository that we've merged into SpacetimeDB. These need to be mirrored back to the actual repos with a process like: ```bash git subtree split --prefix=sdks/typescript -b release/typescript git push -f [email protected]:clockworklabs/spacetimedb-typescript-sdk.git release/typescript:main git branch -D release/typescript ``` Once they're migrated there, the bot will automatically comment on any PR or issue opened in those repos. # API and ABI breaking changes None. CI-only changes. # Expected complexity level and risk 2 # Testing - [x] In a demo repo, it properly commented and closed a PR: clockworklabs/github-tooling-test#42 - [x] In a demo repo, it properly commented and closed an issue: clockworklabs/github-tooling-test#43 --------- Co-authored-by: Zeke Foppa <[email protected]>
1 parent 261145c commit a916977

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Repo migration notice
2+
3+
on:
4+
issues:
5+
types: [opened]
6+
pull_request:
7+
types: [opened]
8+
9+
jobs:
10+
comment:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Add comment
15+
uses: actions/github-script@v7
16+
env:
17+
migrated_repo: https://github.com/ClockworkLabs/SpacetimeDB
18+
migrated_path: sdks/csharp
19+
default_branch: release/latest
20+
with:
21+
script: |
22+
const isPR = context.eventName === 'pull_request';
23+
const number = isPR ? context.payload.pull_request.number : context.payload.issue.number;
24+
25+
let message;
26+
if (isPR) {
27+
message = `
28+
Thank you for submitting this!
29+
30+
We are in the process of migrating this repository (see [DEVELOP.md](../blob/${process.env.default_branch}/DEVELOP.md)).
31+
32+
To make sure we see your PR, please open it in the [SpacetimeDB](${process.env.migrated_repo}) repo, under [${process.env.migrated_path}](${process.env.migrated_repo}/tree/master/${process.env.migrated_path}).
33+
34+
Apologies for the inconvenience, and thank you again!
35+
`;
36+
} else {
37+
message = `
38+
Thank you for submitting this!
39+
40+
We are in the process of migrating this repository (see [DEVELOP.md](../blob/${process.env.default_branch}/DEVELOP.md)).
41+
42+
To make sure we actually see your issue, please open it here: [SpacetimeDB/issues/new](${process.env.migrated_repo}/issues/new).
43+
44+
Apologies for the inconvenience, and thank you again!
45+
`;
46+
}
47+
48+
await github.rest.issues.createComment({
49+
owner: context.repo.owner,
50+
repo: context.repo.repo,
51+
issue_number: number,
52+
body: message
53+
});
54+
55+
await github.rest.issues.update({
56+
owner: context.repo.owner,
57+
repo: context.repo.repo,
58+
issue_number: number,
59+
state: 'closed'
60+
});

0 commit comments

Comments
 (0)