diff --git a/action.yml b/action.yml index 9044a9e..7ea5117 100644 --- a/action.yml +++ b/action.yml @@ -11,6 +11,10 @@ inputs: description: 'Base branch to compare current branch to' required: false default: 'main' + group: + description: 'Group will help isolate actions comments' + required: false + default: '' projects: description: 'List of :' required: true diff --git a/src/main.ts b/src/main.ts index c8e1bcc..ba01845 100644 --- a/src/main.ts +++ b/src/main.ts @@ -11,6 +11,7 @@ import { postMessage } from './postMessage' export async function run(): Promise { try { const baseBranch = core.getInput('base') || 'main' + const group = core.getInput('group') const commands = core.getInput('commands').split('\n') const github_token = core.getInput('token') const projects = core @@ -37,7 +38,7 @@ export async function run(): Promise { core.debug(`Computed coverage:\n${JSON.stringify(summaries)}`) - await postMessage(github_token, summaries) + await postMessage(github_token, summaries, group) } catch (error) { // Fail the workflow run if an error occurs if (error instanceof Error) core.setFailed(error.message) diff --git a/src/postMessage.ts b/src/postMessage.ts index bc0f233..e99707a 100644 --- a/src/postMessage.ts +++ b/src/postMessage.ts @@ -4,9 +4,16 @@ import { ProjectSummary } from './coverage' import { formatChangedCoverage, formatCoverageDetails } from './utils/format' import { sendMessage } from './utils/github' -const messageStart = ':ramen: Noodly Coverage! :ramen:\n' +const messageStartCreator = (group: string) => + `:ramen: Noodly Coverage${group === '' ? '' : ` for ${group}`}! :ramen:\n` -export async function postMessage(token: string, summaries: ProjectSummary[]) { +export async function postMessage( + token: string, + summaries: ProjectSummary[], + group: string +) { + const messageStart = messageStartCreator(group) + core.info('Formatting message') try { const body = `${messageStart}