Skip to content

Commit

Permalink
actually use the new flag
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisBrunner committed Dec 5, 2024
1 parent 3894bcb commit d0bf39d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ jobs:
title: Works (sticky)
notify_issue: true
notify_check: true
sticky_comment: true

test_output_sticky_notifs_bad:
name: 'Output (sticky notif, fails)'
Expand All @@ -468,3 +469,4 @@ jobs:
title: Fails (sticky)
notify_issue: true
notify_check: true
sticky_comment: true
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion fixtures/file1_basic.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ A
B
C
D
ABC
8 changes: 6 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as github from '@actions/github';
import fs from 'fs';
import {parseInputs} from './inputs';
import {processDiff} from './processing';
import {createRun, upsertComment} from './notifications';
import {createComment, createRun, upsertComment} from './notifications';

async function run(): Promise<void> {
try {
Expand All @@ -25,7 +25,11 @@ async function run(): Promise<void> {
core.debug(`Notification: Issue`);
const issueId = github.context.issue.number;
if (issueId || issueId === 0) {
await upsertComment(octokit, github.context, result, inputs.notifications.label);
if (inputs.notifications.sticky) {
await upsertComment(octokit, github.context, result, inputs.notifications.label);
} else {
await createComment(octokit, github.context, result, inputs.notifications.label);
}
} else {
core.debug(`Notification: no issue id`);
}
Expand Down
2 changes: 1 addition & 1 deletion src/notifications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ ${result.output}
${commentLocator(label)}`;
};

const createComment = async (
export const createComment = async (
octokit: InstanceType<typeof GitHub>,
context: Context,
result: Result,
Expand Down

0 comments on commit d0bf39d

Please sign in to comment.