Skip to content

Commit

Permalink
Merge pull request #1 from devcontainers-community/test-pr
Browse files Browse the repository at this point in the history
  • Loading branch information
jcbhmr committed Aug 17, 2023
2 parents fd68c1c + f63e567 commit c00c854
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
11 changes: 8 additions & 3 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,26 @@ const eventName = process.env.GITHUB_EVENT_NAME;
const event = JSON.parse(process.env.GITHUB_EVENT);
console.log("event", event);

// BEFORE
let baseRef = core.getInput("base_ref");
if (!baseRef) {
if (eventName === "push") {
baseRef = event.before;
} else if (eventName === "pull_request") {
baseRef = event.pull_request.base.sha;
}
}
console.log("before", baseRef);

// AFTER
let ref = core.getInput("ref");
if (!ref) {
if (eventName === "push") {
ref = event.after;
} else if (eventName === "pull_request") {
ref = event.pull_request.head.sha;
}
}

console.log("before", baseRef);
console.log("after", ref);

let changedFeatures: any[];
Expand All @@ -52,7 +57,7 @@ if (baseRef) {
changedFeatures = (
await Promise.all(
changedIds.map((x) =>
readFile(`src/${id}/devcontainer-feature.json`, "utf8").catch(() => {})
readFile(`src/${x}/devcontainer-feature.json`, "utf8").catch(() => {})
)
)
)
Expand Down
3 changes: 2 additions & 1 deletion test/src/a/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"id": "a"
"id": "a",
"changeMe": 1
}

0 comments on commit c00c854

Please sign in to comment.