Skip to content

Commit e1c531c

Browse files
committed
feat: improve Jira PR sync workflow reliability
prevent infinite loops by skipping unchanged PR updates, and add trigger event logging for debugging Signed-off-by: Nir Argaman <nargaman@redhat.com>
1 parent 992a026 commit e1c531c

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

.github/workflows/jira-pr-sync.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ jobs:
4040
NO_TICKET_LABEL: ${{ inputs.no-ticket-label }}
4141
with:
4242
script: |
43+
// Log what triggered this workflow run
44+
const eventName = context.eventName;
45+
const action = context.payload.action;
46+
core.info(`🔍 Workflow triggered - Event: ${eventName}, Action: ${action}`);
47+
4348
const prBody = context.payload.pull_request.body || '';
4449
const prTitle = context.payload.pull_request.title || '';
4550
const prNumber = context.payload.pull_request.number;
@@ -205,6 +210,18 @@ jobs:
205210
updatedBody = prBody ? `${prBody}\n\n${newJiraSection}` : newJiraSection;
206211
}
207212
213+
// Only update PR if content actually changed
214+
// Normalize whitespace for comparison to avoid false positives
215+
const normalizedUpdated = updatedBody.trim().replace(/\s+/g, ' ');
216+
const normalizedCurrent = prBody.trim().replace(/\s+/g, ' ');
217+
218+
if (normalizedUpdated === normalizedCurrent) {
219+
core.info('✓ Jira links section is already up to date, no PR update needed');
220+
return;
221+
}
222+
223+
core.info('📝 Jira links section has changes, updating PR description');
224+
208225
// Update PR description
209226
await github.rest.pulls.update({
210227
owner: context.repo.owner,

0 commit comments

Comments
 (0)