Compare commits
24 Commits
Author | SHA1 | Date | |
---|---|---|---|
8c603dbb04 | |||
d01e0807ef | |||
ce699aa2d1 | |||
9984f611a7 | |||
ff0beed1b2 | |||
ddeca94037 | |||
0fd77ba8cc | |||
c7f493a800 | |||
91664dfb28 | |||
13ec5274b1 | |||
bcf9790963 | |||
88ea447de7 | |||
da928d5fcc | |||
2465e435b9 | |||
37b2bd1eca | |||
eb13e17e17 | |||
a1ecc20658 | |||
ffcad23634 | |||
f4b52b768a | |||
af682c8fcb | |||
7378b23cb0 | |||
370ae6d537 | |||
ae0797ee12 | |||
e05457394a |
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -120,7 +120,7 @@ jobs:
|
|||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
uses: peter-evans/create-pull-request@v3
|
uses: peter-evans/create-pull-request@v3
|
||||||
with:
|
with:
|
||||||
commit-message: Update distribution
|
commit-message: 'build: update distribution'
|
||||||
title: Update distribution
|
title: Update distribution
|
||||||
body: |
|
body: |
|
||||||
- Updates the distribution for changes on `master`
|
- Updates the distribution for changes on `master`
|
||||||
|
1
.github/workflows/cpr-example-command.yml
vendored
1
.github/workflows/cpr-example-command.yml
vendored
@ -39,6 +39,7 @@ jobs:
|
|||||||
- name: Check output
|
- name: Check output
|
||||||
run: |
|
run: |
|
||||||
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
|
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
|
||||||
|
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
|
||||||
|
|
||||||
- name: Add reaction
|
- name: Add reaction
|
||||||
uses: peter-evans/create-or-update-comment@v1
|
uses: peter-evans/create-or-update-comment@v1
|
||||||
|
2
.github/workflows/update-dep.yml
vendored
2
.github/workflows/update-dep.yml
vendored
@ -18,7 +18,7 @@ jobs:
|
|||||||
uses: peter-evans/create-pull-request@v3
|
uses: peter-evans/create-pull-request@v3
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.ACTIONS_BOT_TOKEN }}
|
token: ${{ secrets.ACTIONS_BOT_TOKEN }}
|
||||||
commit-message: Update dependencies
|
commit-message: 'chore: update dependencies'
|
||||||
committer: GitHub <noreply@github.com>
|
committer: GitHub <noreply@github.com>
|
||||||
author: actions-bot <actions-bot@users.noreply.github.com>
|
author: actions-bot <actions-bot@users.noreply.github.com>
|
||||||
title: Update dependencies
|
title: Update dependencies
|
||||||
|
@ -66,8 +66,8 @@ All inputs are **optional**. If not set, sensible defaults will be used.
|
|||||||
|
|
||||||
### Action outputs
|
### Action outputs
|
||||||
|
|
||||||
The pull request number is output as a step output.
|
The pull request number and URL are available as step outputs.
|
||||||
Note that in order to read the step output the action step must have an id.
|
Note that in order to read the step outputs the action step must have an id.
|
||||||
|
|
||||||
```yml
|
```yml
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
@ -76,6 +76,7 @@ Note that in order to read the step output the action step must have an id.
|
|||||||
- name: Check outputs
|
- name: Check outputs
|
||||||
run: |
|
run: |
|
||||||
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
|
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
|
||||||
|
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Action behaviour
|
### Action behaviour
|
||||||
@ -196,9 +197,10 @@ jobs:
|
|||||||
milestone: 1
|
milestone: 1
|
||||||
draft: false
|
draft: false
|
||||||
|
|
||||||
- name: Check output
|
- name: Check outputs
|
||||||
run: |
|
run: |
|
||||||
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
|
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
|
||||||
|
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
|
||||||
```
|
```
|
||||||
|
|
||||||
An example based on the above reference configuration creates pull requests that look like this:
|
An example based on the above reference configuration creates pull requests that look like this:
|
||||||
|
289
dist/index.js
vendored
289
dist/index.js
vendored
@ -93,12 +93,6 @@ function isEven(git, branch1, branch2) {
|
|||||||
!(yield isBehind(git, branch1, branch2)));
|
!(yield isBehind(git, branch1, branch2)));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function hasDiff(git, branch1, branch2) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
const result = yield git.diff([`${branch1}..${branch2}`]);
|
|
||||||
return result.length > 0;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
function splitLines(multilineString) {
|
function splitLines(multilineString) {
|
||||||
return multilineString
|
return multilineString
|
||||||
.split('\n')
|
.split('\n')
|
||||||
@ -192,7 +186,7 @@ function createOrUpdateBranch(git, commitMessage, base, branch, branchRemoteName
|
|||||||
// squash merged but not deleted. We need to reset to make sure it doesn't appear
|
// squash merged but not deleted. We need to reset to make sure it doesn't appear
|
||||||
// to have a diff with the base due to different commits for the same changes.
|
// to have a diff with the base due to different commits for the same changes.
|
||||||
// For changes on base this reset is equivalent to a rebase of the pull request branch.
|
// For changes on base this reset is equivalent to a rebase of the pull request branch.
|
||||||
if ((yield hasDiff(git, branch, tempBranch)) ||
|
if ((yield git.hasDiff([`${branch}..${tempBranch}`])) ||
|
||||||
!(yield isAhead(git, base, tempBranch))) {
|
!(yield isAhead(git, base, tempBranch))) {
|
||||||
core.info(`Resetting '${branch}'`);
|
core.info(`Resetting '${branch}'`);
|
||||||
// Alternatively, git switch -C branch tempBranch
|
// Alternatively, git switch -C branch tempBranch
|
||||||
@ -321,6 +315,12 @@ function createPullRequest(inputs) {
|
|||||||
if (branchRemoteName == 'origin' && base == inputs.branch) {
|
if (branchRemoteName == 'origin' && base == inputs.branch) {
|
||||||
throw new Error(`The 'base' and 'branch' for a pull request must be different branches. Unable to continue.`);
|
throw new Error(`The 'base' and 'branch' for a pull request must be different branches. Unable to continue.`);
|
||||||
}
|
}
|
||||||
|
// For self-hosted runners the repository state persists between runs.
|
||||||
|
// This command prunes the stale remote ref when the pull request branch was
|
||||||
|
// deleted after being merged or closed. Without this the push using
|
||||||
|
// '--force-with-lease' fails due to "stale info."
|
||||||
|
// https://github.com/peter-evans/create-pull-request/issues/633
|
||||||
|
yield git.exec(['remote', 'prune', branchRemoteName]);
|
||||||
core.endGroup();
|
core.endGroup();
|
||||||
// Apply the branch suffix if set
|
// Apply the branch suffix if set
|
||||||
if (inputs.branchSuffix) {
|
if (inputs.branchSuffix) {
|
||||||
@ -662,16 +662,6 @@ class GitCommandManager {
|
|||||||
return output.exitCode === 0;
|
return output.exitCode === 0;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
diff(options) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
const args = ['-c', 'core.pager=cat', 'diff'];
|
|
||||||
if (options) {
|
|
||||||
args.push(...options);
|
|
||||||
}
|
|
||||||
const output = yield this.exec(args);
|
|
||||||
return output.stdout.trim();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
fetch(refSpec, remoteName, options) {
|
fetch(refSpec, remoteName, options) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const args = ['-c', 'protocol.version=2', 'fetch'];
|
const args = ['-c', 'protocol.version=2', 'fetch'];
|
||||||
@ -712,19 +702,28 @@ class GitCommandManager {
|
|||||||
getWorkingDirectory() {
|
getWorkingDirectory() {
|
||||||
return this.workingDirectory;
|
return this.workingDirectory;
|
||||||
}
|
}
|
||||||
|
hasDiff(options) {
|
||||||
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
const args = ['diff', '--quiet'];
|
||||||
|
if (options) {
|
||||||
|
args.push(...options);
|
||||||
|
}
|
||||||
|
const output = yield this.exec(args, true);
|
||||||
|
return output.exitCode === 1;
|
||||||
|
});
|
||||||
|
}
|
||||||
isDirty(untracked) {
|
isDirty(untracked) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const diffArgs = ['--abbrev=40', '--full-index', '--raw'];
|
// Check untracked changes
|
||||||
// Check staged changes
|
if (untracked && (yield this.status(['--porcelain', '-unormal']))) {
|
||||||
if (yield this.diff([...diffArgs, '--staged'])) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Check working index changes
|
// Check working index changes
|
||||||
if (yield this.diff(diffArgs)) {
|
if (yield this.hasDiff()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Check untracked changes
|
// Check staged changes
|
||||||
if (untracked && (yield this.status(['--porcelain', '-unormal']))) {
|
if (yield this.hasDiff(['--staged'])) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -906,11 +905,17 @@ class GitHubHelper {
|
|||||||
try {
|
try {
|
||||||
const { data: pull } = yield this.octokit.pulls.create(Object.assign(Object.assign({}, this.parseRepository(baseRepository)), { title: inputs.title, head: headBranch, base: inputs.base, body: inputs.body, draft: inputs.draft }));
|
const { data: pull } = yield this.octokit.pulls.create(Object.assign(Object.assign({}, this.parseRepository(baseRepository)), { title: inputs.title, head: headBranch, base: inputs.base, body: inputs.body, draft: inputs.draft }));
|
||||||
core.info(`Created pull request #${pull.number} (${headBranch} => ${inputs.base})`);
|
core.info(`Created pull request #${pull.number} (${headBranch} => ${inputs.base})`);
|
||||||
return pull.number;
|
return {
|
||||||
|
number: pull.number,
|
||||||
|
html_url: pull.html_url
|
||||||
|
};
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
if (!e.message ||
|
if (e.message &&
|
||||||
!e.message.includes(`A pull request already exists for ${headBranch}`)) {
|
e.message.includes(`A pull request already exists for ${headBranch}`)) {
|
||||||
|
core.info(`A pull request already exists for ${headBranch}`);
|
||||||
|
}
|
||||||
|
else {
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -918,7 +923,10 @@ class GitHubHelper {
|
|||||||
const { data: pulls } = yield this.octokit.pulls.list(Object.assign(Object.assign({}, this.parseRepository(baseRepository)), { state: 'open', head: headBranch, base: inputs.base }));
|
const { data: pulls } = yield this.octokit.pulls.list(Object.assign(Object.assign({}, this.parseRepository(baseRepository)), { state: 'open', head: headBranch, base: inputs.base }));
|
||||||
const { data: pull } = yield this.octokit.pulls.update(Object.assign(Object.assign({}, this.parseRepository(baseRepository)), { pull_number: pulls[0].number, title: inputs.title, body: inputs.body, draft: inputs.draft }));
|
const { data: pull } = yield this.octokit.pulls.update(Object.assign(Object.assign({}, this.parseRepository(baseRepository)), { pull_number: pulls[0].number, title: inputs.title, body: inputs.body, draft: inputs.draft }));
|
||||||
core.info(`Updated pull request #${pull.number} (${headBranch} => ${inputs.base})`);
|
core.info(`Updated pull request #${pull.number} (${headBranch} => ${inputs.base})`);
|
||||||
return pull.number;
|
return {
|
||||||
|
number: pull.number,
|
||||||
|
html_url: pull.html_url
|
||||||
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
getRepositoryParent(headRepository) {
|
getRepositoryParent(headRepository) {
|
||||||
@ -935,11 +943,13 @@ class GitHubHelper {
|
|||||||
const [headOwner] = headRepository.split('/');
|
const [headOwner] = headRepository.split('/');
|
||||||
const headBranch = `${headOwner}:${inputs.branch}`;
|
const headBranch = `${headOwner}:${inputs.branch}`;
|
||||||
// Create or update the pull request
|
// Create or update the pull request
|
||||||
const pullNumber = yield this.createOrUpdate(inputs, baseRepository, headBranch);
|
const pull = yield this.createOrUpdate(inputs, baseRepository, headBranch);
|
||||||
// Set outputs
|
// Set outputs
|
||||||
core.startGroup('Setting outputs');
|
core.startGroup('Setting outputs');
|
||||||
core.setOutput('pull-request-number', pullNumber);
|
core.setOutput('pull-request-number', pull.number);
|
||||||
core.exportVariable('PULL_REQUEST_NUMBER', pullNumber);
|
core.setOutput('pull-request-url', pull.html_url);
|
||||||
|
// Deprecated
|
||||||
|
core.exportVariable('PULL_REQUEST_NUMBER', pull.number);
|
||||||
core.endGroup();
|
core.endGroup();
|
||||||
// Set milestone, labels and assignees
|
// Set milestone, labels and assignees
|
||||||
const updateIssueParams = {};
|
const updateIssueParams = {};
|
||||||
@ -956,7 +966,7 @@ class GitHubHelper {
|
|||||||
core.info(`Applying assignees '${inputs.assignees}'`);
|
core.info(`Applying assignees '${inputs.assignees}'`);
|
||||||
}
|
}
|
||||||
if (Object.keys(updateIssueParams).length > 0) {
|
if (Object.keys(updateIssueParams).length > 0) {
|
||||||
yield this.octokit.issues.update(Object.assign(Object.assign(Object.assign({}, this.parseRepository(baseRepository)), { issue_number: pullNumber }), updateIssueParams));
|
yield this.octokit.issues.update(Object.assign(Object.assign(Object.assign({}, this.parseRepository(baseRepository)), { issue_number: pull.number }), updateIssueParams));
|
||||||
}
|
}
|
||||||
// Request reviewers and team reviewers
|
// Request reviewers and team reviewers
|
||||||
const requestReviewersParams = {};
|
const requestReviewersParams = {};
|
||||||
@ -970,7 +980,7 @@ class GitHubHelper {
|
|||||||
}
|
}
|
||||||
if (Object.keys(requestReviewersParams).length > 0) {
|
if (Object.keys(requestReviewersParams).length > 0) {
|
||||||
try {
|
try {
|
||||||
yield this.octokit.pulls.requestReviewers(Object.assign(Object.assign(Object.assign({}, this.parseRepository(baseRepository)), { pull_number: pullNumber }), requestReviewersParams));
|
yield this.octokit.pulls.requestReviewers(Object.assign(Object.assign(Object.assign({}, this.parseRepository(baseRepository)), { pull_number: pull.number }), requestReviewersParams));
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
if (e.message && e.message.includes(ERROR_PR_REVIEW_FROM_AUTHOR)) {
|
if (e.message && e.message.includes(ERROR_PR_REVIEW_FROM_AUTHOR)) {
|
||||||
@ -1229,6 +1239,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
const os = __importStar(__webpack_require__(87));
|
const os = __importStar(__webpack_require__(87));
|
||||||
|
const utils_1 = __webpack_require__(278);
|
||||||
/**
|
/**
|
||||||
* Commands
|
* Commands
|
||||||
*
|
*
|
||||||
@ -1282,28 +1293,14 @@ class Command {
|
|||||||
return cmdStr;
|
return cmdStr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
|
||||||
* @param input input to sanitize into a string
|
|
||||||
*/
|
|
||||||
function toCommandValue(input) {
|
|
||||||
if (input === null || input === undefined) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
else if (typeof input === 'string' || input instanceof String) {
|
|
||||||
return input;
|
|
||||||
}
|
|
||||||
return JSON.stringify(input);
|
|
||||||
}
|
|
||||||
exports.toCommandValue = toCommandValue;
|
|
||||||
function escapeData(s) {
|
function escapeData(s) {
|
||||||
return toCommandValue(s)
|
return utils_1.toCommandValue(s)
|
||||||
.replace(/%/g, '%25')
|
.replace(/%/g, '%25')
|
||||||
.replace(/\r/g, '%0D')
|
.replace(/\r/g, '%0D')
|
||||||
.replace(/\n/g, '%0A');
|
.replace(/\n/g, '%0A');
|
||||||
}
|
}
|
||||||
function escapeProperty(s) {
|
function escapeProperty(s) {
|
||||||
return toCommandValue(s)
|
return utils_1.toCommandValue(s)
|
||||||
.replace(/%/g, '%25')
|
.replace(/%/g, '%25')
|
||||||
.replace(/\r/g, '%0D')
|
.replace(/\r/g, '%0D')
|
||||||
.replace(/\n/g, '%0A')
|
.replace(/\n/g, '%0A')
|
||||||
@ -1337,6 +1334,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
const command_1 = __webpack_require__(351);
|
const command_1 = __webpack_require__(351);
|
||||||
|
const file_command_1 = __webpack_require__(717);
|
||||||
|
const utils_1 = __webpack_require__(278);
|
||||||
const os = __importStar(__webpack_require__(87));
|
const os = __importStar(__webpack_require__(87));
|
||||||
const path = __importStar(__webpack_require__(622));
|
const path = __importStar(__webpack_require__(622));
|
||||||
/**
|
/**
|
||||||
@ -1363,10 +1362,18 @@ var ExitCode;
|
|||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
function exportVariable(name, val) {
|
function exportVariable(name, val) {
|
||||||
const convertedVal = command_1.toCommandValue(val);
|
const convertedVal = utils_1.toCommandValue(val);
|
||||||
process.env[name] = convertedVal;
|
process.env[name] = convertedVal;
|
||||||
|
const filePath = process.env['GITHUB_ENV'] || '';
|
||||||
|
if (filePath) {
|
||||||
|
const delimiter = '_GitHubActionsFileCommandDelimeter_';
|
||||||
|
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
|
||||||
|
file_command_1.issueCommand('ENV', commandValue);
|
||||||
|
}
|
||||||
|
else {
|
||||||
command_1.issueCommand('set-env', { name }, convertedVal);
|
command_1.issueCommand('set-env', { name }, convertedVal);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
exports.exportVariable = exportVariable;
|
exports.exportVariable = exportVariable;
|
||||||
/**
|
/**
|
||||||
* Registers a secret which will get masked from logs
|
* Registers a secret which will get masked from logs
|
||||||
@ -1381,7 +1388,13 @@ exports.setSecret = setSecret;
|
|||||||
* @param inputPath
|
* @param inputPath
|
||||||
*/
|
*/
|
||||||
function addPath(inputPath) {
|
function addPath(inputPath) {
|
||||||
|
const filePath = process.env['GITHUB_PATH'] || '';
|
||||||
|
if (filePath) {
|
||||||
|
file_command_1.issueCommand('PATH', inputPath);
|
||||||
|
}
|
||||||
|
else {
|
||||||
command_1.issueCommand('add-path', {}, inputPath);
|
command_1.issueCommand('add-path', {}, inputPath);
|
||||||
|
}
|
||||||
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
||||||
}
|
}
|
||||||
exports.addPath = addPath;
|
exports.addPath = addPath;
|
||||||
@ -1543,6 +1556,68 @@ exports.getState = getState;
|
|||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 717:
|
||||||
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
// For internal use, subject to change.
|
||||||
|
var __importStar = (this && this.__importStar) || function (mod) {
|
||||||
|
if (mod && mod.__esModule) return mod;
|
||||||
|
var result = {};
|
||||||
|
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||||
|
result["default"] = mod;
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
// We use any as a valid input type
|
||||||
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
|
const fs = __importStar(__webpack_require__(747));
|
||||||
|
const os = __importStar(__webpack_require__(87));
|
||||||
|
const utils_1 = __webpack_require__(278);
|
||||||
|
function issueCommand(command, message) {
|
||||||
|
const filePath = process.env[`GITHUB_${command}`];
|
||||||
|
if (!filePath) {
|
||||||
|
throw new Error(`Unable to find environment variable for file command ${command}`);
|
||||||
|
}
|
||||||
|
if (!fs.existsSync(filePath)) {
|
||||||
|
throw new Error(`Missing file at path: ${filePath}`);
|
||||||
|
}
|
||||||
|
fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
|
||||||
|
encoding: 'utf8'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.issueCommand = issueCommand;
|
||||||
|
//# sourceMappingURL=file-command.js.map
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
|
/***/ 278:
|
||||||
|
/***/ ((__unused_webpack_module, exports) => {
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
// We use any as a valid input type
|
||||||
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
/**
|
||||||
|
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
||||||
|
* @param input input to sanitize into a string
|
||||||
|
*/
|
||||||
|
function toCommandValue(input) {
|
||||||
|
if (input === null || input === undefined) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
else if (typeof input === 'string' || input instanceof String) {
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
return JSON.stringify(input);
|
||||||
|
}
|
||||||
|
exports.toCommandValue = toCommandValue;
|
||||||
|
//# sourceMappingURL=utils.js.map
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
|
||||||
/***/ 514:
|
/***/ 514:
|
||||||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||||||
|
|
||||||
@ -3483,7 +3558,7 @@ exports.withCustomRequest = withCustomRequest;
|
|||||||
|
|
||||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||||
|
|
||||||
const VERSION = "2.3.1";
|
const VERSION = "2.4.0";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Some “list” response that can be paginated have a different response structure
|
* Some “list” response that can be paginated have a different response structure
|
||||||
@ -3705,11 +3780,7 @@ const Endpoints = {
|
|||||||
unstarRepoForAuthenticatedUser: ["DELETE /user/starred/{owner}/{repo}"]
|
unstarRepoForAuthenticatedUser: ["DELETE /user/starred/{owner}/{repo}"]
|
||||||
},
|
},
|
||||||
apps: {
|
apps: {
|
||||||
addRepoToInstallation: ["PUT /user/installations/{installation_id}/repositories/{repository_id}", {
|
addRepoToInstallation: ["PUT /user/installations/{installation_id}/repositories/{repository_id}"],
|
||||||
mediaType: {
|
|
||||||
previews: ["machine-man"]
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
checkToken: ["POST /applications/{client_id}/token"],
|
checkToken: ["POST /applications/{client_id}/token"],
|
||||||
createContentAttachment: ["POST /content_references/{content_reference_id}/attachments", {
|
createContentAttachment: ["POST /content_references/{content_reference_id}/attachments", {
|
||||||
mediaType: {
|
mediaType: {
|
||||||
@ -3717,81 +3788,29 @@ const Endpoints = {
|
|||||||
}
|
}
|
||||||
}],
|
}],
|
||||||
createFromManifest: ["POST /app-manifests/{code}/conversions"],
|
createFromManifest: ["POST /app-manifests/{code}/conversions"],
|
||||||
createInstallationAccessToken: ["POST /app/installations/{installation_id}/access_tokens", {
|
createInstallationAccessToken: ["POST /app/installations/{installation_id}/access_tokens"],
|
||||||
mediaType: {
|
|
||||||
previews: ["machine-man"]
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
deleteAuthorization: ["DELETE /applications/{client_id}/grant"],
|
deleteAuthorization: ["DELETE /applications/{client_id}/grant"],
|
||||||
deleteInstallation: ["DELETE /app/installations/{installation_id}", {
|
deleteInstallation: ["DELETE /app/installations/{installation_id}"],
|
||||||
mediaType: {
|
|
||||||
previews: ["machine-man"]
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
deleteToken: ["DELETE /applications/{client_id}/token"],
|
deleteToken: ["DELETE /applications/{client_id}/token"],
|
||||||
getAuthenticated: ["GET /app", {
|
getAuthenticated: ["GET /app"],
|
||||||
mediaType: {
|
getBySlug: ["GET /apps/{app_slug}"],
|
||||||
previews: ["machine-man"]
|
getInstallation: ["GET /app/installations/{installation_id}"],
|
||||||
}
|
getOrgInstallation: ["GET /orgs/{org}/installation"],
|
||||||
}],
|
getRepoInstallation: ["GET /repos/{owner}/{repo}/installation"],
|
||||||
getBySlug: ["GET /apps/{app_slug}", {
|
|
||||||
mediaType: {
|
|
||||||
previews: ["machine-man"]
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
getInstallation: ["GET /app/installations/{installation_id}", {
|
|
||||||
mediaType: {
|
|
||||||
previews: ["machine-man"]
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
getOrgInstallation: ["GET /orgs/{org}/installation", {
|
|
||||||
mediaType: {
|
|
||||||
previews: ["machine-man"]
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
getRepoInstallation: ["GET /repos/{owner}/{repo}/installation", {
|
|
||||||
mediaType: {
|
|
||||||
previews: ["machine-man"]
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
getSubscriptionPlanForAccount: ["GET /marketplace_listing/accounts/{account_id}"],
|
getSubscriptionPlanForAccount: ["GET /marketplace_listing/accounts/{account_id}"],
|
||||||
getSubscriptionPlanForAccountStubbed: ["GET /marketplace_listing/stubbed/accounts/{account_id}"],
|
getSubscriptionPlanForAccountStubbed: ["GET /marketplace_listing/stubbed/accounts/{account_id}"],
|
||||||
getUserInstallation: ["GET /users/{username}/installation", {
|
getUserInstallation: ["GET /users/{username}/installation"],
|
||||||
mediaType: {
|
|
||||||
previews: ["machine-man"]
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
listAccountsForPlan: ["GET /marketplace_listing/plans/{plan_id}/accounts"],
|
listAccountsForPlan: ["GET /marketplace_listing/plans/{plan_id}/accounts"],
|
||||||
listAccountsForPlanStubbed: ["GET /marketplace_listing/stubbed/plans/{plan_id}/accounts"],
|
listAccountsForPlanStubbed: ["GET /marketplace_listing/stubbed/plans/{plan_id}/accounts"],
|
||||||
listInstallationReposForAuthenticatedUser: ["GET /user/installations/{installation_id}/repositories", {
|
listInstallationReposForAuthenticatedUser: ["GET /user/installations/{installation_id}/repositories"],
|
||||||
mediaType: {
|
listInstallations: ["GET /app/installations"],
|
||||||
previews: ["machine-man"]
|
listInstallationsForAuthenticatedUser: ["GET /user/installations"],
|
||||||
}
|
|
||||||
}],
|
|
||||||
listInstallations: ["GET /app/installations", {
|
|
||||||
mediaType: {
|
|
||||||
previews: ["machine-man"]
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
listInstallationsForAuthenticatedUser: ["GET /user/installations", {
|
|
||||||
mediaType: {
|
|
||||||
previews: ["machine-man"]
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
listPlans: ["GET /marketplace_listing/plans"],
|
listPlans: ["GET /marketplace_listing/plans"],
|
||||||
listPlansStubbed: ["GET /marketplace_listing/stubbed/plans"],
|
listPlansStubbed: ["GET /marketplace_listing/stubbed/plans"],
|
||||||
listReposAccessibleToInstallation: ["GET /installation/repositories", {
|
listReposAccessibleToInstallation: ["GET /installation/repositories"],
|
||||||
mediaType: {
|
|
||||||
previews: ["machine-man"]
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
listSubscriptionsForAuthenticatedUser: ["GET /user/marketplace_purchases"],
|
listSubscriptionsForAuthenticatedUser: ["GET /user/marketplace_purchases"],
|
||||||
listSubscriptionsForAuthenticatedUserStubbed: ["GET /user/marketplace_purchases/stubbed"],
|
listSubscriptionsForAuthenticatedUserStubbed: ["GET /user/marketplace_purchases/stubbed"],
|
||||||
removeRepoFromInstallation: ["DELETE /user/installations/{installation_id}/repositories/{repository_id}", {
|
removeRepoFromInstallation: ["DELETE /user/installations/{installation_id}/repositories/{repository_id}"],
|
||||||
mediaType: {
|
|
||||||
previews: ["machine-man"]
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
resetToken: ["PATCH /applications/{client_id}/token"],
|
resetToken: ["PATCH /applications/{client_id}/token"],
|
||||||
revokeInstallationAccessToken: ["DELETE /installation/token"],
|
revokeInstallationAccessToken: ["DELETE /installation/token"],
|
||||||
suspendInstallation: ["PUT /app/installations/{installation_id}/suspended"],
|
suspendInstallation: ["PUT /app/installations/{installation_id}/suspended"],
|
||||||
@ -3863,8 +3882,15 @@ const Endpoints = {
|
|||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
codeScanning: {
|
codeScanning: {
|
||||||
getAlert: ["GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_id}"],
|
getAlert: ["GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}", {}, {
|
||||||
listAlertsForRepo: ["GET /repos/{owner}/{repo}/code-scanning/alerts"]
|
renamedParameters: {
|
||||||
|
alert_id: "alert_number"
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
listAlertsForRepo: ["GET /repos/{owner}/{repo}/code-scanning/alerts"],
|
||||||
|
listRecentAnalyses: ["GET /repos/{owner}/{repo}/code-scanning/analyses"],
|
||||||
|
updateAlert: ["PATCH /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}"],
|
||||||
|
uploadSarif: ["POST /repos/{owner}/{repo}/code-scanning/sarifs"]
|
||||||
},
|
},
|
||||||
codesOfConduct: {
|
codesOfConduct: {
|
||||||
getAllCodesOfConduct: ["GET /codes_of_conduct", {
|
getAllCodesOfConduct: ["GET /codes_of_conduct", {
|
||||||
@ -4106,11 +4132,7 @@ const Endpoints = {
|
|||||||
getMembershipForUser: ["GET /orgs/{org}/memberships/{username}"],
|
getMembershipForUser: ["GET /orgs/{org}/memberships/{username}"],
|
||||||
getWebhook: ["GET /orgs/{org}/hooks/{hook_id}"],
|
getWebhook: ["GET /orgs/{org}/hooks/{hook_id}"],
|
||||||
list: ["GET /organizations"],
|
list: ["GET /organizations"],
|
||||||
listAppInstallations: ["GET /orgs/{org}/installations", {
|
listAppInstallations: ["GET /orgs/{org}/installations"],
|
||||||
mediaType: {
|
|
||||||
previews: ["machine-man"]
|
|
||||||
}
|
|
||||||
}],
|
|
||||||
listBlockedUsers: ["GET /orgs/{org}/blocks"],
|
listBlockedUsers: ["GET /orgs/{org}/blocks"],
|
||||||
listForAuthenticatedUser: ["GET /user/orgs"],
|
listForAuthenticatedUser: ["GET /user/orgs"],
|
||||||
listForUser: ["GET /users/{username}/orgs"],
|
listForUser: ["GET /users/{username}/orgs"],
|
||||||
@ -4723,7 +4745,7 @@ const Endpoints = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const VERSION = "4.1.3";
|
const VERSION = "4.2.0";
|
||||||
|
|
||||||
function endpointsToMethods(octokit, endpointsMap) {
|
function endpointsToMethods(octokit, endpointsMap) {
|
||||||
const newMethods = {};
|
const newMethods = {};
|
||||||
@ -5766,6 +5788,12 @@ function convertBody(buffer, headers) {
|
|||||||
// html4
|
// html4
|
||||||
if (!res && str) {
|
if (!res && str) {
|
||||||
res = /<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(str);
|
res = /<meta[\s]+?http-equiv=(['"])content-type\1[\s]+?content=(['"])(.+?)\2/i.exec(str);
|
||||||
|
if (!res) {
|
||||||
|
res = /<meta[\s]+?content=(['"])(.+?)\1[\s]+?http-equiv=(['"])content-type\3/i.exec(str);
|
||||||
|
if (res) {
|
||||||
|
res.pop(); // drop last quote
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
res = /charset=(.*)/i.exec(res.pop());
|
res = /charset=(.*)/i.exec(res.pop());
|
||||||
@ -6773,7 +6801,7 @@ function fetch(url, opts) {
|
|||||||
// HTTP fetch step 5.5
|
// HTTP fetch step 5.5
|
||||||
switch (request.redirect) {
|
switch (request.redirect) {
|
||||||
case 'error':
|
case 'error':
|
||||||
reject(new FetchError(`redirect mode is set to error: ${request.url}`, 'no-redirect'));
|
reject(new FetchError(`uri requested responds with a redirect, redirect mode is set to error: ${request.url}`, 'no-redirect'));
|
||||||
finalize();
|
finalize();
|
||||||
return;
|
return;
|
||||||
case 'manual':
|
case 'manual':
|
||||||
@ -6812,7 +6840,8 @@ function fetch(url, opts) {
|
|||||||
method: request.method,
|
method: request.method,
|
||||||
body: request.body,
|
body: request.body,
|
||||||
signal: request.signal,
|
signal: request.signal,
|
||||||
timeout: request.timeout
|
timeout: request.timeout,
|
||||||
|
size: request.size
|
||||||
};
|
};
|
||||||
|
|
||||||
// HTTP-redirect fetch step 9
|
// HTTP-redirect fetch step 9
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
- [Misc workflow tips](#misc-workflow-tips)
|
- [Misc workflow tips](#misc-workflow-tips)
|
||||||
- [Filtering push events](#filtering-push-events)
|
- [Filtering push events](#filtering-push-events)
|
||||||
- [Dynamic configuration using variables](#dynamic-configuration-using-variables)
|
- [Dynamic configuration using variables](#dynamic-configuration-using-variables)
|
||||||
|
- [Setting the pull request body from a file](#setting-the-pull-request-body-from-a-file)
|
||||||
- [Debugging GitHub Actions](#debugging-github-actions)
|
- [Debugging GitHub Actions](#debugging-github-actions)
|
||||||
|
|
||||||
|
|
||||||
@ -539,21 +540,6 @@ The recommended method is to use [`set-output`](https://docs.github.com/en/actio
|
|||||||
body: ${{ steps.vars.outputs.pr_body }}
|
body: ${{ steps.vars.outputs.pr_body }}
|
||||||
```
|
```
|
||||||
|
|
||||||
Alternatively, [`set-env`](https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable) can be used to create environment variables.
|
|
||||||
|
|
||||||
```yml
|
|
||||||
- name: Set environment variables
|
|
||||||
run: |
|
|
||||||
echo ::set-env name=PULL_REQUEST_TITLE::"[Test] Add report file $(date +%d-%m-%Y)"
|
|
||||||
echo ::set-env name=PULL_REQUEST_BODY::"This PR was auto-generated on $(date +%d-%m-%Y) \
|
|
||||||
by [create-pull-request](https://github.com/peter-evans/create-pull-request)."
|
|
||||||
- name: Create Pull Request
|
|
||||||
uses: peter-evans/create-pull-request@v3
|
|
||||||
with:
|
|
||||||
title: ${{ env.PULL_REQUEST_TITLE }}
|
|
||||||
body: ${{ env.PULL_REQUEST_BODY }}
|
|
||||||
```
|
|
||||||
|
|
||||||
### Setting the pull request body from a file
|
### Setting the pull request body from a file
|
||||||
|
|
||||||
This example shows how file content can be read into a variable and passed to the action.
|
This example shows how file content can be read into a variable and passed to the action.
|
||||||
|
195
package-lock.json
generated
195
package-lock.json
generated
@ -5,9 +5,9 @@
|
|||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": {
|
"@actions/core": {
|
||||||
"version": "1.2.5",
|
"version": "1.2.6",
|
||||||
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.5.tgz",
|
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.2.6.tgz",
|
||||||
"integrity": "sha512-mwpoNjHSWWh0IiALdDEQi3tru124JKn0yVNziIBzTME8QRv7thwoghVuT1jBRjFvdtoHsqD58IRHy1nf86paRg=="
|
"integrity": "sha512-ZQYitnqiyBc3D+k7LsgSBmMDVkOVidaagDG7j3fOym77jNunWRuYx7VSHa9GNfFZh+zh61xsCjRj4JxMZlDqTA=="
|
||||||
},
|
},
|
||||||
"@actions/exec": {
|
"@actions/exec": {
|
||||||
"version": "1.0.4",
|
"version": "1.0.4",
|
||||||
@ -1079,20 +1079,40 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@octokit/plugin-paginate-rest": {
|
"@octokit/plugin-paginate-rest": {
|
||||||
"version": "2.3.1",
|
"version": "2.4.0",
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.4.0.tgz",
|
||||||
"integrity": "sha512-81A+ONLpcSX7vWxnEmVZteQPNsbdeScSVUqjgMYPSk1trzG69iYkhS42wPRWtN0nYw6OEmT48DNeQCjHeyroYw==",
|
"integrity": "sha512-YT6Klz3LLH6/nNgi0pheJnUmTFW4kVnxGft+v8Itc41IIcjl7y1C8TatmKQBbCSuTSNFXO5pCENnqg6sjwpJhg==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@octokit/types": "^5.3.0"
|
"@octokit/types": "^5.5.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@octokit/types": {
|
||||||
|
"version": "5.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-5.5.0.tgz",
|
||||||
|
"integrity": "sha512-UZ1pErDue6bZNjYOotCNveTXArOMZQFG6hKJfOnGnulVCMcVVi7YIIuuR4WfBhjo7zgpmzn/BkPDnUXtNx+PcQ==",
|
||||||
|
"requires": {
|
||||||
|
"@types/node": ">= 8"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@octokit/plugin-rest-endpoint-methods": {
|
"@octokit/plugin-rest-endpoint-methods": {
|
||||||
"version": "4.1.3",
|
"version": "4.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.2.0.tgz",
|
||||||
"integrity": "sha512-az3seq9yuc0OXlNLrZ0fWTNbFuL4sN8GN1sLmovELg3+LnpWmOs3GAn2KGa6E7SKMgpCuFvJwvsHEfYasTHUxQ==",
|
"integrity": "sha512-1/qn1q1C1hGz6W/iEDm9DoyNoG/xdFDt78E3eZ5hHeUfJTLJgyAMdj9chL/cNBHjcjd+FH5aO1x0VCqR2RE0mw==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"@octokit/types": "^5.1.1",
|
"@octokit/types": "^5.5.0",
|
||||||
"deprecation": "^2.3.1"
|
"deprecation": "^2.3.1"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@octokit/types": {
|
||||||
|
"version": "5.5.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@octokit/types/-/types-5.5.0.tgz",
|
||||||
|
"integrity": "sha512-UZ1pErDue6bZNjYOotCNveTXArOMZQFG6hKJfOnGnulVCMcVVi7YIIuuR4WfBhjo7zgpmzn/BkPDnUXtNx+PcQ==",
|
||||||
|
"requires": {
|
||||||
|
"@types/node": ">= 8"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@octokit/request": {
|
"@octokit/request": {
|
||||||
@ -1235,9 +1255,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@types/jest": {
|
"@types/jest": {
|
||||||
"version": "26.0.13",
|
"version": "26.0.14",
|
||||||
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-26.0.13.tgz",
|
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-26.0.14.tgz",
|
||||||
"integrity": "sha512-sCzjKow4z9LILc6DhBvn5AkIfmQzDZkgtVVKmGwVrs5tuid38ws281D4l+7x1kP487+FlKDh5kfMZ8WSPAdmdA==",
|
"integrity": "sha512-Hz5q8Vu0D288x3iWXePSn53W7hAjP0H7EQ6QvDO9c7t46mR0lNOLlfuwQ+JkVxuhygHzlzPX+0jKdA3ZgSh+Vg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"jest-diff": "^25.2.1",
|
"jest-diff": "^25.2.1",
|
||||||
@ -1257,9 +1277,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@types/node": {
|
"@types/node": {
|
||||||
"version": "14.6.3",
|
"version": "14.10.3",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.6.3.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.10.3.tgz",
|
||||||
"integrity": "sha512-pC/hkcREG6YfDfui1FBmj8e20jFU5Exjw4NYDm8kEdrW+mOh0T1Zve8DWKnS7ZIZvgncrctcNCXF4Q2I+loyww=="
|
"integrity": "sha512-zdN0hor7TLkjAdKTnYW+Y22oIhUUpil5ZD1V1OFq0CR0CLKw+NdR6dkziTfkWRLo6sKzisayoj/GNpNbe4LY9Q=="
|
||||||
},
|
},
|
||||||
"@types/normalize-package-data": {
|
"@types/normalize-package-data": {
|
||||||
"version": "2.4.0",
|
"version": "2.4.0",
|
||||||
@ -1322,31 +1342,31 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@typescript-eslint/parser": {
|
"@typescript-eslint/parser": {
|
||||||
"version": "4.0.1",
|
"version": "4.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.1.1.tgz",
|
||||||
"integrity": "sha512-1+qLmXHNAWSQ7RB6fdSQszAiA7JTwzakj5cNYjBTUmpH2cqilxMZEIV+DRKjVZs8NzP3ALmKexB0w/ExjcK9Iw==",
|
"integrity": "sha512-NLIhmicpKGfJbdXyQBz9j48PA6hq6e+SDOoXy7Ak6bq1ebGqbgG+fR1UIDAuay6OjQdot69c/URu2uLlsP8GQQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@typescript-eslint/scope-manager": "4.0.1",
|
"@typescript-eslint/scope-manager": "4.1.1",
|
||||||
"@typescript-eslint/types": "4.0.1",
|
"@typescript-eslint/types": "4.1.1",
|
||||||
"@typescript-eslint/typescript-estree": "4.0.1",
|
"@typescript-eslint/typescript-estree": "4.1.1",
|
||||||
"debug": "^4.1.1"
|
"debug": "^4.1.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/types": {
|
"@typescript-eslint/types": {
|
||||||
"version": "4.0.1",
|
"version": "4.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.1.1.tgz",
|
||||||
"integrity": "sha512-S+gD3fgbkZYW2rnbjugNMqibm9HpEjqZBZkTiI3PwbbNGWmAcxolWIUwZ0SKeG4Dy2ktpKKaI/6+HGYVH8Qrlg==",
|
"integrity": "sha512-zrBiqOKYerMTllKcn+BP+i1b7LW/EbMMYytroXMxUTvFPn1smkCu0D7lSAx29fTUO4jnwV0ljSvYQtn2vNrNxA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@typescript-eslint/typescript-estree": {
|
"@typescript-eslint/typescript-estree": {
|
||||||
"version": "4.0.1",
|
"version": "4.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.1.1.tgz",
|
||||||
"integrity": "sha512-zGzleORFXrRWRJAMLTB2iJD1IZbCPkg4hsI8mGdpYlKaqzvKYSEWVAYh14eauaR+qIoZVWrXgYSXqLtTlxotiw==",
|
"integrity": "sha512-2AUg5v0liVBsqbGxBphbJ0QbGqSRVaF5qPoTPWcxop+66vMdU1h4CCvHxTC47+Qb+Pr4l2RhXDd41JNpwcQEKw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@typescript-eslint/types": "4.0.1",
|
"@typescript-eslint/types": "4.1.1",
|
||||||
"@typescript-eslint/visitor-keys": "4.0.1",
|
"@typescript-eslint/visitor-keys": "4.1.1",
|
||||||
"debug": "^4.1.1",
|
"debug": "^4.1.1",
|
||||||
"globby": "^11.0.1",
|
"globby": "^11.0.1",
|
||||||
"is-glob": "^4.0.1",
|
"is-glob": "^4.0.1",
|
||||||
@ -1356,12 +1376,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@typescript-eslint/visitor-keys": {
|
"@typescript-eslint/visitor-keys": {
|
||||||
"version": "4.0.1",
|
"version": "4.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.1.1.tgz",
|
||||||
"integrity": "sha512-yBSqd6FjnTzbg5RUy9J+9kJEyQjTI34JdGMJz+9ttlJzLCnGkBikxw+N5n2VDcc3CesbIEJ0MnZc5uRYnrEnCw==",
|
"integrity": "sha512-/EOOXbA2ferGLG6RmCHEQ0lTTLkOlXYDgblCmQk3tIU7mTPLm4gKhFMeeUSe+bcchTUsKeCk8xcpbop5Zr/8Rw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@typescript-eslint/types": "4.0.1",
|
"@typescript-eslint/types": "4.1.1",
|
||||||
"eslint-visitor-keys": "^2.0.0"
|
"eslint-visitor-keys": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1374,28 +1394,28 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@typescript-eslint/scope-manager": {
|
"@typescript-eslint/scope-manager": {
|
||||||
"version": "4.0.1",
|
"version": "4.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.1.1.tgz",
|
||||||
"integrity": "sha512-u3YEXVJ8jsj7QCJk3om0Y457fy2euEOkkzxIB/LKU3MdyI+FJ2gI0M4aKEaXzwCSfNDiZ13a3lDo5DVozc+XLQ==",
|
"integrity": "sha512-0W8TTobCvIIQ2FsrYTffyZGAAFUyIbEHq5EYJb1m7Rpd005jrnOvKOo8ywCLhs/Bm17C+KsrUboBvBAARQVvyA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@typescript-eslint/types": "4.0.1",
|
"@typescript-eslint/types": "4.1.1",
|
||||||
"@typescript-eslint/visitor-keys": "4.0.1"
|
"@typescript-eslint/visitor-keys": "4.1.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/types": {
|
"@typescript-eslint/types": {
|
||||||
"version": "4.0.1",
|
"version": "4.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.1.1.tgz",
|
||||||
"integrity": "sha512-S+gD3fgbkZYW2rnbjugNMqibm9HpEjqZBZkTiI3PwbbNGWmAcxolWIUwZ0SKeG4Dy2ktpKKaI/6+HGYVH8Qrlg==",
|
"integrity": "sha512-zrBiqOKYerMTllKcn+BP+i1b7LW/EbMMYytroXMxUTvFPn1smkCu0D7lSAx29fTUO4jnwV0ljSvYQtn2vNrNxA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"@typescript-eslint/visitor-keys": {
|
"@typescript-eslint/visitor-keys": {
|
||||||
"version": "4.0.1",
|
"version": "4.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.1.1.tgz",
|
||||||
"integrity": "sha512-yBSqd6FjnTzbg5RUy9J+9kJEyQjTI34JdGMJz+9ttlJzLCnGkBikxw+N5n2VDcc3CesbIEJ0MnZc5uRYnrEnCw==",
|
"integrity": "sha512-/EOOXbA2ferGLG6RmCHEQ0lTTLkOlXYDgblCmQk3tIU7mTPLm4gKhFMeeUSe+bcchTUsKeCk8xcpbop5Zr/8Rw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@typescript-eslint/types": "4.0.1",
|
"@typescript-eslint/types": "4.1.1",
|
||||||
"eslint-visitor-keys": "^2.0.0"
|
"eslint-visitor-keys": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1439,9 +1459,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"@vercel/ncc": {
|
"@vercel/ncc": {
|
||||||
"version": "0.24.0",
|
"version": "0.24.1",
|
||||||
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.24.0.tgz",
|
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.24.1.tgz",
|
||||||
"integrity": "sha512-crqItMcIwCkvdXY/V3/TzrHJQx6nbIaRqE1cOopJhgGX6izvNov40SmD//nS5flfEvdK54YGjwVVq+zG6crjOg==",
|
"integrity": "sha512-r9m7brz2hNmq5TF3sxrK4qR/FhXn44XIMglQUir4sT7Sh5GOaYXlMYikHFwJStf8rmQGTlvOoBXt4yHVonRG8A==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"abab": {
|
"abab": {
|
||||||
@ -1467,9 +1487,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"acorn-jsx": {
|
"acorn-jsx": {
|
||||||
"version": "5.2.0",
|
"version": "5.3.1",
|
||||||
"resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz",
|
||||||
"integrity": "sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ==",
|
"integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"acorn-walk": {
|
"acorn-walk": {
|
||||||
@ -2443,9 +2463,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"eslint": {
|
"eslint": {
|
||||||
"version": "7.8.1",
|
"version": "7.9.0",
|
||||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-7.8.1.tgz",
|
"resolved": "https://registry.npmjs.org/eslint/-/eslint-7.9.0.tgz",
|
||||||
"integrity": "sha512-/2rX2pfhyUG0y+A123d0ccXtMm7DV7sH1m3lk9nk2DZ2LReq39FXHueR9xZwshE5MdfSf0xunSaMWRqyIA6M1w==",
|
"integrity": "sha512-V6QyhX21+uXp4T+3nrNfI3hQNBDa/P8ga7LoQOenwrlEFXrEnUEE+ok1dMtaS3b6rmLXhT1TkTIsG75HMLbknA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@babel/code-frame": "^7.0.0",
|
"@babel/code-frame": "^7.0.0",
|
||||||
@ -2652,40 +2672,65 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"eslint-plugin-jest": {
|
"eslint-plugin-jest": {
|
||||||
"version": "23.20.0",
|
"version": "24.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-23.20.0.tgz",
|
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-24.0.1.tgz",
|
||||||
"integrity": "sha512-+6BGQt85OREevBDWCvhqj1yYA4+BFK4XnRZSGJionuEYmcglMZYLNNBBemwzbqUAckURaHdJSBcjHPyrtypZOw==",
|
"integrity": "sha512-8tYFDqOHGr7vVfdVYspmlV4sRBTylrM4gSLgkGKlO6F+djDOEJ+tEU7I50smUs7AIvFnNZutXUQAMgI9s9N6xQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@typescript-eslint/experimental-utils": "^2.5.0"
|
"@typescript-eslint/experimental-utils": "^4.0.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@typescript-eslint/experimental-utils": {
|
"@typescript-eslint/experimental-utils": {
|
||||||
"version": "2.34.0",
|
"version": "4.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.34.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.1.1.tgz",
|
||||||
"integrity": "sha512-eS6FTkq+wuMJ+sgtuNTtcqavWXqsflWcfBnlYhg/nS4aZ1leewkXGbvBhaapn1q6qf4M71bsR1tez5JTRMuqwA==",
|
"integrity": "sha512-jzYsNciHoa4Z3c1URtmeT/bamYm8Dwfw6vuN3WHIE/BXb1iC4KveAnXDErTAZtPVxTYBaYn3n2gbt6F6D2rm1A==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
"@types/json-schema": "^7.0.3",
|
"@types/json-schema": "^7.0.3",
|
||||||
"@typescript-eslint/typescript-estree": "2.34.0",
|
"@typescript-eslint/scope-manager": "4.1.1",
|
||||||
|
"@typescript-eslint/types": "4.1.1",
|
||||||
|
"@typescript-eslint/typescript-estree": "4.1.1",
|
||||||
"eslint-scope": "^5.0.0",
|
"eslint-scope": "^5.0.0",
|
||||||
"eslint-utils": "^2.0.0"
|
"eslint-utils": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@typescript-eslint/types": {
|
||||||
|
"version": "4.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.1.1.tgz",
|
||||||
|
"integrity": "sha512-zrBiqOKYerMTllKcn+BP+i1b7LW/EbMMYytroXMxUTvFPn1smkCu0D7lSAx29fTUO4jnwV0ljSvYQtn2vNrNxA==",
|
||||||
|
"dev": true
|
||||||
|
},
|
||||||
"@typescript-eslint/typescript-estree": {
|
"@typescript-eslint/typescript-estree": {
|
||||||
"version": "2.34.0",
|
"version": "4.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.34.0.tgz",
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.1.1.tgz",
|
||||||
"integrity": "sha512-OMAr+nJWKdlVM9LOqCqh3pQQPwxHAN7Du8DR6dmwCrAmxtiXQnhHJ6tBNtf+cggqfo51SG/FCwnKhXCIM7hnVg==",
|
"integrity": "sha512-2AUg5v0liVBsqbGxBphbJ0QbGqSRVaF5qPoTPWcxop+66vMdU1h4CCvHxTC47+Qb+Pr4l2RhXDd41JNpwcQEKw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"requires": {
|
"requires": {
|
||||||
|
"@typescript-eslint/types": "4.1.1",
|
||||||
|
"@typescript-eslint/visitor-keys": "4.1.1",
|
||||||
"debug": "^4.1.1",
|
"debug": "^4.1.1",
|
||||||
"eslint-visitor-keys": "^1.1.0",
|
"globby": "^11.0.1",
|
||||||
"glob": "^7.1.6",
|
|
||||||
"is-glob": "^4.0.1",
|
"is-glob": "^4.0.1",
|
||||||
"lodash": "^4.17.15",
|
"lodash": "^4.17.15",
|
||||||
"semver": "^7.3.2",
|
"semver": "^7.3.2",
|
||||||
"tsutils": "^3.17.1"
|
"tsutils": "^3.17.1"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"@typescript-eslint/visitor-keys": {
|
||||||
|
"version": "4.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.1.1.tgz",
|
||||||
|
"integrity": "sha512-/EOOXbA2ferGLG6RmCHEQ0lTTLkOlXYDgblCmQk3tIU7mTPLm4gKhFMeeUSe+bcchTUsKeCk8xcpbop5Zr/8Rw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@typescript-eslint/types": "4.1.1",
|
||||||
|
"eslint-visitor-keys": "^2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"eslint-visitor-keys": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-QudtT6av5WXels9WjIM7qz1XD1cWGvX4gGXvp/zBn9nXG02D0utdU3Em2m/QjTnrsk6bBjmCygl3rmj118msQQ==",
|
||||||
|
"dev": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -5702,9 +5747,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node-fetch": {
|
"node-fetch": {
|
||||||
"version": "2.6.0",
|
"version": "2.6.1",
|
||||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
|
||||||
"integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA=="
|
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw=="
|
||||||
},
|
},
|
||||||
"node-int64": {
|
"node-int64": {
|
||||||
"version": "0.4.0",
|
"version": "0.4.0",
|
||||||
@ -6052,9 +6097,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"prettier": {
|
"prettier": {
|
||||||
"version": "2.1.1",
|
"version": "2.1.2",
|
||||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.1.2.tgz",
|
||||||
"integrity": "sha512-9bY+5ZWCfqj3ghYBLxApy2zf6m+NJo5GzmLTpr9FsApsfjriNnS2dahWReHMi7qNPhhHl9SYHJs2cHZLgexNIw==",
|
"integrity": "sha512-16c7K+x4qVlJg9rEbXl7HEGmQyZlG4R9AgP+oHKRMsMsuk8s+ATStlf1NpDqyBI1HpVyfjLOeMhH2LvuNvV5Vg==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"prettier-linter-helpers": {
|
"prettier-linter-helpers": {
|
||||||
|
20
package.json
20
package.json
@ -29,25 +29,25 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/peter-evans/create-pull-request",
|
"homepage": "https://github.com/peter-evans/create-pull-request",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "1.2.5",
|
"@actions/core": "1.2.6",
|
||||||
"@actions/exec": "1.0.4",
|
"@actions/exec": "1.0.4",
|
||||||
"@octokit/core": "3.1.2",
|
"@octokit/core": "3.1.2",
|
||||||
"@octokit/plugin-paginate-rest": "2.3.1",
|
"@octokit/plugin-paginate-rest": "2.4.0",
|
||||||
"@octokit/plugin-rest-endpoint-methods": "4.1.3",
|
"@octokit/plugin-rest-endpoint-methods": "4.2.0",
|
||||||
"uuid": "8.3.0"
|
"uuid": "8.3.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/jest": "26.0.13",
|
"@types/jest": "26.0.14",
|
||||||
"@types/node": "14.6.3",
|
"@types/node": "14.10.3",
|
||||||
"@typescript-eslint/parser": "4.0.1",
|
"@typescript-eslint/parser": "4.1.1",
|
||||||
"@vercel/ncc": "0.24.0",
|
"@vercel/ncc": "0.24.1",
|
||||||
"eslint": "7.8.1",
|
"eslint": "7.9.0",
|
||||||
"eslint-plugin-github": "4.1.1",
|
"eslint-plugin-github": "4.1.1",
|
||||||
"eslint-plugin-jest": "23.20.0",
|
"eslint-plugin-jest": "24.0.1",
|
||||||
"jest": "26.4.2",
|
"jest": "26.4.2",
|
||||||
"jest-circus": "26.4.2",
|
"jest-circus": "26.4.2",
|
||||||
"js-yaml": "3.14.0",
|
"js-yaml": "3.14.0",
|
||||||
"prettier": "2.1.1",
|
"prettier": "2.1.2",
|
||||||
"ts-jest": "26.3.0",
|
"ts-jest": "26.3.0",
|
||||||
"typescript": "4.0.2"
|
"typescript": "4.0.2"
|
||||||
}
|
}
|
||||||
|
@ -78,15 +78,6 @@ async function isEven(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function hasDiff(
|
|
||||||
git: GitCommandManager,
|
|
||||||
branch1: string,
|
|
||||||
branch2: string
|
|
||||||
): Promise<boolean> {
|
|
||||||
const result = await git.diff([`${branch1}..${branch2}`])
|
|
||||||
return result.length > 0
|
|
||||||
}
|
|
||||||
|
|
||||||
function splitLines(multilineString: string): string[] {
|
function splitLines(multilineString: string): string[] {
|
||||||
return multilineString
|
return multilineString
|
||||||
.split('\n')
|
.split('\n')
|
||||||
@ -205,7 +196,7 @@ export async function createOrUpdateBranch(
|
|||||||
// to have a diff with the base due to different commits for the same changes.
|
// to have a diff with the base due to different commits for the same changes.
|
||||||
// For changes on base this reset is equivalent to a rebase of the pull request branch.
|
// For changes on base this reset is equivalent to a rebase of the pull request branch.
|
||||||
if (
|
if (
|
||||||
(await hasDiff(git, branch, tempBranch)) ||
|
(await git.hasDiff([`${branch}..${tempBranch}`])) ||
|
||||||
!(await isAhead(git, base, tempBranch))
|
!(await isAhead(git, base, tempBranch))
|
||||||
) {
|
) {
|
||||||
core.info(`Resetting '${branch}'`)
|
core.info(`Resetting '${branch}'`)
|
||||||
|
@ -106,6 +106,12 @@ export async function createPullRequest(inputs: Inputs): Promise<void> {
|
|||||||
`The 'base' and 'branch' for a pull request must be different branches. Unable to continue.`
|
`The 'base' and 'branch' for a pull request must be different branches. Unable to continue.`
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
// For self-hosted runners the repository state persists between runs.
|
||||||
|
// This command prunes the stale remote ref when the pull request branch was
|
||||||
|
// deleted after being merged or closed. Without this the push using
|
||||||
|
// '--force-with-lease' fails due to "stale info."
|
||||||
|
// https://github.com/peter-evans/create-pull-request/issues/633
|
||||||
|
await git.exec(['remote', 'prune', branchRemoteName])
|
||||||
core.endGroup()
|
core.endGroup()
|
||||||
|
|
||||||
// Apply the branch suffix if set
|
// Apply the branch suffix if set
|
||||||
|
@ -96,15 +96,6 @@ export class GitCommandManager {
|
|||||||
return output.exitCode === 0
|
return output.exitCode === 0
|
||||||
}
|
}
|
||||||
|
|
||||||
async diff(options?: string[]): Promise<string> {
|
|
||||||
const args = ['-c', 'core.pager=cat', 'diff']
|
|
||||||
if (options) {
|
|
||||||
args.push(...options)
|
|
||||||
}
|
|
||||||
const output = await this.exec(args)
|
|
||||||
return output.stdout.trim()
|
|
||||||
}
|
|
||||||
|
|
||||||
async fetch(
|
async fetch(
|
||||||
refSpec: string[],
|
refSpec: string[],
|
||||||
remoteName?: string,
|
remoteName?: string,
|
||||||
@ -153,18 +144,26 @@ export class GitCommandManager {
|
|||||||
return this.workingDirectory
|
return this.workingDirectory
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async hasDiff(options?: string[]): Promise<boolean> {
|
||||||
|
const args = ['diff', '--quiet']
|
||||||
|
if (options) {
|
||||||
|
args.push(...options)
|
||||||
|
}
|
||||||
|
const output = await this.exec(args, true)
|
||||||
|
return output.exitCode === 1
|
||||||
|
}
|
||||||
|
|
||||||
async isDirty(untracked: boolean): Promise<boolean> {
|
async isDirty(untracked: boolean): Promise<boolean> {
|
||||||
const diffArgs = ['--abbrev=40', '--full-index', '--raw']
|
// Check untracked changes
|
||||||
// Check staged changes
|
if (untracked && (await this.status(['--porcelain', '-unormal']))) {
|
||||||
if (await this.diff([...diffArgs, '--staged'])) {
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// Check working index changes
|
// Check working index changes
|
||||||
if (await this.diff(diffArgs)) {
|
if (await this.hasDiff()) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
// Check untracked changes
|
// Check staged changes
|
||||||
if (untracked && (await this.status(['--porcelain', '-unormal']))) {
|
if (await this.hasDiff(['--staged'])) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
@ -10,6 +10,11 @@ interface Repository {
|
|||||||
repo: string
|
repo: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface Pull {
|
||||||
|
number: number
|
||||||
|
html_url: string
|
||||||
|
}
|
||||||
|
|
||||||
export class GitHubHelper {
|
export class GitHubHelper {
|
||||||
private octokit: InstanceType<typeof Octokit>
|
private octokit: InstanceType<typeof Octokit>
|
||||||
|
|
||||||
@ -33,7 +38,7 @@ export class GitHubHelper {
|
|||||||
inputs: Inputs,
|
inputs: Inputs,
|
||||||
baseRepository: string,
|
baseRepository: string,
|
||||||
headBranch: string
|
headBranch: string
|
||||||
): Promise<number> {
|
): Promise<Pull> {
|
||||||
// Try to create the pull request
|
// Try to create the pull request
|
||||||
try {
|
try {
|
||||||
const {data: pull} = await this.octokit.pulls.create({
|
const {data: pull} = await this.octokit.pulls.create({
|
||||||
@ -47,12 +52,17 @@ export class GitHubHelper {
|
|||||||
core.info(
|
core.info(
|
||||||
`Created pull request #${pull.number} (${headBranch} => ${inputs.base})`
|
`Created pull request #${pull.number} (${headBranch} => ${inputs.base})`
|
||||||
)
|
)
|
||||||
return pull.number
|
return {
|
||||||
|
number: pull.number,
|
||||||
|
html_url: pull.html_url
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (
|
if (
|
||||||
!e.message ||
|
e.message &&
|
||||||
!e.message.includes(`A pull request already exists for ${headBranch}`)
|
e.message.includes(`A pull request already exists for ${headBranch}`)
|
||||||
) {
|
) {
|
||||||
|
core.info(`A pull request already exists for ${headBranch}`)
|
||||||
|
} else {
|
||||||
throw e
|
throw e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -74,7 +84,10 @@ export class GitHubHelper {
|
|||||||
core.info(
|
core.info(
|
||||||
`Updated pull request #${pull.number} (${headBranch} => ${inputs.base})`
|
`Updated pull request #${pull.number} (${headBranch} => ${inputs.base})`
|
||||||
)
|
)
|
||||||
return pull.number
|
return {
|
||||||
|
number: pull.number,
|
||||||
|
html_url: pull.html_url
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async getRepositoryParent(headRepository: string): Promise<string> {
|
async getRepositoryParent(headRepository: string): Promise<string> {
|
||||||
@ -98,16 +111,14 @@ export class GitHubHelper {
|
|||||||
const headBranch = `${headOwner}:${inputs.branch}`
|
const headBranch = `${headOwner}:${inputs.branch}`
|
||||||
|
|
||||||
// Create or update the pull request
|
// Create or update the pull request
|
||||||
const pullNumber = await this.createOrUpdate(
|
const pull = await this.createOrUpdate(inputs, baseRepository, headBranch)
|
||||||
inputs,
|
|
||||||
baseRepository,
|
|
||||||
headBranch
|
|
||||||
)
|
|
||||||
|
|
||||||
// Set outputs
|
// Set outputs
|
||||||
core.startGroup('Setting outputs')
|
core.startGroup('Setting outputs')
|
||||||
core.setOutput('pull-request-number', pullNumber)
|
core.setOutput('pull-request-number', pull.number)
|
||||||
core.exportVariable('PULL_REQUEST_NUMBER', pullNumber)
|
core.setOutput('pull-request-url', pull.html_url)
|
||||||
|
// Deprecated
|
||||||
|
core.exportVariable('PULL_REQUEST_NUMBER', pull.number)
|
||||||
core.endGroup()
|
core.endGroup()
|
||||||
|
|
||||||
// Set milestone, labels and assignees
|
// Set milestone, labels and assignees
|
||||||
@ -127,7 +138,7 @@ export class GitHubHelper {
|
|||||||
if (Object.keys(updateIssueParams).length > 0) {
|
if (Object.keys(updateIssueParams).length > 0) {
|
||||||
await this.octokit.issues.update({
|
await this.octokit.issues.update({
|
||||||
...this.parseRepository(baseRepository),
|
...this.parseRepository(baseRepository),
|
||||||
issue_number: pullNumber,
|
issue_number: pull.number,
|
||||||
...updateIssueParams
|
...updateIssueParams
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -146,7 +157,7 @@ export class GitHubHelper {
|
|||||||
try {
|
try {
|
||||||
await this.octokit.pulls.requestReviewers({
|
await this.octokit.pulls.requestReviewers({
|
||||||
...this.parseRepository(baseRepository),
|
...this.parseRepository(baseRepository),
|
||||||
pull_number: pullNumber,
|
pull_number: pull.number,
|
||||||
...requestReviewersParams
|
...requestReviewersParams
|
||||||
})
|
})
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
Reference in New Issue
Block a user