Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitAuto: Listen jira issue webhook event on this Jira Forge App #27

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions manifest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ modules:
- avi:forge:installed:app # Doesn't include un-installation
- avi:forge:upgraded:app

- key: jira-webhook-trigger
function: webhook
events:
- jira:issue_created
- jira:issue_updated
# The jira module provides functionality for Jira products.
jira:issuePanel:
- key: gitauto-jira-hello-world-issue-panel
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { handler } from './resolvers';
export { handler as webhookHandler } from './webhook';
8 changes: 8 additions & 0 deletions src/webhook.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import forge, { route } from "@forge/api";

export const handler = async (event, context) => {
import { webTrigger } from "@forge/events";
// https://developer.atlassian.com/platform/forge/events-reference/life-cycle/
console.log("Installation event payload:", event);
console.log("Context:", context);
Expand Down Expand Up @@ -60,6 +61,13 @@ export const handler = async (event, context) => {
} else if (event.eventType === "avi:forge:upgraded:app") {
console.log("App was upgraded!");
// Handle upgrade logic here
else if (event.webhookEvent) {
console.log("Received a webhook event:", event.webhookEvent);
// Process the webhook event here
// Example: if (event.webhookEvent === "jira:issue_created") { ... }
return { status: 200, body: "Webhook event processed" };
}

}

return { status: 200, body: "Installation event processed" };
Expand Down
Loading