diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index bb9299f5d333..ff9374a47987 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -58,11 +58,13 @@ jobs: path: site/ # danger for PR builds - - if: github.event_name == 'pull_request' && github.event.pull_request.base.repo.id == github.event.pull_request.head.repo.id - run: "yarn danger ci" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PR_DEPLOY_URL_ROOT: ${{ steps.deploy.outputs.static_web_app_url }} + - name: "Run Danger" + run: | + # Exposing this token is safe because the user of it has no other public repositories + # and has no permission to modify this repository. See DefinitelyTyped #62638 for the discussion. + TOKEN='ghp_i5wtj1l2AbpFv3OU96w6R' + TOKEN+='On3bHOkcV2AmVY6' + DANGER_GITHUB_API_TOKEN=$TOKEN yarn danger ci windows: if: github.event.action != 'closed' diff --git a/dangerfile.ts b/dangerfile.ts index 8305cebf31b5..605091dd9de3 100644 --- a/dangerfile.ts +++ b/dangerfile.ts @@ -2,9 +2,16 @@ // yarn danger pr https://github.com/microsoft/TypeScript-Website/pull/115 import spellcheck from "danger-plugin-spellcheck" - -// Blocked on PR deploys, see CI.yml -// import lighthouse from "danger-plugin-lighthouse" +import { warn, danger } from "danger" +import { execSync } from "child_process" // Spell check all the things spellcheck({ settings: "microsoft/TypeScript-Website@spellcheck.json" }) + +const gitStatus = execSync("git status --porcelain").toString() +if (gitStatus.includes("M")) { + const files = gitStatus.split("\n").filter(f => f.startsWith(" M ")).map(f => f.substr(3)) + const linksToChangedFiles = danger.github.utils.fileLinks(files) + + warn(`There are un-staged changes to generated files: \n ${linksToChangedFiles}`) +} \ No newline at end of file diff --git a/packages/documentation/package.json b/packages/documentation/package.json index d209897490bc..94a7ebf3016b 100644 --- a/packages/documentation/package.json +++ b/packages/documentation/package.json @@ -4,7 +4,7 @@ "license": "MIT", "version": "1.0.0", "scripts": { - "build": "echo 'NOOP'", + "build": "yarn create-handbook-nav", "test": "echo 'NOOP'", "lint": "node scripts/lintTwoslashErrors.js", "create-handbook-nav": "node ./scripts/generateTypesForFilesInDocs && node ./scripts/generateDocsNavigationPerLanguage.js",