Fix previous commit

This commit is contained in:
garronej 2022-01-19 01:26:19 +01:00
parent 6c824d7c3c
commit 66b83c9642
3 changed files with 16 additions and 4 deletions

10
dist/index.js vendored
View file

@ -921,7 +921,10 @@ function action(_actionName, params, core) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
core.debug(JSON.stringify(params)); core.debug(JSON.stringify(params));
const { owner, repo } = params; const { owner, repo } = params;
const branch = params.branch.split("/").reverse()[0]; //params.branch <- github.head_ref || github.ref
//When it's a normal branch: github.head_ref==="" and github.ref==="refs/heads/main"
//When it's a pr from: github.head_ref==="<name of the branch branch>"
const branch = params.branch.replace(/^refs\/heads\//, "");
const npm_or_yarn = yield node_fetch_1.default(urlJoin("https://raw.github.com", owner, repo, branch, "yarn.lock")).then(res => res.status === 404 ? "npm" : "yarn"); const npm_or_yarn = yield node_fetch_1.default(urlJoin("https://raw.github.com", owner, repo, branch, "yarn.lock")).then(res => res.status === 404 ? "npm" : "yarn");
core.debug(`Version on ${owner}/${repo}#${branch} is using ${npm_or_yarn}`); core.debug(`Version on ${owner}/${repo}#${branch} is using ${npm_or_yarn}`);
return { npm_or_yarn }; return { npm_or_yarn };
@ -9168,7 +9171,10 @@ function action(_actionName, params, core) {
var _a; var _a;
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const { owner, repo, github_token } = params; const { owner, repo, github_token } = params;
const branch = params.branch.split("/").reverse()[0]; //params.branch <- github.head_ref || github.ref
//When it's a normal branch: github.head_ref==="" and github.ref==="refs/heads/main"
//When it's a pr from: github.head_ref==="<name of the branch branch>"
const branch = params.branch.replace(/^refs\/heads\//, "");
core.debug(`params: ${JSON.stringify(params)}`); core.debug(`params: ${JSON.stringify(params)}`);
const exclude_commit_from_author_names = JSON.parse(params.exclude_commit_from_author_names_json); const exclude_commit_from_author_names = JSON.parse(params.exclude_commit_from_author_names_json);
const octokit = createOctokit_1.createOctokit({ github_token }); const octokit = createOctokit_1.createOctokit({ github_token });

View file

@ -31,7 +31,10 @@ export async function action(
const { owner, repo } = params; const { owner, repo } = params;
const branch = params.branch.split("/").reverse()[0]; //params.branch <- github.head_ref || github.ref
//When it's a normal branch: github.head_ref==="" and github.ref==="refs/heads/main"
//When it's a pr from: github.head_ref==="<name of the branch branch>"
const branch = params.branch.replace(/^refs\/heads\//, "");
const npm_or_yarn = await fetch( const npm_or_yarn = await fetch(
urlJoin( urlJoin(

View file

@ -39,7 +39,10 @@ export async function action(
github_token github_token
} = params; } = params;
const branch = params.branch.split("/").reverse()[0]; //params.branch <- github.head_ref || github.ref
//When it's a normal branch: github.head_ref==="" and github.ref==="refs/heads/main"
//When it's a pr from: github.head_ref==="<name of the branch branch>"
const branch = params.branch.replace(/^refs\/heads\//, "");
core.debug(`params: ${JSON.stringify(params)}`); core.debug(`params: ${JSON.stringify(params)}`);