9 Commits

Author SHA1 Message Date
5e336bf8e3 fix(ci): Docker is missing in small/medium act runners
Some checks failed
Auto-merge Dependabot / automerge (pull_request) Has been skipped
CI / build (pull_request) Failing after 2m14s
CI / test (built) (pull_request) Has been skipped
CI / test (committed) (pull_request) Has been skipped
CI / commentTestSuiteHelp (pull_request) Has been skipped
CI / package (pull_request) Has been skipped
2025-03-25 16:41:55 -04:00
aa035fd851 adjust ERROR_PR_ALREADY_EXISTS based on updated failure message
Some checks failed
CI / build (push) Failing after 4m14s
CI / test (built) (push) Has been skipped
CI / test (committed) (push) Has been skipped
CI / commentTestSuiteHelp (push) Has been skipped
CI / package (push) Has been skipped
Rebase Upstream / sync (push) Successful in 32s
Uses below error message as a basis:

Create or update the pull request
Attempting creation of pull request
::error::pull request already exists for these targets [id: 30, issue_id: 27, head_repo_id: 1, base_repo_id: 1, head_branch: update-flake-lock, base_branch: main]
2025-03-04 09:42:42 -05:00
6b3a86bf8b CI
Some checks failed
CI / build (push) Failing after 45s
CI / test (built) (push) Has been skipped
CI / test (committed) (push) Has been skipped
CI / commentTestSuiteHelp (push) Has been skipped
CI / package (push) Has been skipped
Rebase Upstream / sync (push) Failing after 8s
Signed-off-by: ahuston-0 <aliceghuston@gmail.com>
2025-02-01 16:27:43 -05:00
afa1190aa1 format determineApiUrl code
Some checks failed
CI / build (push) Failing after 40s
CI / test (built) (push) Has been skipped
CI / test (committed) (push) Has been skipped
CI / commentTestSuiteHelp (push) Has been skipped
CI / package (push) Has been skipped
Signed-off-by: ahuston-0 <aliceghuston@gmail.com>
2025-02-01 16:01:59 -05:00
7741a3efa3 move to working folder
Some checks failed
CI / test (built) (push) Has been skipped
CI / build (push) Failing after 1m5s
CI / test (committed) (push) Has been skipped
CI / commentTestSuiteHelp (push) Has been skipped
CI / package (push) Has been skipped
Signed-off-by: ahuston-0 <aliceghuston@gmail.com>
2025-02-01 15:55:58 -05:00
3adf2066c5 add upstream sync
Signed-off-by: ahuston-0 <aliceghuston@gmail.com>
2025-02-01 15:55:58 -05:00
686c3a0061 chore: Build 2025-02-01 15:55:58 -05:00
6218c872ac feat: Handle API URLs for Forgejo, Gitea, GitLab and GitHub 2025-02-01 15:55:58 -05:00
1f2b960401 fix: Use the v1 api as v3 is not available on Forgejo. 2025-02-01 15:55:58 -05:00
13 changed files with 655 additions and 1814 deletions

View File

@ -24,6 +24,8 @@ jobs:
with: with:
node-version: 20.x node-version: 20.x
cache: npm cache: npm
- name: Install Docker
run: apt update && apt install docker.io -y
- run: npm ci - run: npm ci
- run: npm run build - run: npm run build
- run: npm run format-check - run: npm run format-check

View File

@ -29,8 +29,8 @@ jobs:
labels: | labels: |
report report
automated pr automated pr
assignees: retepsnave assignees: peter-evans
reviewers: retepsnave reviewers: peter-evans
milestone: 1 milestone: 1
draft: false draft: false
branch: example-patches branch: example-patches

View File

