Skip to content

Commit 209c4b1

Browse files
authored
Support workflow_dispatch (#17)
1 parent 303b347 commit 209c4b1

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

dist/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60799,15 +60799,15 @@ class GitHubBaseController {
6079960799
var _a, _b, _c, _d;
6080060800
this.action = github.context.action;
6080160801
this.actor = github.context.actor;
60802-
this.branch = (_a = github.context.payload.pull_request) === null || _a === void 0 ? void 0 : _a.head.ref;
60802+
this.branch = ((_a = github.context.payload.pull_request) === null || _a === void 0 ? void 0 : _a.head.ref) || github.context.ref;
6080360803
this.isMergeEvent =
6080460804
github.context.eventName === "pull_request" &&
6080560805
((_b = github.context.payload.pull_request) === null || _b === void 0 ? void 0 : _b.merged);
6080660806
this.pr = ((_c = github.context.payload.pull_request) === null || _c === void 0 ? void 0 : _c.number) || 0;
6080760807
this.repoOwner = github.context.repo.owner;
6080860808
this.ref = github.context.ref;
6080960809
this.repoName = github.context.repo.repo;
60810-
this.sha = (_d = github.context.payload.pull_request) === null || _d === void 0 ? void 0 : _d.head.sha;
60810+
this.sha = ((_d = github.context.payload.pull_request) === null || _d === void 0 ? void 0 : _d.head.sha) || github.context.sha;
6081160811
}
6081260812
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
6081360813
execute() {
@@ -62253,7 +62253,7 @@ class GetTerraformPlanUseCase {
6225362253
plan = yield this.planRepository.load(repoOwner, repoName, component, stack, metadata.commitSHA);
6225462254
}
6225562255
else {
62256-
// Non-merge commit, we're on the feature branch
62256+
// Non-merge commit, we're on the feature branch or workflow dispatch
6225762257
if (!commitSHA) {
6225862258
return (0, infrastructure_1.left)(new infrastructure_1.AppError.UnexpectedError("Commit is required for non-merge commits"));
6225962259
}

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/lib/infrastructure/githubBaseController.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ export abstract class GitHubBaseController implements IController {
1717
constructor() {
1818
this.action = github.context.action;
1919
this.actor = github.context.actor;
20-
this.branch = github.context.payload.pull_request?.head.ref;
20+
this.branch = github.context.payload.pull_request?.head.ref || github.context.ref;
2121
this.isMergeEvent =
2222
github.context.eventName === "pull_request" &&
2323
github.context.payload.pull_request?.merged;
2424
this.pr = github.context.payload.pull_request?.number || 0;
2525
this.repoOwner = github.context.repo.owner;
2626
this.ref = github.context.ref;
2727
this.repoName = github.context.repo.repo;
28-
this.sha = github.context.payload.pull_request?.head.sha;
28+
this.sha = github.context.payload.pull_request?.head.sha || github.context.sha;
2929
}
3030

3131
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars

src/useCases/getPlan/useCase.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export class GetTerraformPlanUseCase
9393
metadata.commitSHA
9494
);
9595
} else {
96-
// Non-merge commit, we're on the feature branch
96+
// Non-merge commit, we're on the feature branch or workflow dispatch
9797
if (!commitSHA) {
9898
return left(
9999
new AppError.UnexpectedError(

0 commit comments

Comments
 (0)