Skip to content

Commit

Permalink
logs
Browse files Browse the repository at this point in the history
  • Loading branch information
jcbhmr committed Aug 17, 2023
1 parent 82c8418 commit 3eacfa7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,21 @@ core.setOutput("features", JSON.stringify(features))

const ref = core.getInput("ref")
const event = JSON.parse(process.env.GITHUB_EVENT)
console.log(event)

let baseRef: string | undefined
if (event.name === "pull_request") {
baseRef = event.pull_request.base.sha
} else if (event.name === "push") {
baseRef = event.before
}
console.log(baseRef)

let changedFeatures: any[]
if (baseRef) {
const changedFiles = (await $`git diff --name-only ${baseRef} ${ref}`).toString().split(/\r?\n/g)
console.log(changedFiles)

const changedIds = changedFiles.map(x => /src\/(.*?)\//.match(x)?.[1]).filter(x => x)
changedFeatures = (await Promise.all(
changedIds.map(x => readFile(`src/${id}/devcontainer-feature.json`, "utf8")
Expand All @@ -44,5 +49,6 @@ if (baseRef) {
} else {
changedFeatures = []
}
console.log(changedFeatures)

core.setOutput("changed-features", JSON.stringify(changedFeatures))

0 comments on commit 3eacfa7

Please sign in to comment.