Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mergebot #1023

Merged
merged 16 commits into from
Jul 1, 2024
34 changes: 12 additions & 22 deletions packages/mergebot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ This is the bot that controls the workflow of Definitely Typed PRs.

## Meta


* __State:__ Production
* __Dashboard:__ [Azure](https://ms.portal.azure.com/#@72f988bf-86f1-41af-91ab-2d7cd011db47/resource/subscriptions/57bfeeed-c34a-4ffd-a06b-ccff27ac91b8/resourceGroups/dtmergebot/providers/Microsoft.Web/sites/DTMergeBot) — [Logs](https://ms.portal.azure.com/#blade/WebsitesExtension/FunctionsIFrameBlade/id/%2Fsubscriptions%2F57bfeeed-c34a-4ffd-a06b-ccff27ac91b8%2FresourceGroups%2Fdtmergebot%2Fproviders%2FMicrosoft.Web%2Fsites%2FDTMergeBot) — [GH Actions](https://github.com/DefinitelyTyped/dt-mergebot/actions) — [GH Webhook](https://github.com/DefinitelyTyped/DefinitelyTyped/settings/hooks/193097250)

Expand All @@ -13,15 +12,6 @@ It is both a series of command line scripts which you can use to test different
This repo is deployed to Azure on every push to master.
To ensure we can handle timeouts on older PRs, there is a [GitHub Action](https://github.com/DefinitelyTyped/dt-mergebot/actions) that runs the bot every 6 hours against [all open PRs](./src/run.ts), and has a bunch of useful flags for running manually too.

### Tasks for Moving to DT-tools

1. Update local tsconfig to use ../tsconfig-base
1. Update .knip settings with the actual entrypoint(s).
2. Check out the publish-on-push action Jake talked about.
3. Make sure name change from dt-mergebot to mergebot happens everywhere.
4. Log into Azure and make sure it's expecting uploads from the new repo.
5. Set up base *test* tsconfig.

# Setup

```sh
Expand All @@ -30,10 +20,10 @@ git clone https://github.com/DefinitelyTyped/dt-mergebot.git
cd dt-mergebot

# Deps
npm install
pnpm install

# Validate it works
npm test
pnpm test
```

# How the app works
Expand Down Expand Up @@ -70,12 +60,12 @@ Then to run locally you'll need to install the [Azure Functions cli](https://doc

```sh
# Build
npm run build
pnpm run build

# Run the CLI to see what would happen to an existing PR
npm run single-info -- [PR_NUM]
pnpm run single-info -- [PR_NUM]
# or
npm run single-info-debug -- [PR_NUM]
pnpm run single-info-debug -- [PR_NUM]
```

### If you update any queries
Expand All @@ -84,7 +74,7 @@ Run this to update the generate types:

```sh
# Code-gen the schema
npm run graphql-schema
pnpm run graphql-schema
```

### If you change project columns or labels
Expand All @@ -93,14 +83,14 @@ Run this to update the cached values:

```sh
# Regenerate src/_tests/cachedQueries.json
npm run update-test-data
pnpm run update-test-data
```

# Tests

```sh
# Run tests, TypeScript is transpiled at runtime
npm test
pnpm test
```

Most of the tests run against a fixtured PR, these are high level integration tests that store the PR info and then re-run the latter two phases of the app.
Expand All @@ -109,16 +99,16 @@ To create fixtures of a current PR:

```sh
# To create a fixture for PR 43161
npm run create-fixture -- 43161
pnpm run create-fixture -- 43161
```

Then you can work against these fixtures offline with:

```sh
# Watch mode for all tests
npm test -- --watch
pnpm test -- --watch
# Just run fixtures for one PR
npm test -- --testNamePattern 44299
pnpm test -- --testNamePattern 44299
```

Run a test with the debugger:
Expand All @@ -132,7 +122,7 @@ Then use "Attach to Process ID" to connect to that test runner
If your changes require re-creating all fixtures:

```sh
npm run update-all-fixtures
pnpm run update-all-fixtures
```

Be careful with this, because PRs may now be in a different state e.g. it's now merged and it used to be a specific
Expand Down
Loading
Loading