diff --git a/dist/index.js b/dist/index.js index c3941b7..07f3260 100644 --- a/dist/index.js +++ b/dist/index.js @@ -18899,10 +18899,10 @@ Support boolean input list: \`true | True | TRUE | false | False | FALSE\``); command_1.issueCommand("warning", utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); } exports2.warning = warning; - function notice(message, properties = {}) { + function notice2(message, properties = {}) { command_1.issueCommand("notice", utils_1.toCommandProperties(properties), message instanceof Error ? message.toString() : message); } - exports2.notice = notice; + exports2.notice = notice2; function info2(message) { process.stdout.write(message + os2.EOL); } @@ -22082,6 +22082,12 @@ var generateSuggestions = async (accessToken, wingmanResultPath) => { // src/action.ts var run = async () => { try { + (0, import_core.notice)( + "FlyCI Wingman Action uses a generative AI to fix your build errors by creating suggestions to your pull requests. Join our Discord Community at https://discord.com/invite/JyCjh439da to get help, request features, and share feedback. Alternatively, send us an email at support@flyci.net.", + { + title: "FlyCI Wingman Notice" + } + ); (0, import_core.info)("Obtaining Wingman access token..."); const accessToken = await getAccessToken(); (0, import_node_assert4.default)(accessToken, "Unable to obtain Wingman access token"); diff --git a/src/__tests__/action.test.ts b/src/__tests__/action.test.ts index 28822ed..daf2fe2 100644 --- a/src/__tests__/action.test.ts +++ b/src/__tests__/action.test.ts @@ -1,4 +1,4 @@ -import { setSecret, info, setFailed } from "@actions/core"; +import { setSecret, info, setFailed, notice } from "@actions/core"; import { getAccessToken } from "../utils"; import { generateSuggestions } from "../suggestions"; @@ -9,6 +9,7 @@ jest.mock("@actions/core", () => ({ info: jest.fn(), setFailed: jest.fn(), setSecret: jest.fn(), + notice: jest.fn(), })); jest.mock("../wingman", () => ({ @@ -27,10 +28,6 @@ jest.mock("../suggestions", () => ({ describe("wingman action run", () => { const mockGetAccessToken = getAccessToken as jest.Mock; - const mockGenerateSuggestions = generateSuggestions as jest.Mock; - const mockSetSecret = setSecret as jest.Mock; - const mockInfo = info as jest.Mock; - const mockSetFailed = setFailed as jest.Mock; const mockDownloadWingmanClient = WingmanClient.download as jest.Mock; const mockWingmanRun = jest.fn(); @@ -49,21 +46,28 @@ describe("wingman action run", () => { await run(); + expect(notice).toHaveBeenCalledExactlyOnceWith( + "FlyCI Wingman Action uses a generative AI to fix your build errors by creating suggestions to your pull requests. Join our Discord Community at https://discord.com/invite/JyCjh439da to get help, request features, and share feedback. Alternatively, send us an email at support@flyci.net.", + { + title: "FlyCI Wingman Notice", + }, + ); + expect(mockGetAccessToken).toHaveBeenCalledOnce(); - expect(mockSetSecret).toHaveBeenCalledAfter(mockGetAccessToken); - expect(mockSetSecret).toHaveBeenCalledExactlyOnceWith(accessToken); + expect(setSecret).toHaveBeenCalledAfter(mockGetAccessToken); + expect(setSecret).toHaveBeenCalledExactlyOnceWith(accessToken); expect(mockDownloadWingmanClient).toHaveBeenCalledExactlyOnceWith( accessToken, ); - expect(mockGenerateSuggestions).toHaveBeenCalledExactlyOnceWith( + expect(generateSuggestions).toHaveBeenCalledExactlyOnceWith( accessToken, resultFilePath, ); - expect(mockInfo).toHaveBeenLastCalledWith("Success!"); + expect(info).toHaveBeenLastCalledWith("Success!"); }); it("when unable to obtain access token should set action as failed", async () => { @@ -71,7 +75,7 @@ describe("wingman action run", () => { await run(); - expect(mockSetFailed).toHaveBeenCalledExactlyOnceWith( + expect(setFailed).toHaveBeenCalledExactlyOnceWith( 'Wingman: Encountered an expected error "Unable to obtain Wingman access token"', ); }); diff --git a/src/action.ts b/src/action.ts index ce2e97f..0c30208 100644 --- a/src/action.ts +++ b/src/action.ts @@ -1,6 +1,6 @@ import assert from "node:assert"; -import { info, setFailed, setSecret } from "@actions/core"; +import { info, setFailed, setSecret, notice } from "@actions/core"; import { WingmanClient } from "./wingman"; import { getAccessToken } from "./utils"; @@ -8,6 +8,12 @@ import { generateSuggestions } from "./suggestions"; export const run = async (): Promise => { try { + notice( + "FlyCI Wingman Action uses a generative AI to fix your build errors by creating suggestions to your pull requests. Join our Discord Community at https://discord.com/invite/JyCjh439da to get help, request features, and share feedback. Alternatively, send us an email at support@flyci.net.", + { + title: "FlyCI Wingman Notice", + }, + ); info("Obtaining Wingman access token..."); const accessToken = await getAccessToken();