Added back the token in a usable way

This commit is contained in:
Auto Rebase
2025-01-09 13:53:58 +01:00
parent f61c87e29e
commit 36b21de9f3
3 changed files with 10 additions and 4 deletions

View File

@@ -12,6 +12,10 @@ inputs:
description: "The main branch to rebase on"
default: "dev"
required: false
ciToken:
description: Token to use
default: "${{ secrets.CI_TOKEN }}"
required: false
runs:
using: 'node20'

8
app.ts
View File

@@ -8,7 +8,9 @@ const IGNORED_BRANCHES: string[] = core.getInput('branchesToIgnore', { required:
const mainBranch: string = `origin/${ core.getInput('mainBranch', { required: false }) }`;
const { CI_TOKEN, GITHUB_SERVER_URL } = process.env;
const CI_TOKEN: string = core.getInput('ciToken', { required: false, trimWhitespace: true });
const { GITHUB_SERVER_URL } = process.env;
enum Action {
Rebase = 0,
@@ -214,7 +216,7 @@ const setupCIToken = async () => {
"origin"
]);
const httpLessUrl = remoteUrl.replace(/https?:\/\//, "");
const httpLessUrl = remoteUrl.trim().replace(/https?:\/\//, "");
const newUrl = `https://MilaBot:${ CI_TOKEN }@${ httpLessUrl }.git`;
await runGitCommand([
@@ -228,7 +230,7 @@ const setupCIToken = async () => {
"config",
"--local",
"--unset",
`http.https://${ GITHUB_SERVER_URL }/.extraheader`
`http.https://${ GITHUB_SERVER_URL.replace(/https?:\/\//, "") }/.extraheader`
]);
}

2
dist/app.js vendored

File diff suppressed because one or more lines are too long