Skip to content

Commit

Permalink
address code review
Browse files Browse the repository at this point in the history
  • Loading branch information
sandersn committed Jul 1, 2024
1 parent ec60553 commit f4e63f8
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 31 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ jobs:
run: TYPESCRIPT_BOT_TOKEN=secret node packages/mergebot/dist/functions/index.js

- name: Create zip
run: zip -r ${{ env.FUNCTION_ZIP_NAME }} packagaes/mergebot/dist packages/mergebot/host.json packages/mergebot/package.json
working-directory: packages/mergebot
run: zip -r ${{ env.GITHUB_WORKSPACE }}/${{ env.FUNCTION_ZIP_NAME }} dist host.json package.json

- name: Upload artifact for deployment job
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
Expand All @@ -57,6 +58,7 @@ jobs:
environment:
name: 'Production'
permissions:
contents: read
id-token: write

steps:
Expand Down
21 changes: 0 additions & 21 deletions packages/mergebot/LICENSE

This file was deleted.

3 changes: 2 additions & 1 deletion packages/mergebot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"main": "dist/functions/index.js",
"repository": {
"type": "git",
"url": "https://github.com/microsoft/definitelytyped-tools.git"
"url": "https://github.com/microsoft/definitelytyped-tools.git",
"directory": "packages/mergebot"
},
"bugs": {
"url": "https://github.com/microsoft/definitelytyped-tools/issues"
Expand Down
2 changes: 1 addition & 1 deletion packages/mergebot/src/_tests/fixturedActions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ expect.extend({ toMatchFile });

/* You can use the following command to add/update fixtures with an existing PR
*
* TYPESCRIPT_BOT_TOKEN=XYZ pnpm run create-fixture -- 43164
* BOT_AUTH_TOKEN=XYZ pnpm run create-fixture -- 43164
*/

async function testFixture(dir: string) {
Expand Down
2 changes: 1 addition & 1 deletion packages/mergebot/src/execute-pr-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ function doRestCall(call: RestMutation): Promise<void> {
const url = `https://api.github.com/repos/DefinitelyTyped/DefinitelyTyped/${call.op}`;
const headers = {
accept: "application/vnd.github.v3+json",
authorization: `token ${process.env.TYPESCRIPT_BOT_TOKEN}`,
authorization: `token ${process.env.BOT_AUTH_TOKEN}`,
"user-agent": "mergebot",
};
return new Promise((resolve, reject) => {
Expand Down
8 changes: 2 additions & 6 deletions packages/mergebot/src/graphql-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,9 @@ export function createMutation<T>(
function getAuthToken() {
if (process.env.JEST_WORKER_ID) return "FAKE_TOKEN";

const result =
process.env.BOT_AUTH_TOKEN ||
process.env.AUTH_TOKEN ||
process.env.DT_BOT_AUTH_TOKEN ||
process.env.TYPESCRIPT_BOT_TOKEN;
const result = process.env.BOT_AUTH_TOKEN || process.env.AUTH_TOKEN || process.env.DT_BOT_AUTH_TOKEN;
if (typeof result !== "string") {
throw new Error("Set either BOT_AUTH_TOKEN or TYPESCRIPT_BOT_TOKEN to a valid auth token");
throw new Error("Set BOT_AUTH_TOKEN or AUTH_TOKEN to a valid auth token");
}
return result.trim();
}

0 comments on commit f4e63f8

Please sign in to comment.