7b1d2aef87
Fixes #57 This PR implements the 3-step plan proposed by @gr2m in https://github.com/actions/create-github-app-token/issues/57#issuecomment-1751272252: > 1. Support both input types > 2. Log a deprecation warning for the old notation > 3. Add a test for deprecations Although this PR supports both input formats simultaneously, I opted _not_ to document the old format in the updated README. That’s a decision I’m happy to revisit, if y’all would prefer to have documentation for both the old and new formats.
30 lines
921 B
JavaScript
30 lines
921 B
JavaScript
import { MockAgent, setGlobalDispatcher } from "undici";
|
|
|
|
// state variables are set as environment variables with the prefix STATE_
|
|
// https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#sending-values-to-the-pre-and-post-actions
|
|
process.env.STATE_token = "secret123";
|
|
|
|
// inputs are set as environment variables with the prefix INPUT_
|
|
// https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#example-specifying-inputs
|
|
process.env["INPUT_SKIP-TOKEN-REVOKE"] = "true";
|
|
|
|
const mockAgent = new MockAgent();
|
|
|
|
setGlobalDispatcher(mockAgent);
|
|
|
|
// Provide the base url to the request
|
|
const mockPool = mockAgent.get("https://api.github.com");
|
|
|
|
// intercept the request
|
|
mockPool
|
|
.intercept({
|
|
path: "/installation/token",
|
|
method: "DELETE",
|
|
headers: {
|
|
authorization: "token secret123",
|
|
},
|
|
})
|
|
.reply(204);
|
|
|
|
await import("../post.js");
|