ignoreSelf: true
not stopping trigger loop
Hi everyone,
I’m trying to use ignoreSelf: true
to stop my function from triggering itself, but I’m getting stuck in a recursive loop. My function updates an issue, which then seems to trigger the function all over again. In the example below I have edited the update so it only updates for certain summaries to avoid a loop, but shouldn’t ignoreSelf be doing that? (I’m seeing the
Updated ${event.issue.key}
message after the update).
manifest.yml
modules:
trigger:
- key: forge-issue-updated-event-hello-world
function: main
events:
- avi:jira:updated:issue
filter:
ignoreSelf: true
expression: event.issue.fields.summary != null
function:
- key: main
handler: index.run
permissions:
scopes:
- read:jira-work
- write:jira-work
app:
runtime:
name: nodejs22.x
memoryMB: 256
architecture: arm64
id: ari:cloud:ecosystem::app/c3dd15fc-5b8c-465a-83f2-fba0f4f1ad44
src/index.jsx
import api, { route } from "@forge/api";
export async function run(event, context) {
console.log(`Updated ${event.issue.key}`);
if (event.issue.fields.summary == "Test Issue") {
// update the issue summary to Test Issue Updated
const response = await api
.asApp()
.requestJira(route`/rest/api/3/issue/${event.issue.id}`, {
method: "PUT",
body: JSON.stringify({
fields: {
summary: "Test Issue Updated",
},
}),
headers: {
"Content-Type": "application/json",
},
});
if (response.ok) {
console.log("Issue updated successfully");
} else {
console.error("Failed to update issue:", response.statusText);
}
}
}