Skip to content

Commit

Permalink
feat: warn about unknown experimental input
Browse files Browse the repository at this point in the history
When the user specifies unknown properties in the experimental input,
then we should inform them about it. It does not have to stop the action
from working, but a logged warning makes sense.
  • Loading branch information
korthout committed Dec 2, 2023
1 parent d2a12a7 commit 2d809b5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Backport, Config, experimentalDefaults } from "./backport";
import { Github } from "./github";
import { Git } from "./git";
import { execa } from "execa";
import dedent from "dedent";

/**
* Called from the action.yml.
Expand Down Expand Up @@ -30,6 +31,14 @@ async function run(): Promise<void> {
return;
}

for (const key in experimental) {
if (!(key in experimentalDefaults)) {
console.warn(dedent`Encountered unexpected key in input 'experimental'.\
No experimental config options known for key '${key}'.\
Please check the documentation for details about experimental features.`);
}
}

const github = new Github(token);
const git = new Git(execa);
const config: Config = {
Expand Down

0 comments on commit 2d809b5

Please sign in to comment.