Skip to content

Commit 148a05c

Browse files
committed
ci/github-script/{bot,merge,reviewers}: convert to TypeScript
Assisted-by: gpt-6.1-sol (Codex, light)
1 parent 5776233 commit 148a05c

10 files changed

Lines changed: 264 additions & 116 deletions

File tree

‎.github/workflows/bot.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ jobs:
7676
github-token: ${{ steps.app-token.outputs.token || github.token }}
7777
retries: 3
7878
script: |
79-
const { default: bot } = await import('${{ github.workspace }}/ci/github-script/bot.js')
79+
const { default: bot } = await import('${{ github.workspace }}/ci/github-script/bot.ts')
8080
await bot({
8181
github,
8282
context,

‎.github/workflows/comment.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
github-token: ${{ steps.app-token.outputs.token || github.token }}
4444
retries: 3
4545
script: |
46-
const { handleMergeComment } = await import('${{ github.workspace }}/ci/github-script/merge.js')
46+
const { handleMergeComment } = await import('${{ github.workspace }}/ci/github-script/merge.ts')
4747
const { body, node_id } = context.payload.comment
4848
4949
await handleMergeComment({

‎.github/workflows/review.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
github-token: ${{ steps.app-token.outputs.token || github.token }}
4141
retries: 3
4242
script: |
43-
const { handleMergeComment } = await import('${{ github.workspace }}/ci/github-script/merge.js')
43+
const { handleMergeComment } = await import('${{ github.workspace }}/ci/github-script/merge.ts')
4444
4545
// PRs from forks don't have any PRs associated by default.
4646
// Thus, we request the PR number with an API call *to* the fork's repo.

‎.github/workflows/test.yml‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,18 @@ jobs:
7979
'.github/workflows/lint.yml',
8080
'.github/workflows/pull-request-target.yml',
8181
'.github/workflows/test.yml',
82-
'ci/github-script/bot.js',
82+
'ci/github-script/bot.ts',
8383
'ci/github-script/check-target-branch.ts',
8484
'ci/github-script/commits.ts',
8585
'ci/github-script/get-pr-commit-details.ts',
8686
'ci/github-script/lint-commits.ts',
8787
'ci/github-script/manual-file-edits.ts',
88-
'ci/github-script/merge.js',
88+
'ci/github-script/merge.ts',
8989
'ci/github-script/package.json',
9090
'ci/github-script/package-lock.json',
9191
'ci/github-script/prepare.ts',
9292
'ci/github-script/reminders.ts',
93-
'ci/github-script/reviewers.js',
93+
'ci/github-script/reviewers.ts',
9494
'ci/github-script/reviews.ts',
9595
'ci/github-script/supportedBranches.ts',
9696
'ci/github-script/supportedSystems.ts',

‎ci/README.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@ Run [`update-pinned.sh`](./update-pinned.sh) to update it.
1313
## GitHub specific code
1414

1515
Some of the code is specific to GitHub.
16-
This code is currently spread out over multiple places and written in both Bash and JavaScript.
17-
The goal is to eventually have all GitHub specific code in `ci/github-script` and written in JavaScript via `actions/github-script`.
16+
This code is currently spread out over multiple places and written in both Bash and TypeScript.
17+
The goal is to eventually have all GitHub specific code in `ci/github-script` and written in TypeScript via `actions/github-script`.
1818
A lot of code has already been migrated, but some Bash code still remains.
19-
New CI features need to be introduced in JavaScript, not Bash.
19+
New CI features need to be introduced in TypeScript, not Bash.
2020

2121
## Nixpkgs merge bot
2222

2323
The Nixpkgs merge bot empowers package maintainers by enabling them to merge PRs related to their own packages.
2424
It serves as a bridge for maintainers to quickly respond to user feedback, facilitating a more self-reliant approach.
2525
Especially when considering there are roughly 20 maintainers for every committer, this bot is a game-changer.
2626

27-
Following [RFC 172], the merge bot was originally implemented as a [python webapp](https://github.com/NixOS/nixpkgs-merge-bot), which has now been integrated into [`ci/github-script/bot.js`](./github-script/bot.js) and [`ci/github-script/merge.js`](./github-script/merge.js).
27+
Following [RFC 172], the merge bot was originally implemented as a [python webapp](https://github.com/NixOS/nixpkgs-merge-bot), which has now been integrated into [`ci/github-script/bot.ts`](./github-script/bot.ts) and [`ci/github-script/merge.ts`](./github-script/merge.ts).
2828

2929
### Using the merge bot
3030

‎ci/github-script/README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# GitHub specific CI scripts
22

3-
This folder contains [`actions/github-script`](https://github.com/actions/github-script)-based JavaScript code.
3+
This folder contains [`actions/github-script`](https://github.com/actions/github-script)-based TypeScript code.
44
It provides a `nix-shell` environment to run and test these actions locally.
55

66
To run any of the scripts locally:
@@ -20,4 +20,4 @@ Run `./run labels OWNER REPO`, where OWNER is your username or "NixOS" and REPO
2020

2121
Run `./run reminders OWNER REPO PR` to post the reminders that apply to the paths a pull request touches.
2222

23-
To add a reminder, write the review body to `reminders/KEY.md` and list KEY with its path regexes in `reminders.js`.
23+
To add a reminder, write the review body to `reminders/KEY.md` and list KEY with its path regexes in `reminders.ts`.

0 commit comments

Comments
 (0)