@ -18,6 +18,12 @@ jobs:
"repository": "peter-evans/create-pull-request-tests", "repository": "peter-evans/create-pull-request-tests",
"named_args": true "named_args": true
}, },
{
"command": "testv5",
"permission": "admin",
"repository": "peter-evans/create-pull-request-tests",
"named_args": true
},
{ {
"command": "clean", "command": "clean",
"permission": "admin", "permission": "admin",

View File

@ -53,7 +53,7 @@ All inputs are **optional**. If not set, sensible defaults will be used.
| `token` | The token that the action will use to create and update the pull request. See [token](#token). | `GITHUB_TOKEN` | | `token` | The token that the action will use to create and update the pull request. See [token](#token). | `GITHUB_TOKEN` |
| `branch-token` | The token that the action will use to create and update the branch. See [branch-token](#branch-token). | Defaults to the value of `token` | | `branch-token` | The token that the action will use to create and update the branch. See [branch-token](#branch-token). | Defaults to the value of `token` |
| `path` | Relative path under `GITHUB_WORKSPACE` to the repository. | `GITHUB_WORKSPACE` | | `path` | Relative path under `GITHUB_WORKSPACE` to the repository. | `GITHUB_WORKSPACE` |
| `add-paths` | A comma or newline-separated list of file paths to commit. Paths should follow git's [pathspec](https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefpathspecapathspec) syntax. See [Add specific paths](#add-specific-paths). | If no paths are specified, all new and modified files are added. | | `add-paths` | A comma or newline-separated list of file paths to commit. Paths should follow git's [pathspec](https://git-scm.com/docs/gitglossary#Documentation/gitglossary.txt-aiddefpathspecapathspec) syntax. If no paths are specified, all new and modified files are added. See [Add specific paths](#add-specific-paths). | |
| `commit-message` | The message to use when committing changes. See [commit-message](#commit-message). | `[create-pull-request] automated change` | | `commit-message` | The message to use when committing changes. See [commit-message](#commit-message). | `[create-pull-request] automated change` |
| `committer` | The committer name and email address in the format `Display Name <email@address.com>`. Defaults to the GitHub Actions bot user on github.com. | `github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>` | | `committer` | The committer name and email address in the format `Display Name <email@address.com>`. Defaults to the GitHub Actions bot user on github.com. | `github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>` |
| `author` | The author name and email address in the format `Display Name <email@address.com>`. Defaults to the user who triggered the workflow run. | `${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com>` | | `author` | The author name and email address in the format `Display Name <email@address.com>`. Defaults to the user who triggered the workflow run. | `${{ github.actor }} <${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com>` |

486
dist/index.js vendored
View File

@ -67,7 +67,7 @@ var WorkingBaseType;
})(WorkingBaseType || (exports.WorkingBaseType = WorkingBaseType = {})); })(WorkingBaseType || (exports.WorkingBaseType = WorkingBaseType = {}));
function getWorkingBaseAndType(git) { function getWorkingBaseAndType(git) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const symbolicRefResult = yield git.exec(['symbolic-ref', 'HEAD', '--short'], { allowAllExitCodes: true }); const symbolicRefResult = yield git.exec(['symbolic-ref', 'HEAD', '--short'], true);
if (symbolicRefResult.exitCode == 0) { if (symbolicRefResult.exitCode == 0) {
// A ref is checked out // A ref is checked out
return [symbolicRefResult.stdout.trim(), WorkingBaseType.Branch]; return [symbolicRefResult.stdout.trim(), WorkingBaseType.Branch];
@ -194,7 +194,7 @@ function createOrUpdateBranch(git, commitMessage, base, branch, branchRemoteName
else { else {
aopts.push('-A'); aopts.push('-A');
} }
yield git.exec(aopts, { allowAllExitCodes: true }); yield git.exec(aopts, true);
const popts = ['-m', commitMessage]; const popts = ['-m', commitMessage];
if (signoff) { if (signoff) {
popts.push('--signoff'); popts.push('--signoff');
@ -519,7 +519,7 @@ function createPullRequest(inputs) {
// Create signed commits via the GitHub API // Create signed commits via the GitHub API
const stashed = yield git.stashPush(['--include-untracked']); const stashed = yield git.stashPush(['--include-untracked']);
yield git.checkout(inputs.branch); yield git.checkout(inputs.branch);
const pushSignedCommitsResult = yield ghBranch.pushSignedCommits(git, result.branchCommits, result.baseCommit, repoPath, branchRepository, inputs.branch); const pushSignedCommitsResult = yield ghBranch.pushSignedCommits(result.branchCommits, result.baseCommit, repoPath, branchRepository, inputs.branch);
outputs.set('pull-request-head-sha', pushSignedCommitsResult.sha); outputs.set('pull-request-head-sha', pushSignedCommitsResult.sha);
outputs.set('pull-request-commits-verified', pushSignedCommitsResult.verified.toString()); outputs.set('pull-request-commits-verified', pushSignedCommitsResult.verified.toString());
yield git.checkout('-'); yield git.checkout('-');
@ -662,16 +662,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next()); step((generator = generator.apply(thisArg, _arguments || [])).next());
}); });
}; };
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", ({ value: true })); Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.GitCommandManager = void 0; exports.GitCommandManager = void 0;
const exec = __importStar(__nccwpck_require__(5236)); const exec = __importStar(__nccwpck_require__(5236));
const io = __importStar(__nccwpck_require__(4994)); const io = __importStar(__nccwpck_require__(4994));
const utils = __importStar(__nccwpck_require__(9277)); const utils = __importStar(__nccwpck_require__(9277));
const path = __importStar(__nccwpck_require__(6928)); const path = __importStar(__nccwpck_require__(6928));
const stream_1 = __importDefault(__nccwpck_require__(2203));
const tagsRefSpec = '+refs/tags/*:refs/tags/*'; const tagsRefSpec = '+refs/tags/*:refs/tags/*';
class GitCommandManager { class GitCommandManager {
constructor(workingDirectory, gitPath) { constructor(workingDirectory, gitPath) {
@ -710,7 +706,7 @@ class GitCommandManager {
if (options) { if (options) {
args.push(...options); args.push(...options);
} }
return yield this.exec(args, { allowAllExitCodes: allowAllExitCodes }); return yield this.exec(args, allowAllExitCodes);
}); });
} }
commit(options_1) { commit(options_1) {
@ -722,7 +718,7 @@ class GitCommandManager {
if (options) { if (options) {
args.push(...options); args.push(...options);
} }
return yield this.exec(args, { allowAllExitCodes: allowAllExitCodes }); return yield this.exec(args, allowAllExitCodes);
}); });
} }
config(configKey, configValue, globalConfig, add) { config(configKey, configValue, globalConfig, add) {
@ -744,7 +740,7 @@ class GitCommandManager {
'--get-regexp', '--get-regexp',
configKey, configKey,
configValue configValue
], { allowAllExitCodes: true }); ], true);
return output.exitCode === 0; return output.exitCode === 0;
}); });
} }
@ -787,7 +783,7 @@ class GitCommandManager {
'--no-abbrev', '--no-abbrev',
`--format=%H%n%T%n%P%n%G?%n%s%n%b%n${endOfBody}`, `--format=%H%n%T%n%P%n%G?%n%s%n%b%n${endOfBody}`,
ref ref
], { suppressGitCmdOutput: true }); ]);
const lines = output.stdout.split('\n'); const lines = output.stdout.split('\n');
const endOfBodyIndex = lines.lastIndexOf(endOfBody); const endOfBodyIndex = lines.lastIndexOf(endOfBody);
const detailLines = lines.slice(0, endOfBodyIndex); const detailLines = lines.slice(0, endOfBodyIndex);
@ -841,7 +837,7 @@ class GitCommandManager {
if (options) { if (options) {
args.push(...options); args.push(...options);
} }
const output = yield this.exec(args, { allowAllExitCodes: true }); const output = yield this.exec(args, true);
return output.exitCode === 1; return output.exitCode === 1;
}); });
} }
@ -898,16 +894,6 @@ class GitCommandManager {
return output.stdout.trim(); return output.stdout.trim();
}); });
} }
showFileAtRefBase64(ref, path) {
return __awaiter(this, void 0, void 0, function* () {
const args = ['show', `${ref}:${path}`];
const output = yield this.exec(args, {
encoding: 'base64',
suppressGitCmdOutput: true
});
return output.stdout.trim();
});
}
stashPush(options) { stashPush(options) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const args = ['stash', 'push']; const args = ['stash', 'push'];
@ -955,13 +941,13 @@ class GitCommandManager {
'--unset', '--unset',
configKey, configKey,
configValue configValue
], { allowAllExitCodes: true }); ], true);
return output.exitCode === 0; return output.exitCode === 0;
}); });
} }
tryGetRemoteUrl() { tryGetRemoteUrl() {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const output = yield this.exec(['config', '--local', '--get', 'remote.origin.url'], { allowAllExitCodes: true }); const output = yield this.exec(['config', '--local', '--get', 'remote.origin.url'], true);
if (output.exitCode !== 0) { if (output.exitCode !== 0) {
return ''; return '';
} }
@ -973,40 +959,30 @@ class GitCommandManager {
}); });
} }
exec(args_1) { exec(args_1) {
return __awaiter(this, arguments, void 0, function* (args, { encoding = 'utf8', allowAllExitCodes = false, suppressGitCmdOutput = false } = {}) { return __awaiter(this, arguments, void 0, function* (args, allowAllExitCodes = false) {
const result = new GitOutput(); const result = new GitOutput();
if (process.env['CPR_SHOW_GIT_CMD_OUTPUT']) {
// debug mode overrides the suppressGitCmdOutput option
suppressGitCmdOutput = false;
}
const env = {}; const env = {};
for (const key of Object.keys(process.env)) { for (const key of Object.keys(process.env)) {
env[key] = process.env[key]; env[key] = process.env[key];
} }
const stdout = []; const stdout = [];
let stdoutLength = 0;
const stderr = []; const stderr = [];
let stderrLength = 0;
const options = { const options = {
cwd: this.workingDirectory, cwd: this.workingDirectory,
env, env,
ignoreReturnCode: allowAllExitCodes, ignoreReturnCode: allowAllExitCodes,
listeners: { listeners: {
stdout: (data) => { stdout: (data) => {
stdout.push(data); stdout.push(data.toString());
stdoutLength += data.length;
}, },
stderr: (data) => { stderr: (data) => {
stderr.push(data); stderr.push(data.toString());
stderrLength += data.length;
} }
}, }
outStream: outStreamHandler(process.stdout, suppressGitCmdOutput),
errStream: outStreamHandler(process.stderr, suppressGitCmdOutput)
}; };
result.exitCode = yield exec.exec(`"${this.gitPath}"`, args, options); result.exitCode = yield exec.exec(`"${this.gitPath}"`, args, options);
result.stdout = Buffer.concat(stdout, stdoutLength).toString(encoding); result.stdout = stdout.join('');
result.stderr = Buffer.concat(stderr, stderrLength).toString(encoding); result.stderr = stderr.join('');
return result; return result;
}); });
} }
@ -1019,24 +995,6 @@ class GitOutput {
this.exitCode = 0; this.exitCode = 0;
} }
} }
const outStreamHandler = (outStream, suppressGitCmdOutput) => {
return new stream_1.default.Writable({
write(chunk, _, next) {
if (suppressGitCmdOutput) {
const lines = chunk.toString().trimEnd().split('\n');
for (const line of lines) {
if (line.startsWith('[command]')) {
outStream.write(`${line}\n`);
}
}
}
else {
outStream.write(chunk);
}
next();
}
});
};
/***/ }), /***/ }),
@ -1471,7 +1429,7 @@ class GitHubHelper {
return pull; return pull;
}); });
} }
pushSignedCommits(git, branchCommits, baseCommit, repoPath, branchRepository, branch) { pushSignedCommits(branchCommits, baseCommit, repoPath, branchRepository, branch) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
let headCommit = { let headCommit = {
sha: baseCommit.sha, sha: baseCommit.sha,
@ -1479,13 +1437,13 @@ class GitHubHelper {
verified: false verified: false
}; };
for (const commit of branchCommits) { for (const commit of branchCommits) {
headCommit = yield this.createCommit(git, commit, headCommit, repoPath, branchRepository); headCommit = yield this.createCommit(commit, headCommit, repoPath, branchRepository);
} }
yield this.createOrUpdateRef(branchRepository, branch, headCommit.sha); yield this.createOrUpdateRef(branchRepository, branch, headCommit.sha);
return headCommit; return headCommit;
}); });
} }
createCommit(git, commit, parentCommit, repoPath, branchRepository) { createCommit(commit, parentCommit, repoPath, branchRepository) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const repository = this.parseRepository(branchRepository); const repository = this.parseRepository(branchRepository);
// In the case of an empty commit, the tree references the parent's tree // In the case of an empty commit, the tree references the parent's tree
@ -1507,9 +1465,7 @@ class GitHubHelper {
let sha = null; let sha = null;
if (status === 'A' || status === 'M') { if (status === 'A' || status === 'M') {
try { try {
const { data: blob } = yield blobCreationLimit(() => __awaiter(this, void 0, void 0, function* () { const { data: blob } = yield blobCreationLimit(() => this.octokit.rest.git.createBlob(Object.assign(Object.assign({}, repository), { content: utils.readFileBase64([repoPath, path]), encoding: 'base64' })));
return this.octokit.rest.git.createBlob(Object.assign(Object.assign({}, repository), { content: yield git.showFileAtRefBase64(commit.sha, path), encoding: 'base64' }));
}));
sha = blob.sha; sha = blob.sha;
} }
catch (error) { catch (error) {
@ -1836,6 +1792,7 @@ exports.randomString = randomString;
exports.parseDisplayNameEmail = parseDisplayNameEmail; exports.parseDisplayNameEmail = parseDisplayNameEmail;
exports.fileExistsSync = fileExistsSync; exports.fileExistsSync = fileExistsSync;
exports.readFile = readFile; exports.readFile = readFile;
exports.readFileBase64 = readFileBase64;
exports.getErrorMessage = getErrorMessage; exports.getErrorMessage = getErrorMessage;
const core = __importStar(__nccwpck_require__(7484)); const core = __importStar(__nccwpck_require__(7484));
const fs = __importStar(__nccwpck_require__(9896)); const fs = __importStar(__nccwpck_require__(9896));
@ -1925,6 +1882,15 @@ function fileExistsSync(path) {
function readFile(path) { function readFile(path) {
return fs.readFileSync(path, 'utf-8'); return fs.readFileSync(path, 'utf-8');
} }
function readFileBase64(pathParts) {
const resolvedPath = path.resolve(...pathParts);
if (fs.lstatSync(resolvedPath).isSymbolicLink()) {
return fs
.readlinkSync(resolvedPath, { encoding: 'buffer' })
.toString('base64');
}
return fs.readFileSync(resolvedPath).toString('base64');
}
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
function hasErrorCode(error) { function hasErrorCode(error) {
return typeof (error && error.code) === 'string'; return typeof (error && error.code) === 'string';
@ -32402,9 +32368,9 @@ function addQueryParameters(url, parameters) {
} }
// pkg/dist-src/util/extract-url-variable-names.js // pkg/dist-src/util/extract-url-variable-names.js
var urlVariableRegex = /\{[^{}}]+\}/g; var urlVariableRegex = /\{[^}]+\}/g;
function removeNonChars(variableName) { function removeNonChars(variableName) {
return variableName.replace(/(?:^\W+)|(?:(?<!\W)\W+$)/g, "").split(/,/); return variableName.replace(/^\W+|\W+$/g, "").split(/,/);
} }
function extractUrlVariableNames(url) { function extractUrlVariableNames(url) {
const matches = url.match(urlVariableRegex); const matches = url.match(urlVariableRegex);
@ -32590,7 +32556,7 @@ function parse(options) {
} }
if (url.endsWith("/graphql")) { if (url.endsWith("/graphql")) {
if (options.mediaType.previews?.length) { if (options.mediaType.previews?.length) {
const previewsFromAcceptHeader = headers.accept.match(/(?<![\w-])[\w-]+(?=-preview)/g) || []; const previewsFromAcceptHeader = headers.accept.match(/[\w-]+(?=-preview)/g) || [];
headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => { headers.accept = previewsFromAcceptHeader.concat(options.mediaType.previews).map((preview) => {
const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json"; const format = options.mediaType.format ? `.${options.mediaType.format}` : "+json";
return `application/vnd.github.${preview}-preview${format}`; return `application/vnd.github.${preview}-preview${format}`;
@ -32674,7 +32640,7 @@ class RequestError extends Error {
if (options.request.headers.authorization) { if (options.request.headers.authorization) {
requestCopy.headers = Object.assign({}, options.request.headers, { requestCopy.headers = Object.assign({}, options.request.headers, {
authorization: options.request.headers.authorization.replace( authorization: options.request.headers.authorization.replace(
/(?<! ) .*$/, / .*$/,
" [REDACTED]" " [REDACTED]"
) )
}); });
@ -32780,7 +32746,7 @@ async function fetchWrapper(requestOptions) {
data: "" data: ""
}; };
if ("deprecation" in responseHeaders) { if ("deprecation" in responseHeaders) {
const matches = responseHeaders.link && responseHeaders.link.match(/<([^<>]+)>; rel="deprecation"/); const matches = responseHeaders.link && responseHeaders.link.match(/<([^>]+)>; rel="deprecation"/);
const deprecationLink = matches && matches.pop(); const deprecationLink = matches && matches.pop();
log.warn( log.warn(
`[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}` `[@octokit/request] "${requestOptions.method} ${requestOptions.url}" is deprecated. It is scheduled to be removed on ${responseHeaders.sunset}${deprecationLink ? `. See ${deprecationLink}` : ""}`
@ -32821,7 +32787,7 @@ async function getResponseData(response) {
return response.text().catch(() => ""); return response.text().catch(() => "");
} }
const mimetype = (0,fast_content_type_parse/* safeParse */.xL)(contentType); const mimetype = (0,fast_content_type_parse/* safeParse */.xL)(contentType);
if (isJSONResponse(mimetype)) { if (mimetype.type === "application/json") {
let text = ""; let text = "";
try { try {
text = await response.text(); text = await response.text();
@ -32835,9 +32801,6 @@ async function getResponseData(response) {
return response.arrayBuffer().catch(() => new ArrayBuffer(0)); return response.arrayBuffer().catch(() => new ArrayBuffer(0));
} }
} }
function isJSONResponse(mimetype) {
return mimetype.type === "application/json" || mimetype.type === "application/scim+json";
}
function toErrorMessage(data) { function toErrorMessage(data) {
if (typeof data === "string") { if (typeof data === "string") {
return data; return data;
@ -32925,8 +32888,7 @@ var NON_VARIABLE_OPTIONS = [
"headers", "headers",
"request", "request",
"query", "query",
"mediaType", "mediaType"
"operationName"
]; ];
var FORBIDDEN_VARIABLE_OPTIONS = ["query", "method", "url"]; var FORBIDDEN_VARIABLE_OPTIONS = ["query", "method", "url"];
var GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/; var GHES_V3_SUFFIX_REGEX = /\/api\/v3\/?$/;
@ -33061,7 +33023,7 @@ var createTokenAuth = function createTokenAuth2(token) {
;// CONCATENATED MODULE: ./node_modules/@octokit/core/dist-src/version.js ;// CONCATENATED MODULE: ./node_modules/@octokit/core/dist-src/version.js
const version_VERSION = "6.1.6"; const version_VERSION = "6.1.3";
;// CONCATENATED MODULE: ./node_modules/@octokit/core/dist-src/index.js ;// CONCATENATED MODULE: ./node_modules/@octokit/core/dist-src/index.js
@ -33075,21 +33037,6 @@ const noop = () => {
}; };
const consoleWarn = console.warn.bind(console); const consoleWarn = console.warn.bind(console);
const consoleError = console.error.bind(console); const consoleError = console.error.bind(console);
function createLogger(logger = {}) {
if (typeof logger.debug !== "function") {
logger.debug = noop;
}
if (typeof logger.info !== "function") {
logger.info = noop;
}
if (typeof logger.warn !== "function") {
logger.warn = consoleWarn;
}
if (typeof logger.error !== "function") {
logger.error = consoleError;
}
return logger;
}
const userAgentTrail = `octokit-core.js/${version_VERSION} ${getUserAgent()}`; const userAgentTrail = `octokit-core.js/${version_VERSION} ${getUserAgent()}`;
class Octokit { class Octokit {
static VERSION = version_VERSION; static VERSION = version_VERSION;
@ -33157,7 +33104,15 @@ class Octokit {
} }
this.request = request.defaults(requestDefaults); this.request = request.defaults(requestDefaults);
this.graphql = withCustomRequest(this.request).defaults(requestDefaults); this.graphql = withCustomRequest(this.request).defaults(requestDefaults);
this.log = createLogger(options.log); this.log = Object.assign(
{
debug: noop,
info: noop,
warn: consoleWarn,
error: consoleError
},
options.log
);
this.hook = hook; this.hook = hook;
if (!options.authStrategy) { if (!options.authStrategy) {
if (!options.auth) { if (!options.auth) {
@ -33266,7 +33221,7 @@ function iterator(octokit, route, parameters) {
const response = await requestMethod({ method, url, headers }); const response = await requestMethod({ method, url, headers });
const normalizedResponse = normalizePaginatedListResponse(response); const normalizedResponse = normalizePaginatedListResponse(response);
url = ((normalizedResponse.headers.link || "").match( url = ((normalizedResponse.headers.link || "").match(
/<([^<>]+)>;\s*rel="next"/ /<([^>]+)>;\s*rel="next"/
) || [])[1]; ) || [])[1];
return { value: normalizedResponse }; return { value: normalizedResponse };
} catch (error) { } catch (error) {
@ -33353,10 +33308,8 @@ var paginatingEndpoints = [
"GET /notifications", "GET /notifications",
"GET /organizations", "GET /organizations",
"GET /orgs/{org}/actions/cache/usage-by-repository", "GET /orgs/{org}/actions/cache/usage-by-repository",
"GET /orgs/{org}/actions/hosted-runners",
"GET /orgs/{org}/actions/permissions/repositories", "GET /orgs/{org}/actions/permissions/repositories",
"GET /orgs/{org}/actions/runner-groups", "GET /orgs/{org}/actions/runner-groups",
"GET /orgs/{org}/actions/runner-groups/{runner_group_id}/hosted-runners",
"GET /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories", "GET /orgs/{org}/actions/runner-groups/{runner_group_id}/repositories",
"GET /orgs/{org}/actions/runner-groups/{runner_group_id}/runners", "GET /orgs/{org}/actions/runner-groups/{runner_group_id}/runners",
"GET /orgs/{org}/actions/runners", "GET /orgs/{org}/actions/runners",
@ -33409,10 +33362,8 @@ var paginatingEndpoints = [
"GET /orgs/{org}/repos", "GET /orgs/{org}/repos",
"GET /orgs/{org}/rulesets", "GET /orgs/{org}/rulesets",
"GET /orgs/{org}/rulesets/rule-suites", "GET /orgs/{org}/rulesets/rule-suites",
"GET /orgs/{org}/rulesets/{ruleset_id}/history",
"GET /orgs/{org}/secret-scanning/alerts", "GET /orgs/{org}/secret-scanning/alerts",
"GET /orgs/{org}/security-advisories", "GET /orgs/{org}/security-advisories",
"GET /orgs/{org}/settings/network-configurations",
"GET /orgs/{org}/team/{team_slug}/copilot/metrics", "GET /orgs/{org}/team/{team_slug}/copilot/metrics",
"GET /orgs/{org}/team/{team_slug}/copilot/usage", "GET /orgs/{org}/team/{team_slug}/copilot/usage",
"GET /orgs/{org}/teams", "GET /orgs/{org}/teams",
@ -33509,7 +33460,6 @@ var paginatingEndpoints = [
"GET /repos/{owner}/{repo}/rules/branches/{branch}", "GET /repos/{owner}/{repo}/rules/branches/{branch}",
"GET /repos/{owner}/{repo}/rulesets", "GET /repos/{owner}/{repo}/rulesets",
"GET /repos/{owner}/{repo}/rulesets/rule-suites", "GET /repos/{owner}/{repo}/rulesets/rule-suites",
"GET /repos/{owner}/{repo}/rulesets/{ruleset_id}/history",
"GET /repos/{owner}/{repo}/secret-scanning/alerts", "GET /repos/{owner}/{repo}/secret-scanning/alerts",
"GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}/locations", "GET /repos/{owner}/{repo}/secret-scanning/alerts/{alert_number}/locations",
"GET /repos/{owner}/{repo}/security-advisories", "GET /repos/{owner}/{repo}/security-advisories",
@ -33621,7 +33571,7 @@ __nccwpck_require__.d(__webpack_exports__, {
}); });
;// CONCATENATED MODULE: ./node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/version.js ;// CONCATENATED MODULE: ./node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/version.js
const VERSION = "13.5.0"; const VERSION = "13.3.0";
//# sourceMappingURL=version.js.map //# sourceMappingURL=version.js.map
@ -33652,7 +33602,6 @@ const Endpoints = {
createEnvironmentVariable: [ createEnvironmentVariable: [
"POST /repos/{owner}/{repo}/environments/{environment_name}/variables" "POST /repos/{owner}/{repo}/environments/{environment_name}/variables"
], ],
createHostedRunnerForOrg: ["POST /orgs/{org}/actions/hosted-runners"],
createOrUpdateEnvironmentSecret: [ createOrUpdateEnvironmentSecret: [
"PUT /repos/{owner}/{repo}/environments/{environment_name}/secrets/{secret_name}" "PUT /repos/{owner}/{repo}/environments/{environment_name}/secrets/{secret_name}"
], ],
@ -33690,9 +33639,6 @@ const Endpoints = {
deleteEnvironmentVariable: [ deleteEnvironmentVariable: [
"DELETE /repos/{owner}/{repo}/environments/{environment_name}/variables/{name}" "DELETE /repos/{owner}/{repo}/environments/{environment_name}/variables/{name}"
], ],
deleteHostedRunnerForOrg: [
"DELETE /orgs/{org}/actions/hosted-runners/{hosted_runner_id}"
],
deleteOrgSecret: ["DELETE /orgs/{org}/actions/secrets/{secret_name}"], deleteOrgSecret: ["DELETE /orgs/{org}/actions/secrets/{secret_name}"],
deleteOrgVariable: ["DELETE /orgs/{org}/actions/variables/{name}"], deleteOrgVariable: ["DELETE /orgs/{org}/actions/variables/{name}"],
deleteRepoSecret: [ deleteRepoSecret: [
@ -33781,24 +33727,6 @@ const Endpoints = {
getGithubActionsPermissionsRepository: [ getGithubActionsPermissionsRepository: [
"GET /repos/{owner}/{repo}/actions/permissions" "GET /repos/{owner}/{repo}/actions/permissions"
], ],
getHostedRunnerForOrg: [
"GET /orgs/{org}/actions/hosted-runners/{hosted_runner_id}"
],
getHostedRunnersGithubOwnedImagesForOrg: [
"GET /orgs/{org}/actions/hosted-runners/images/github-owned"
],
getHostedRunnersLimitsForOrg: [
"GET /orgs/{org}/actions/hosted-runners/limits"
],
getHostedRunnersMachineSpecsForOrg: [
"GET /orgs/{org}/actions/hosted-runners/machine-sizes"
],
getHostedRunnersPartnerImagesForOrg: [
"GET /orgs/{org}/actions/hosted-runners/images/partner"
],
getHostedRunnersPlatformsForOrg: [
"GET /orgs/{org}/actions/hosted-runners/platforms"
],
getJobForWorkflowRun: ["GET /repos/{owner}/{repo}/actions/jobs/{job_id}"], getJobForWorkflowRun: ["GET /repos/{owner}/{repo}/actions/jobs/{job_id}"],
getOrgPublicKey: ["GET /orgs/{org}/actions/secrets/public-key"], getOrgPublicKey: ["GET /orgs/{org}/actions/secrets/public-key"],
getOrgSecret: ["GET /orgs/{org}/actions/secrets/{secret_name}"], getOrgSecret: ["GET /orgs/{org}/actions/secrets/{secret_name}"],
@ -33842,10 +33770,6 @@ const Endpoints = {
listEnvironmentVariables: [ listEnvironmentVariables: [
"GET /repos/{owner}/{repo}/environments/{environment_name}/variables" "GET /repos/{owner}/{repo}/environments/{environment_name}/variables"
], ],
listGithubHostedRunnersInGroupForOrg: [
"GET /orgs/{org}/actions/runner-groups/{runner_group_id}/hosted-runners"
],
listHostedRunnersForOrg: ["GET /orgs/{org}/actions/hosted-runners"],
listJobsForWorkflowRun: [ listJobsForWorkflowRun: [
"GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs" "GET /repos/{owner}/{repo}/actions/runs/{run_id}/jobs"
], ],
@ -33964,9 +33888,6 @@ const Endpoints = {
updateEnvironmentVariable: [ updateEnvironmentVariable: [
"PATCH /repos/{owner}/{repo}/environments/{environment_name}/variables/{name}" "PATCH /repos/{owner}/{repo}/environments/{environment_name}/variables/{name}"
], ],
updateHostedRunnerForOrg: [
"PATCH /orgs/{org}/actions/hosted-runners/{hosted_runner_id}"
],
updateOrgVariable: ["PATCH /orgs/{org}/actions/variables/{name}"], updateOrgVariable: ["PATCH /orgs/{org}/actions/variables/{name}"],
updateRepoVariable: [ updateRepoVariable: [
"PATCH /repos/{owner}/{repo}/actions/variables/{name}" "PATCH /repos/{owner}/{repo}/actions/variables/{name}"
@ -34484,26 +34405,6 @@ const Endpoints = {
getAllTemplates: ["GET /gitignore/templates"], getAllTemplates: ["GET /gitignore/templates"],
getTemplate: ["GET /gitignore/templates/{name}"] getTemplate: ["GET /gitignore/templates/{name}"]
}, },
hostedCompute: {
createNetworkConfigurationForOrg: [
"POST /orgs/{org}/settings/network-configurations"
],
deleteNetworkConfigurationFromOrg: [
"DELETE /orgs/{org}/settings/network-configurations/{network_configuration_id}"
],
getNetworkConfigurationForOrg: [
"GET /orgs/{org}/settings/network-configurations/{network_configuration_id}"
],
getNetworkSettingsForOrg: [
"GET /orgs/{org}/settings/network-settings/{network_settings_id}"
],
listNetworkConfigurationsForOrg: [
"GET /orgs/{org}/settings/network-configurations"
],
updateNetworkConfigurationForOrg: [
"PATCH /orgs/{org}/settings/network-configurations/{network_configuration_id}"
]
},
interactions: { interactions: {
getRestrictionsForAuthenticatedUser: ["GET /user/interaction-limits"], getRestrictionsForAuthenticatedUser: ["GET /user/interaction-limits"],
getRestrictionsForOrg: ["GET /orgs/{org}/interaction-limits"], getRestrictionsForOrg: ["GET /orgs/{org}/interaction-limits"],
@ -34695,7 +34596,6 @@ const Endpoints = {
"PUT /orgs/{org}/outside_collaborators/{username}" "PUT /orgs/{org}/outside_collaborators/{username}"
], ],
createInvitation: ["POST /orgs/{org}/invitations"], createInvitation: ["POST /orgs/{org}/invitations"],
createIssueType: ["POST /orgs/{org}/issue-types"],
createOrUpdateCustomProperties: ["PATCH /orgs/{org}/properties/schema"], createOrUpdateCustomProperties: ["PATCH /orgs/{org}/properties/schema"],
createOrUpdateCustomPropertiesValuesForRepos: [ createOrUpdateCustomPropertiesValuesForRepos: [
"PATCH /orgs/{org}/properties/values" "PATCH /orgs/{org}/properties/values"
@ -34705,7 +34605,6 @@ const Endpoints = {
], ],
createWebhook: ["POST /orgs/{org}/hooks"], createWebhook: ["POST /orgs/{org}/hooks"],
delete: ["DELETE /orgs/{org}"], delete: ["DELETE /orgs/{org}"],
deleteIssueType: ["DELETE /orgs/{org}/issue-types/{issue_type_id}"],
deleteWebhook: ["DELETE /orgs/{org}/hooks/{hook_id}"], deleteWebhook: ["DELETE /orgs/{org}/hooks/{hook_id}"],
enableOrDisableSecurityProductOnAllOrgRepos: [ enableOrDisableSecurityProductOnAllOrgRepos: [
"POST /orgs/{org}/{security_product}/{enablement}", "POST /orgs/{org}/{security_product}/{enablement}",
@ -34722,10 +34621,6 @@ const Endpoints = {
getMembershipForAuthenticatedUser: ["GET /user/memberships/orgs/{org}"], getMembershipForAuthenticatedUser: ["GET /user/memberships/orgs/{org}"],
getMembershipForUser: ["GET /orgs/{org}/memberships/{username}"], getMembershipForUser: ["GET /orgs/{org}/memberships/{username}"],
getOrgRole: ["GET /orgs/{org}/organization-roles/{role_id}"], getOrgRole: ["GET /orgs/{org}/organization-roles/{role_id}"],
getOrgRulesetHistory: ["GET /orgs/{org}/rulesets/{ruleset_id}/history"],
getOrgRulesetVersion: [
"GET /orgs/{org}/rulesets/{ruleset_id}/history/{version_id}"
],
getWebhook: ["GET /orgs/{org}/hooks/{hook_id}"], getWebhook: ["GET /orgs/{org}/hooks/{hook_id}"],
getWebhookConfigForOrg: ["GET /orgs/{org}/hooks/{hook_id}/config"], getWebhookConfigForOrg: ["GET /orgs/{org}/hooks/{hook_id}/config"],
getWebhookDelivery: [ getWebhookDelivery: [
@ -34740,7 +34635,6 @@ const Endpoints = {
listForAuthenticatedUser: ["GET /user/orgs"], listForAuthenticatedUser: ["GET /user/orgs"],
listForUser: ["GET /users/{username}/orgs"], listForUser: ["GET /users/{username}/orgs"],
listInvitationTeams: ["GET /orgs/{org}/invitations/{invitation_id}/teams"], listInvitationTeams: ["GET /orgs/{org}/invitations/{invitation_id}/teams"],
listIssueTypes: ["GET /orgs/{org}/issue-types"],
listMembers: ["GET /orgs/{org}/members"], listMembers: ["GET /orgs/{org}/members"],
listMembershipsForAuthenticatedUser: ["GET /user/memberships/orgs"], listMembershipsForAuthenticatedUser: ["GET /user/memberships/orgs"],
listOrgRoleTeams: ["GET /orgs/{org}/organization-roles/{role_id}/teams"], listOrgRoleTeams: ["GET /orgs/{org}/organization-roles/{role_id}/teams"],
@ -34815,7 +34709,6 @@ const Endpoints = {
], ],
unblockUser: ["DELETE /orgs/{org}/blocks/{username}"], unblockUser: ["DELETE /orgs/{org}/blocks/{username}"],
update: ["PATCH /orgs/{org}"], update: ["PATCH /orgs/{org}"],
updateIssueType: ["PUT /orgs/{org}/issue-types/{issue_type_id}"],
updateMembershipForAuthenticatedUser: [ updateMembershipForAuthenticatedUser: [
"PATCH /user/memberships/orgs/{org}" "PATCH /user/memberships/orgs/{org}"
], ],
@ -34929,181 +34822,35 @@ const Endpoints = {
] ]
}, },
projects: { projects: {
addCollaborator: [ addCollaborator: ["PUT /projects/{project_id}/collaborators/{username}"],
"PUT /projects/{project_id}/collaborators/{username}", createCard: ["POST /projects/columns/{column_id}/cards"],
{}, createColumn: ["POST /projects/{project_id}/columns"],
{ createForAuthenticatedUser: ["POST /user/projects"],
deprecated: "octokit.rest.projects.addCollaborator() is deprecated, see https://docs.github.com/rest/projects/collaborators#add-project-collaborator" createForOrg: ["POST /orgs/{org}/projects"],
} createForRepo: ["POST /repos/{owner}/{repo}/projects"],
], delete: ["DELETE /projects/{project_id}"],
createCard: [ deleteCard: ["DELETE /projects/columns/cards/{card_id}"],
"POST /projects/columns/{column_id}/cards", deleteColumn: ["DELETE /projects/columns/{column_id}"],
{}, get: ["GET /projects/{project_id}"],
{ getCard: ["GET /projects/columns/cards/{card_id}"],
deprecated: "octokit.rest.projects.createCard() is deprecated, see https://docs.github.com/rest/projects/cards#create-a-project-card" getColumn: ["GET /projects/columns/{column_id}"],
}
],
createColumn: [
"POST /projects/{project_id}/columns",
{},
{
deprecated: "octokit.rest.projects.createColumn() is deprecated, see https://docs.github.com/rest/projects/columns#create-a-project-column"
}
],
createForAuthenticatedUser: [
"POST /user/projects",
{},
{
deprecated: "octokit.rest.projects.createForAuthenticatedUser() is deprecated, see https://docs.github.com/rest/projects/projects#create-a-user-project"
}
],
createForOrg: [
"POST /orgs/{org}/projects",
{},
{
deprecated: "octokit.rest.projects.createForOrg() is deprecated, see https://docs.github.com/rest/projects/projects#create-an-organization-project"
}
],
createForRepo: [
"POST /repos/{owner}/{repo}/projects",
{},
{
deprecated: "octokit.rest.projects.createForRepo() is deprecated, see https://docs.github.com/rest/projects/projects#create-a-repository-project"
}
],
delete: [
"DELETE /projects/{project_id}",
{},
{
deprecated: "octokit.rest.projects.delete() is deprecated, see https://docs.github.com/rest/projects/projects#delete-a-project"
}
],
deleteCard: [
"DELETE /projects/columns/cards/{card_id}",
{},
{
deprecated: "octokit.rest.projects.deleteCard() is deprecated, see https://docs.github.com/rest/projects/cards#delete-a-project-card"
}
],
deleteColumn: [
"DELETE /projects/columns/{column_id}",
{},
{
deprecated: "octokit.rest.projects.deleteColumn() is deprecated, see https://docs.github.com/rest/projects/columns#delete-a-project-column"
}
],
get: [
"GET /projects/{project_id}",
{},
{
deprecated: "octokit.rest.projects.get() is deprecated, see https://docs.github.com/rest/projects/projects#get-a-project"
}
],
getCard: [
"GET /projects/columns/cards/{card_id}",
{},
{
deprecated: "octokit.rest.projects.getCard() is deprecated, see https://docs.github.com/rest/projects/cards#get-a-project-card"
}
],
getColumn: [
"GET /projects/columns/{column_id}",
{},
{
deprecated: "octokit.rest.projects.getColumn() is deprecated, see https://docs.github.com/rest/projects/columns#get-a-project-column"
}
],
getPermissionForUser: [ getPermissionForUser: [
"GET /projects/{project_id}/collaborators/{username}/permission", "GET /projects/{project_id}/collaborators/{username}/permission"
{},
{
deprecated: "octokit.rest.projects.getPermissionForUser() is deprecated, see https://docs.github.com/rest/projects/collaborators#get-project-permission-for-a-user"
}
],
listCards: [
"GET /projects/columns/{column_id}/cards",
{},
{
deprecated: "octokit.rest.projects.listCards() is deprecated, see https://docs.github.com/rest/projects/cards#list-project-cards"
}
],
listCollaborators: [
"GET /projects/{project_id}/collaborators",
{},
{
deprecated: "octokit.rest.projects.listCollaborators() is deprecated, see https://docs.github.com/rest/projects/collaborators#list-project-collaborators"
}
],
listColumns: [
"GET /projects/{project_id}/columns",
{},
{
deprecated: "octokit.rest.projects.listColumns() is deprecated, see https://docs.github.com/rest/projects/columns#list-project-columns"
}
],
listForOrg: [
"GET /orgs/{org}/projects",
{},
{
deprecated: "octokit.rest.projects.listForOrg() is deprecated, see https://docs.github.com/rest/projects/projects#list-organization-projects"
}
],
listForRepo: [
"GET /repos/{owner}/{repo}/projects",
{},
{
deprecated: "octokit.rest.projects.listForRepo() is deprecated, see https://docs.github.com/rest/projects/projects#list-repository-projects"
}
],
listForUser: [
"GET /users/{username}/projects",
{},
{
deprecated: "octokit.rest.projects.listForUser() is deprecated, see https://docs.github.com/rest/projects/projects#list-user-projects"
}
],
moveCard: [
"POST /projects/columns/cards/{card_id}/moves",
{},
{
deprecated: "octokit.rest.projects.moveCard() is deprecated, see https://docs.github.com/rest/projects/cards#move-a-project-card"
}
],
moveColumn: [
"POST /projects/columns/{column_id}/moves",
{},
{
deprecated: "octokit.rest.projects.moveColumn() is deprecated, see https://docs.github.com/rest/projects/columns#move-a-project-column"
}
], ],
listCards: ["GET /projects/columns/{column_id}/cards"],
listCollaborators: ["GET /projects/{project_id}/collaborators"],
listColumns: ["GET /projects/{project_id}/columns"],
listForOrg: ["GET /orgs/{org}/projects"],
listForRepo: ["GET /repos/{owner}/{repo}/projects"],
listForUser: ["GET /users/{username}/projects"],
moveCard: ["POST /projects/columns/cards/{card_id}/moves"],
moveColumn: ["POST /projects/columns/{column_id}/moves"],
removeCollaborator: [ removeCollaborator: [
"DELETE /projects/{project_id}/collaborators/{username}", "DELETE /projects/{project_id}/collaborators/{username}"
{},
{
deprecated: "octokit.rest.projects.removeCollaborator() is deprecated, see https://docs.github.com/rest/projects/collaborators#remove-user-as-a-collaborator"
}
], ],
update: [ update: ["PATCH /projects/{project_id}"],
"PATCH /projects/{project_id}", updateCard: ["PATCH /projects/columns/cards/{card_id}"],
{}, updateColumn: ["PATCH /projects/columns/{column_id}"]
{
deprecated: "octokit.rest.projects.update() is deprecated, see https://docs.github.com/rest/projects/projects#update-a-project"
}
],
updateCard: [
"PATCH /projects/columns/cards/{card_id}",
{},
{
deprecated: "octokit.rest.projects.updateCard() is deprecated, see https://docs.github.com/rest/projects/cards#update-an-existing-project-card"
}
],
updateColumn: [
"PATCH /projects/columns/{column_id}",
{},
{
deprecated: "octokit.rest.projects.updateColumn() is deprecated, see https://docs.github.com/rest/projects/columns#update-an-existing-project-column"
}
]
}, },
pulls: { pulls: {
checkIfMerged: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/merge"], checkIfMerged: ["GET /repos/{owner}/{repo}/pulls/{pull_number}/merge"],
@ -35476,12 +35223,6 @@ const Endpoints = {
], ],
getRepoRuleSuites: ["GET /repos/{owner}/{repo}/rulesets/rule-suites"], getRepoRuleSuites: ["GET /repos/{owner}/{repo}/rulesets/rule-suites"],
getRepoRuleset: ["GET /repos/{owner}/{repo}/rulesets/{ruleset_id}"], getRepoRuleset: ["GET /repos/{owner}/{repo}/rulesets/{ruleset_id}"],
getRepoRulesetHistory: [
"GET /repos/{owner}/{repo}/rulesets/{ruleset_id}/history"
],
getRepoRulesetVersion: [
"GET /repos/{owner}/{repo}/rulesets/{ruleset_id}/history/{version_id}"
],
getRepoRulesets: ["GET /repos/{owner}/{repo}/rulesets"], getRepoRulesets: ["GET /repos/{owner}/{repo}/rulesets"],
getStatusChecksProtection: [ getStatusChecksProtection: [
"GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks" "GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks"
@ -35655,13 +35396,7 @@ const Endpoints = {
search: { search: {
code: ["GET /search/code"], code: ["GET /search/code"],
commits: ["GET /search/commits"], commits: ["GET /search/commits"],
issuesAndPullRequests: [ issuesAndPullRequests: ["GET /search/issues"],
"GET /search/issues",
{},
{
deprecated: "octokit.rest.search.issuesAndPullRequests() is deprecated, see https://docs.github.com/rest/search/search#search-issues-and-pull-requests"
}
],
labels: ["GET /search/labels"], labels: ["GET /search/labels"],
repos: ["GET /search/repositories"], repos: ["GET /search/repositories"],
topics: ["GET /search/topics"], topics: ["GET /search/topics"],
@ -35716,35 +35451,13 @@ const Endpoints = {
"PUT /orgs/{org}/teams/{team_slug}/memberships/{username}" "PUT /orgs/{org}/teams/{team_slug}/memberships/{username}"
], ],
addOrUpdateProjectPermissionsInOrg: [ addOrUpdateProjectPermissionsInOrg: [
"PUT /orgs/{org}/teams/{team_slug}/projects/{project_id}", "PUT /orgs/{org}/teams/{team_slug}/projects/{project_id}"
{},
{
deprecated: "octokit.rest.teams.addOrUpdateProjectPermissionsInOrg() is deprecated, see https://docs.github.com/rest/teams/teams#add-or-update-team-project-permissions"
}
],
addOrUpdateProjectPermissionsLegacy: [
"PUT /teams/{team_id}/projects/{project_id}",
{},
{
deprecated: "octokit.rest.teams.addOrUpdateProjectPermissionsLegacy() is deprecated, see https://docs.github.com/rest/teams/teams#add-or-update-team-project-permissions-legacy"
}
], ],
addOrUpdateRepoPermissionsInOrg: [ addOrUpdateRepoPermissionsInOrg: [
"PUT /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}" "PUT /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}"
], ],
checkPermissionsForProjectInOrg: [ checkPermissionsForProjectInOrg: [
"GET /orgs/{org}/teams/{team_slug}/projects/{project_id}", "GET /orgs/{org}/teams/{team_slug}/projects/{project_id}"
{},
{
deprecated: "octokit.rest.teams.checkPermissionsForProjectInOrg() is deprecated, see https://docs.github.com/rest/teams/teams#check-team-permissions-for-a-project"
}
],
checkPermissionsForProjectLegacy: [
"GET /teams/{team_id}/projects/{project_id}",
{},
{
deprecated: "octokit.rest.teams.checkPermissionsForProjectLegacy() is deprecated, see https://docs.github.com/rest/teams/teams#check-team-permissions-for-a-project-legacy"
}
], ],
checkPermissionsForRepoInOrg: [ checkPermissionsForRepoInOrg: [
"GET /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}" "GET /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}"
@ -35782,37 +35495,13 @@ const Endpoints = {
listPendingInvitationsInOrg: [ listPendingInvitationsInOrg: [
"GET /orgs/{org}/teams/{team_slug}/invitations" "GET /orgs/{org}/teams/{team_slug}/invitations"
], ],
listProjectsInOrg: [ listProjectsInOrg: ["GET /orgs/{org}/teams/{team_slug}/projects"],
"GET /orgs/{org}/teams/{team_slug}/projects",
{},
{
deprecated: "octokit.rest.teams.listProjectsInOrg() is deprecated, see https://docs.github.com/rest/teams/teams#list-team-projects"
}
],
listProjectsLegacy: [
"GET /teams/{team_id}/projects",
{},
{
deprecated: "octokit.rest.teams.listProjectsLegacy() is deprecated, see https://docs.github.com/rest/teams/teams#list-team-projects-legacy"
}
],
listReposInOrg: ["GET /orgs/{org}/teams/{team_slug}/repos"], listReposInOrg: ["GET /orgs/{org}/teams/{team_slug}/repos"],
removeMembershipForUserInOrg: [ removeMembershipForUserInOrg: [
"DELETE /orgs/{org}/teams/{team_slug}/memberships/{username}" "DELETE /orgs/{org}/teams/{team_slug}/memberships/{username}"
], ],
removeProjectInOrg: [ removeProjectInOrg: [
"DELETE /orgs/{org}/teams/{team_slug}/projects/{project_id}", "DELETE /orgs/{org}/teams/{team_slug}/projects/{project_id}"
{},
{
deprecated: "octokit.rest.teams.removeProjectInOrg() is deprecated, see https://docs.github.com/rest/teams/teams#remove-a-project-from-a-team"
}
],
removeProjectLegacy: [
"DELETE /teams/{team_id}/projects/{project_id}",
{},
{
deprecated: "octokit.rest.teams.removeProjectLegacy() is deprecated, see https://docs.github.com/rest/teams/teams#remove-a-project-from-a-team-legacy"
}
], ],
removeRepoInOrg: [ removeRepoInOrg: [
"DELETE /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}" "DELETE /orgs/{org}/teams/{team_slug}/repos/{owner}/{repo}"
@ -36127,9 +35816,8 @@ function wrapRequest(state, request, options) {
return state.retryLimiter.schedule(doRequest, state, request, options); return state.retryLimiter.schedule(doRequest, state, request, options);
} }
async function doRequest(state, request, options) { async function doRequest(state, request, options) {
const isWrite = options.method !== "GET" && options.method !== "HEAD";
const { pathname } = new URL(options.url, "http://github.test"); const { pathname } = new URL(options.url, "http://github.test");
const isAuth = isAuthRequest(options.method, pathname);
const isWrite = !isAuth && options.method !== "GET" && options.method !== "HEAD";
const isSearch = options.method === "GET" && pathname.startsWith("/search/"); const isSearch = options.method === "GET" && pathname.startsWith("/search/");
const isGraphQL = pathname.startsWith("/graphql"); const isGraphQL = pathname.startsWith("/graphql");
const retryCount = ~~request.retryCount; const retryCount = ~~request.retryCount;
@ -36146,7 +35834,7 @@ async function doRequest(state, request, options) {
if (isSearch) { if (isSearch) {
await state.search.key(state.id).schedule(jobOptions, noop); await state.search.key(state.id).schedule(jobOptions, noop);
} }
const req = (isAuth ? state.auth : state.global).key(state.id).schedule(jobOptions, request, options); const req = state.global.key(state.id).schedule(jobOptions, request, options);
if (isGraphQL) { if (isGraphQL) {
const res = await req; const res = await req;
if (res.data.errors != null && res.data.errors.some((error) => error.type === "RATE_LIMITED")) { if (res.data.errors != null && res.data.errors.some((error) => error.type === "RATE_LIMITED")) {
@ -36159,13 +35847,6 @@ async function doRequest(state, request, options) {
} }
return req; return req;
} }
function isAuthRequest(method, pathname) {
return method === "PATCH" && // https://docs.github.com/en/rest/apps/apps?apiVersion=2022-11-28#create-a-scoped-access-token
/^\/applications\/[^/]+\/token\/scoped$/.test(pathname) || method === "POST" && // https://docs.github.com/en/rest/apps/oauth-applications?apiVersion=2022-11-28#reset-a-token
(/^\/applications\/[^/]+\/token$/.test(pathname) || // https://docs.github.com/en/rest/apps/apps?apiVersion=2022-11-28#create-an-installation-access-token-for-an-app
/^\/app\/installations\/[^/]+\/access_tokens$/.test(pathname) || // https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/authorizing-oauth-apps
pathname === "/login/oauth/access_token");
}
// pkg/dist-src/generated/triggers-notification-paths.js // pkg/dist-src/generated/triggers-notification-paths.js
var triggers_notification_paths_default = [ var triggers_notification_paths_default = [
@ -36209,11 +35890,6 @@ var createGroups = function(Bottleneck, common) {
maxConcurrent: 10, maxConcurrent: 10,
...common ...common
}); });
groups.auth = new Bottleneck.Group({
id: "octokit-auth",
maxConcurrent: 1,
...common
});
groups.search = new Bottleneck.Group({ groups.search = new Bottleneck.Group({
id: "octokit-search", id: "octokit-search",
maxConcurrent: 1, maxConcurrent: 1,

View File

@ -150,7 +150,7 @@ There are a number of workarounds with different pros and cons.
- Use the default `GITHUB_TOKEN` and allow the action to create pull requests that have no checks enabled. Manually close pull requests and immediately reopen them. This will enable `on: pull_request` workflows to run and be added as checks. To prevent merging of pull requests without checks erroneously, use [branch protection rules](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests). - Use the default `GITHUB_TOKEN` and allow the action to create pull requests that have no checks enabled. Manually close pull requests and immediately reopen them. This will enable `on: pull_request` workflows to run and be added as checks. To prevent merging of pull requests without checks erroneously, use [branch protection rules](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests).
- Create draft pull requests by setting the `draft: always-true` input, and configure your workflow to trigger `ready_for_review` in `on: pull_request`. The workflow will run when users manually click the "Ready for review" button on the draft pull requests. If the pull request is updated by the action, the `always-true` mode ensures that the pull request will be converted back to a draft. - Create draft pull requests by setting the `draft: always-true` input, and configure your workflow to trigger `on: ready_for_review`. The workflow will run when users manually click the "Ready for review" button on the draft pull requests. If the pull request is updated by the action, the `always-true` mode ensures that the pull request will be converted back to a draft.
- Use a [Personal Access Token (PAT)](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) created on an account that has write access to the repository that pull requests are being created in. This is the standard workaround and [recommended by GitHub](https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow). It's advisable to use a dedicated [machine account](https://docs.github.com/en/github/site-policy/github-terms-of-service#3-account-requirements) that has collaborator access to the repository, rather than creating a PAT on a personal user account. Also note that because the account that owns the PAT will be the creator of pull requests, that user account will be unable to perform actions such as request changes or approve the pull request. - Use a [Personal Access Token (PAT)](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) created on an account that has write access to the repository that pull requests are being created in. This is the standard workaround and [recommended by GitHub](https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow). It's advisable to use a dedicated [machine account](https://docs.github.com/en/github/site-policy/github-terms-of-service#3-account-requirements) that has collaborator access to the repository, rather than creating a PAT on a personal user account. Also note that because the account that owns the PAT will be the creator of pull requests, that user account will be unable to perform actions such as request changes or approve the pull request.
@ -197,9 +197,8 @@ Checking out a branch from a different repository from where the workflow is exe
Allowing the action to push with a configured deploy key will trigger `on: push` workflows. This makes it an alternative to using a PAT to trigger checks for pull requests. Allowing the action to push with a configured deploy key will trigger `on: push` workflows. This makes it an alternative to using a PAT to trigger checks for pull requests.
> [!NOTE] > [!NOTE]
> - You cannot use deploy keys alone to [create a pull request in a remote repository](#creating-pull-requests-in-a-remote-repository) because then using a PAT would become a requirement. > You cannot use deploy keys alone to [create a pull request in a remote repository](#creating-pull-requests-in-a-remote-repository) because then using a PAT would become a requirement.
> This method only makes sense if creating a pull request in the repository where the workflow is running. > This method only makes sense if creating a pull request in the repository where the workflow is running.
> - You cannot use deploy keys with [commit signature verification for bots](#commit-signature-verification-for-bots) (`sign-commits: true`).
How to use SSH (deploy keys) with create-pull-request action: How to use SSH (deploy keys) with create-pull-request action:
@ -272,7 +271,7 @@ The `token` input will then default to the repository's `GITHUB_TOKEN`, which wi
The following is an example of pushing to a fork using GitHub App tokens. The following is an example of pushing to a fork using GitHub App tokens.
```yaml ```yaml
- uses: actions/create-github-app-token@v2 - uses: actions/create-github-app-token@v1
id: generate-token id: generate-token
with: with:
app-id: ${{ secrets.APP_ID }} app-id: ${{ secrets.APP_ID }}
@ -319,7 +318,7 @@ GitHub App generated tokens can be configured with fine-grained permissions and
```yaml ```yaml
steps: steps:
- uses: actions/create-github-app-token@v2 - uses: actions/create-github-app-token@v1
id: generate-token id: generate-token
with: with:
app-id: ${{ secrets.APP_ID }} app-id: ${{ secrets.APP_ID }}
@ -342,7 +341,7 @@ For this case a token must be generated from the GitHub App installation of the
In the following example, a pull request is being created in remote repo `owner/repo`. In the following example, a pull request is being created in remote repo `owner/repo`.
```yaml ```yaml
steps: steps:
- uses: actions/create-github-app-token@v2 - uses: actions/create-github-app-token@v1
id: generate-token id: generate-token
with: with:
app-id: ${{ secrets.APP_ID }} app-id: ${{ secrets.APP_ID }}
@ -397,7 +396,7 @@ In this example, the `token` input is generated using a GitHub App. This will si
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: actions/create-github-app-token@v2 - uses: actions/create-github-app-token@v1
id: generate-token id: generate-token
with: with:
app-id: ${{ secrets.APP_ID }} app-id: ${{ secrets.APP_ID }}

1796
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -31,33 +31,33 @@
"dependencies": { "dependencies": {
"@actions/core": "^1.11.1", "@actions/core": "^1.11.1",
"@actions/exec": "^1.1.1", "@actions/exec": "^1.1.1",
"@octokit/core": "^6.1.6", "@octokit/core": "^6.1.3",
"@octokit/plugin-paginate-rest": "^11.6.0", "@octokit/plugin-paginate-rest": "^11.4.0",
"@octokit/plugin-rest-endpoint-methods": "^13.5.0", "@octokit/plugin-rest-endpoint-methods": "^13.3.0",
"@octokit/plugin-throttling": "^9.6.1", "@octokit/plugin-throttling": "^9.4.0",
"node-fetch-native": "^1.6.6", "node-fetch-native": "^1.6.6",
"p-limit": "^6.2.0", "p-limit": "^6.2.0",
"uuid": "^9.0.1" "uuid": "^9.0.1"
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^29.5.14", "@types/jest": "^29.5.14",
"@types/node": "^18.19.119", "@types/node": "^18.19.74",
"@typescript-eslint/eslint-plugin": "^7.18.0", "@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0", "@typescript-eslint/parser": "^7.18.0",
"@vercel/ncc": "^0.38.3", "@vercel/ncc": "^0.38.3",
"eslint": "^8.57.1", "eslint": "^8.57.1",
"eslint-import-resolver-typescript": "^3.10.1", "eslint-import-resolver-typescript": "^3.7.0",
"eslint-plugin-github": "^4.10.2", "eslint-plugin-github": "^4.10.2",
"eslint-plugin-import": "^2.32.0", "eslint-plugin-import": "^2.31.0",
"eslint-plugin-jest": "^27.9.0", "eslint-plugin-jest": "^27.9.0",
"eslint-plugin-prettier": "^5.5.1", "eslint-plugin-prettier": "^5.2.3",
"jest": "^29.7.0", "jest": "^29.7.0",
"jest-circus": "^29.7.0", "jest-circus": "^29.7.0",
"jest-environment-jsdom": "^29.7.0", "jest-environment-jsdom": "^29.7.0",
"js-yaml": "^4.1.0", "js-yaml": "^4.1.0",
"prettier": "^3.6.2", "prettier": "^3.4.2",
"ts-jest": "^29.4.0", "ts-jest": "^29.2.5",
"typescript": "^5.8.3", "typescript": "^5.7.3",
"undici": "^6.21.3" "undici": "^6.21.1"
} }
} }

View File

@ -19,7 +19,7 @@ export async function getWorkingBaseAndType(
): Promise<[string, WorkingBaseType]> { ): Promise<[string, WorkingBaseType]> {
const symbolicRefResult = await git.exec( const symbolicRefResult = await git.exec(
['symbolic-ref', 'HEAD', '--short'], ['symbolic-ref', 'HEAD', '--short'],
{allowAllExitCodes: true} true
) )
if (symbolicRefResult.exitCode == 0) { if (symbolicRefResult.exitCode == 0) {
// A ref is checked out // A ref is checked out
@ -200,7 +200,7 @@ export async function createOrUpdateBranch(
} else { } else {
aopts.push('-A') aopts.push('-A')
} }
await git.exec(aopts, {allowAllExitCodes: true}) await git.exec(aopts, true)
const popts = ['-m', commitMessage] const popts = ['-m', commitMessage]
if (signoff) { if (signoff) {
popts.push('--signoff') popts.push('--signoff')

View File

@ -213,7 +213,6 @@ export async function createPullRequest(inputs: Inputs): Promise<void> {
const stashed = await git.stashPush(['--include-untracked']) const stashed = await git.stashPush(['--include-untracked'])
await git.checkout(inputs.branch) await git.checkout(inputs.branch)
const pushSignedCommitsResult = await ghBranch.pushSignedCommits( const pushSignedCommitsResult = await ghBranch.pushSignedCommits(
git,
result.branchCommits, result.branchCommits,
result.baseCommit, result.baseCommit,
repoPath, repoPath,

View File

@ -2,7 +2,6 @@ import * as exec from '@actions/exec'
import * as io from '@actions/io' import * as io from '@actions/io'
import * as utils from './utils' import * as utils from './utils'
import * as path from 'path' import * as path from 'path'
import stream, {Writable} from 'stream'
const tagsRefSpec = '+refs/tags/*:refs/tags/*' const tagsRefSpec = '+refs/tags/*:refs/tags/*'
@ -22,12 +21,6 @@ export type Commit = {
unparsedChanges: string[] unparsedChanges: string[]
} }
export type ExecOpts = {
allowAllExitCodes?: boolean
encoding?: 'utf8' | 'base64'
suppressGitCmdOutput?: boolean
}
export class GitCommandManager { export class GitCommandManager {
private gitPath: string private gitPath: string
private workingDirectory: string private workingDirectory: string
@ -73,7 +66,7 @@ export class GitCommandManager {
args.push(...options) args.push(...options)
} }
return await this.exec(args, {allowAllExitCodes: allowAllExitCodes}) return await this.exec(args, allowAllExitCodes)
} }
async commit( async commit(
@ -89,7 +82,7 @@ export class GitCommandManager {
args.push(...options) args.push(...options)
} }
return await this.exec(args, {allowAllExitCodes: allowAllExitCodes}) return await this.exec(args, allowAllExitCodes)
} }
async config( async config(
@ -120,7 +113,7 @@ export class GitCommandManager {
configKey, configKey,
configValue configValue
], ],
{allowAllExitCodes: true} true
) )
return output.exitCode === 0 return output.exitCode === 0
} }
@ -163,20 +156,17 @@ export class GitCommandManager {
async getCommit(ref: string): Promise<Commit> { async getCommit(ref: string): Promise<Commit> {
const endOfBody = '###EOB###' const endOfBody = '###EOB###'
const output = await this.exec( const output = await this.exec([
[ '-c',
'-c', 'core.quotePath=false',
'core.quotePath=false', 'show',
'show', '--raw',
'--raw', '--cc',
'--cc', '--no-renames',
'--no-renames', '--no-abbrev',
'--no-abbrev', `--format=%H%n%T%n%P%n%G?%n%s%n%b%n${endOfBody}`,
`--format=%H%n%T%n%P%n%G?%n%s%n%b%n${endOfBody}`, ref
ref ])
],
{suppressGitCmdOutput: true}
)
const lines = output.stdout.split('\n') const lines = output.stdout.split('\n')
const endOfBodyIndex = lines.lastIndexOf(endOfBody) const endOfBodyIndex = lines.lastIndexOf(endOfBody)
const detailLines = lines.slice(0, endOfBodyIndex) const detailLines = lines.slice(0, endOfBodyIndex)
@ -232,7 +222,7 @@ export class GitCommandManager {
if (options) { if (options) {
args.push(...options) args.push(...options)
} }
const output = await this.exec(args, {allowAllExitCodes: true}) const output = await this.exec(args, true)
return output.exitCode === 1 return output.exitCode === 1
} }
@ -288,15 +278,6 @@ export class GitCommandManager {
return output.stdout.trim() return output.stdout.trim()
} }
async showFileAtRefBase64(ref: string, path: string): Promise<string> {
const args = ['show', `${ref}:${path}`]
const output = await this.exec(args, {
encoding: 'base64',
suppressGitCmdOutput: true
})
return output.stdout.trim()
}
async stashPush(options?: string[]): Promise<boolean> { async stashPush(options?: string[]): Promise<boolean> {
const args = ['stash', 'push'] const args = ['stash', 'push']
if (options) { if (options) {
@ -345,7 +326,7 @@ export class GitCommandManager {
configKey, configKey,
configValue configValue
], ],
{allowAllExitCodes: true} true
) )
return output.exitCode === 0 return output.exitCode === 0
} }
@ -353,7 +334,7 @@ export class GitCommandManager {
async tryGetRemoteUrl(): Promise<string> { async tryGetRemoteUrl(): Promise<string> {
const output = await this.exec( const output = await this.exec(
['config', '--local', '--get', 'remote.origin.url'], ['config', '--local', '--get', 'remote.origin.url'],
{allowAllExitCodes: true} true
) )
if (output.exitCode !== 0) { if (output.exitCode !== 0) {
@ -368,30 +349,16 @@ export class GitCommandManager {
return stdout return stdout
} }
async exec( async exec(args: string[], allowAllExitCodes = false): Promise<GitOutput> {
args: string[],
{
encoding = 'utf8',
allowAllExitCodes = false,
suppressGitCmdOutput = false
}: ExecOpts = {}
): Promise<GitOutput> {
const result = new GitOutput() const result = new GitOutput()
if (process.env['CPR_SHOW_GIT_CMD_OUTPUT']) {
// debug mode overrides the suppressGitCmdOutput option
suppressGitCmdOutput = false
}
const env = {} const env = {}
for (const key of Object.keys(process.env)) { for (const key of Object.keys(process.env)) {
env[key] = process.env[key] env[key] = process.env[key]
} }
const stdout: Buffer[] = [] const stdout: string[] = []
let stdoutLength = 0 const stderr: string[] = []
const stderr: Buffer[] = []
let stderrLength = 0
const options = { const options = {
cwd: this.workingDirectory, cwd: this.workingDirectory,
@ -399,21 +366,17 @@ export class GitCommandManager {
ignoreReturnCode: allowAllExitCodes, ignoreReturnCode: allowAllExitCodes,
listeners: { listeners: {
stdout: (data: Buffer) => { stdout: (data: Buffer) => {
stdout.push(data) stdout.push(data.toString())
stdoutLength += data.length
}, },
stderr: (data: Buffer) => { stderr: (data: Buffer) => {
stderr.push(data) stderr.push(data.toString())
stderrLength += data.length
} }
}, }
outStream: outStreamHandler(process.stdout, suppressGitCmdOutput),
errStream: outStreamHandler(process.stderr, suppressGitCmdOutput)
} }
result.exitCode = await exec.exec(`"${this.gitPath}"`, args, options) result.exitCode = await exec.exec(`"${this.gitPath}"`, args, options)
result.stdout = Buffer.concat(stdout, stdoutLength).toString(encoding) result.stdout = stdout.join('')
result.stderr = Buffer.concat(stderr, stderrLength).toString(encoding) result.stderr = stderr.join('')
return result return result
} }
} }
@ -423,24 +386,3 @@ class GitOutput {
stderr = '' stderr = ''
exitCode = 0 exitCode = 0
} }
const outStreamHandler = (
outStream: Writable,
suppressGitCmdOutput: boolean
): Writable => {
return new stream.Writable({
write(chunk, _, next) {
if (suppressGitCmdOutput) {
const lines = chunk.toString().trimEnd().split('\n')
for (const line of lines) {
if (line.startsWith('[command]')) {
outStream.write(`${line}\n`)
}
}
} else {
outStream.write(chunk)
}
next()
}
})
}

View File

@ -1,6 +1,6 @@
import * as core from '@actions/core' import * as core from '@actions/core'
import {Inputs} from './create-pull-request' import {Inputs} from './create-pull-request'
import {Commit, GitCommandManager} from './git-command-manager' import {Commit} from './git-command-manager'
import {Octokit, OctokitOptions, throttleOptions} from './octokit-client' import {Octokit, OctokitOptions, throttleOptions} from './octokit-client'
import pLimit from 'p-limit' import pLimit from 'p-limit'
import * as utils from './utils' import * as utils from './utils'
@ -254,7 +254,6 @@ export class GitHubHelper {
} }
async pushSignedCommits( async pushSignedCommits(
git: GitCommandManager,
branchCommits: Commit[], branchCommits: Commit[],
baseCommit: Commit, baseCommit: Commit,
repoPath: string, repoPath: string,
@ -268,7 +267,6 @@ export class GitHubHelper {
} }
for (const commit of branchCommits) { for (const commit of branchCommits) {
headCommit = await this.createCommit( headCommit = await this.createCommit(
git,
commit, commit,
headCommit, headCommit,
repoPath, repoPath,
@ -280,7 +278,6 @@ export class GitHubHelper {
} }
private async createCommit( private async createCommit(
git: GitCommandManager,
commit: Commit, commit: Commit,
parentCommit: CommitResponse, parentCommit: CommitResponse,
repoPath: string, repoPath: string,
@ -306,10 +303,10 @@ export class GitHubHelper {
let sha: string | null = null let sha: string | null = null
if (status === 'A' || status === 'M') { if (status === 'A' || status === 'M') {
try { try {
const {data: blob} = await blobCreationLimit(async () => const {data: blob} = await blobCreationLimit(() =>
this.octokit.rest.git.createBlob({ this.octokit.rest.git.createBlob({
...repository, ...repository,
content: await git.showFileAtRefBase64(commit.sha, path), content: utils.readFileBase64([repoPath, path]),
encoding: 'base64' encoding: 'base64'
}) })
) )

View File

@ -126,6 +126,16 @@ export function readFile(path: string): string {
return fs.readFileSync(path, 'utf-8') return fs.readFileSync(path, 'utf-8')
} }
export function readFileBase64(pathParts: string[]): string {
const resolvedPath = path.resolve(...pathParts)
if (fs.lstatSync(resolvedPath).isSymbolicLink()) {
return fs
.readlinkSync(resolvedPath, {encoding: 'buffer'})
.toString('base64')
}
return fs.readFileSync(resolvedPath).toString('base64')
}
/* eslint-disable @typescript-eslint/no-explicit-any */ /* eslint-disable @typescript-eslint/no-explicit-any */
function hasErrorCode(error: any): error is {code: string} { function hasErrorCode(error: any): error is {code: string} {
return typeof (error && error.code) === 'string' return typeof (error && error.code) === 'string'