Skip to content

Commit fe4c1c5

Browse files
committed
Better dangerfile
1 parent edc89d3 commit fe4c1c5

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

dangerfile.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,23 @@ import { danger, message, markdown } from "danger"
55
// import { basename } from "path"
66
// import spellcheck from "danger-plugin-spellcheck"
77
import lighthouse from "danger-plugin-lighthouse"
8+
import { readFileSync } from "fs"
89

910
// Spell check all the things
1011
// spellcheck({ settings: "artsy/peril-settings@spellcheck.json" })
1112

12-
export default (webhook: any) => {
13-
console.log(webhook)
13+
export default () => {
14+
// JSON reference: https://github.com/haya14busa/github-actions-playground/runs/987846369
15+
const contextText = readFileSync(process.env.GITHUB_CONTEXT, "utf8")
16+
const context = JSON.parse(contextText)
17+
18+
const repo = { owner: context.event.repository.owner.login, repo: context.event.repository.name }
19+
const prNumber = context.event.workflow_run.pull_requests[0].number
20+
console.log(repo)
1421

1522
console.log(process.env.PR_DEPLOY_URL_ROOT)
1623

17-
const changedFiles = getChangedFiles(webhook.pull_request.number)
24+
const changedFiles = getChangedFiles(prNumber)
1825
console.log(changedFiles)
1926

2027
// Print out the PR url

0 commit comments

Comments
 (0)