Shared JS infra for automation across repos owned by the TypeScript team
Перейти к файлу
Jake Bailey f62fcc4bd4
Ignore translation bot user (#65)
2024-08-29 11:19:50 -07:00
.github Upload dist dir, not source (#62) 2024-07-17 10:31:34 -07:00
.vscode Adds the function app setup 2019-12-02 19:01:04 -05:00
fixtures Don't label closed PRs 2020-11-20 11:04:04 -08:00
functions Update deps, functions (#44) 2024-05-14 11:59:33 -07:00
scripts Improve logging hopefully 2020-01-22 10:17:35 -05:00
src Ignore translation bot user (#65) 2024-08-29 11:19:50 -07:00
.funcignore Adds the function app setup 2019-12-02 19:01:04 -05:00
.gitignore Remove sha from seeing changes 2020-01-22 10:10:07 -05:00
.knip.jsonc Update deps, functions (#44) 2024-05-14 11:59:33 -07:00
CODE_OF_CONDUCT.md Initial CODE_OF_CONDUCT.md commit 2019-12-02 14:43:58 -08:00
LICENSE Initial LICENSE commit 2019-12-02 14:43:59 -08:00
README.md Remove code which allows merging of PRs (#52) 2024-05-14 20:43:44 -07:00
SECURITY.md Initial SECURITY.md commit 2019-12-02 14:44:01 -08:00
host.json Update deps, functions (#44) 2024-05-14 11:59:33 -07:00
local.settings.json Adds the function app setup 2019-12-02 19:01:04 -05:00
package-lock.json Bump braces from 3.0.2 to 3.0.3 (#56) 2024-07-16 15:46:03 -07:00
package.json Remove code which allows merging of PRs (#52) 2024-05-14 20:43:44 -07:00
tsconfig.json Update deps, functions (#44) 2024-05-14 11:59:33 -07:00

README.md

Meta

  • State: In Production
  • Dashboard: Azure

Current Checks

Pull Requests

  • Adds a label for any new PR by a core team member
  • Assigns a core team member to their own PR if no-one is assigned

Issues

  • NOOP for now, but set up

Setup

This repo represents a single Azure "Function App" - which is an app which hosts many functions.

# Clone
git clone https://github.com/microsoft/TypeScript-repos-automation.git repos-automation
cd repos-automation
npm install

# Validate
npm test

You should mostly work according to tests from the src repo, but you can start the server by running:

npm start

To do this you need to have the Azure Functions Core Tools set up. Expect this install to take some time - it's the actual runtime used on the server in Azure.

Windows users:

npm install -g azure-functions-core-tools

Mac users:

brew tap azure/functions
brew install azure-functions-core-tools

Then you can use curl to send GitHub webhook JSON fixtures to the server:

curl -d "@fixtures/issues/created.json" -X POST http://localhost:7071/api/TypeScriptRepoIssueWebhook

While developing, you can use the createFakeGitHubClient to mock out the API with the responses you expect:

- import { createGitHubClient } from "./util/createGitHubClient";
+ import { createFakeGitHubClient } from "./util/tests/createMockGitHubClient";

export const handlePullRequestPayload = async (payload: WebhookPayloadPullRequest, context: Context) => {
-  const api = createGitHubClient();
+  const api = createGitHubClient();

  // Run checks
  await assignSelfToNewPullRequest(api, payload);

  context.res = {
    status: 200,
    body: "Success"
  };
};

Deployment

PR's are automatically deployed when merged via GitHub Actions. If you'd like to manually deploy, you can use npm run deploy. Note: a manual deploy will nuke your node_modules.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.