feat(prd-6): verify workflow triggers and add assignee_trigger (#13)
This commit is contained in:
1 parent
095c2c2429
commit
a129a15f61
5 files changed
+71
-19
No files matched your search
+15
-1
@@ -60,6 +60,18 @@ const ENTITY_EVENT_NAMES = [
|
||||
"pull_request_review_comment",
|
||||
] as const;
|
||||
|
||||
/**
|
||||
* Forgejo uses different event names for some webhook events.
|
||||
* Normalize to GitHub-canonical names so all downstream code works unchanged.
|
||||
*/
|
||||
const FORGEJO_EVENT_NAME_MAP: Record<string, string> = {
|
||||
pull_request_comment: "pull_request_review_comment",
|
||||
};
|
||||
|
||||
function normalizeEventName(eventName: string): string {
|
||||
return FORGEJO_EVENT_NAME_MAP[eventName] ?? eventName;
|
||||
}
|
||||
|
||||
const AUTOMATION_EVENT_NAMES = [
|
||||
"workflow_dispatch",
|
||||
"repository_dispatch",
|
||||
@@ -132,6 +144,8 @@ export type GitHubContext = ParsedGitHubContext | AutomationContext;
|
||||
|
||||
export function parseGitHubContext(): GitHubContext {
|
||||
const context = github.context;
|
||||
// Normalize Forgejo event names to GitHub-canonical equivalents
|
||||
const eventName = normalizeEventName(context.eventName);
|
||||
|
||||
const commonFields = {
|
||||
runId: process.env.GITHUB_RUN_ID!,
|
||||
@@ -165,7 +179,7 @@ export function parseGitHubContext(): GitHubContext {
|
||||
},
|
||||
};
|
||||
|
||||
switch (context.eventName) {
|
||||
switch (eventName) {
|
||||
case "issues": {
|
||||
const payload = context.payload as IssuesEvent;
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user