-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The annotation describes FlyCI Wingman Action way of work and AI usage as well as it provides a feedback appeal.
- Loading branch information
Showing
3 changed files
with
29 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 [email protected].", | ||
{ | ||
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"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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,29 +46,36 @@ 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 [email protected].", | ||
{ | ||
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 () => { | ||
mockGetAccessToken.mockResolvedValueOnce(undefined); | ||
|
||
await run(); | ||
|
||
expect(mockSetFailed).toHaveBeenCalledExactlyOnceWith( | ||
expect(setFailed).toHaveBeenCalledExactlyOnceWith( | ||
'Wingman: Encountered an expected error "Unable to obtain Wingman access token"', | ||
); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,19 @@ | ||
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"; | ||
import { generateSuggestions } from "./suggestions"; | ||
|
||
export const run = async (): Promise<void> => { | ||
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 [email protected].", | ||
{ | ||
title: "FlyCI Wingman Notice", | ||
}, | ||
); | ||
info("Obtaining Wingman access token..."); | ||
const accessToken = await getAccessToken(); | ||
|
||
|