Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
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
|
||||
uses: peter-evans/create-pull-request@v3
|
||||
with:
|
||||
commit-message: Update distribution
|
||||
commit-message: 'build: update distribution'
|
||||
title: Update distribution
|
||||
body: |
|
||||
- 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
|
||||
run: |
|
||||
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
|
||||
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
|
||||
|
||||
- name: Add reaction
|
||||
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
|
||||
with:
|
||||
token: ${{ secrets.ACTIONS_BOT_TOKEN }}
|
||||
commit-message: Update dependencies
|
||||
commit-message: 'chore: update dependencies'
|
||||
committer: GitHub <noreply@github.com>
|
||||
author: actions-bot <actions-bot@users.noreply.github.com>
|
||||
title: Update dependencies
|
||||
|
@ -66,8 +66,8 @@ All inputs are **optional**. If not set, sensible defaults will be used.
|
||||
|
||||
### Action outputs
|
||||
|
||||
The pull request number is output as a step output.
|
||||
Note that in order to read the step output the action step must have an id.
|
||||
The pull request number and URL are available as step outputs.
|
||||
Note that in order to read the step outputs the action step must have an id.
|
||||
|
||||
```yml
|
||||
- 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
|
||||
run: |
|
||||
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
|
||||
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
|
||||
```
|
||||
|
||||
### Action behaviour
|
||||
@ -196,9 +197,10 @@ jobs:
|
||||
milestone: 1
|
||||
draft: false
|
||||
|
||||
- name: Check output
|
||||
- name: Check outputs
|
||||
run: |
|
||||
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:
|
||||
|
138
dist/index.js
vendored
138
dist/index.js
vendored
@ -906,7 +906,10 @@ class GitHubHelper {
|
||||
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 }));
|
||||
core.info(`Created pull request #${pull.number} (${headBranch} => ${inputs.base})`);
|
||||
return pull.number;
|
||||
return {
|
||||
number: pull.number,
|
||||
html_url: pull.html_url
|
||||
};
|
||||
}
|
||||
catch (e) {
|
||||
if (!e.message ||
|
||||
@ -918,7 +921,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: 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})`);
|
||||
return pull.number;
|
||||
return {
|
||||
number: pull.number,
|
||||
html_url: pull.html_url
|
||||
};
|
||||
});
|
||||
}
|
||||
getRepositoryParent(headRepository) {
|
||||
@ -935,11 +941,13 @@ class GitHubHelper {
|
||||
const [headOwner] = headRepository.split('/');
|
||||
const headBranch = `${headOwner}:${inputs.branch}`;
|
||||
// Create or update the pull request
|
||||
const pullNumber = yield this.createOrUpdate(inputs, baseRepository, headBranch);
|
||||
const pull = yield this.createOrUpdate(inputs, baseRepository, headBranch);
|
||||
// Set outputs
|
||||
core.startGroup('Setting outputs');
|
||||
core.setOutput('pull-request-number', pullNumber);
|
||||
core.exportVariable('PULL_REQUEST_NUMBER', pullNumber);
|
||||
core.setOutput('pull-request-number', pull.number);
|
||||
core.setOutput('pull-request-url', pull.html_url);
|
||||
// Deprecated
|
||||
core.exportVariable('PULL_REQUEST_NUMBER', pull.number);
|
||||
core.endGroup();
|
||||
// Set milestone, labels and assignees
|
||||
const updateIssueParams = {};
|
||||
@ -956,7 +964,7 @@ class GitHubHelper {
|
||||
core.info(`Applying assignees '${inputs.assignees}'`);
|
||||
}
|
||||
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
|
||||
const requestReviewersParams = {};
|
||||
@ -970,7 +978,7 @@ class GitHubHelper {
|
||||
}
|
||||
if (Object.keys(requestReviewersParams).length > 0) {
|
||||
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) {
|
||||
if (e.message && e.message.includes(ERROR_PR_REVIEW_FROM_AUTHOR)) {
|
||||
@ -3483,7 +3491,7 @@ exports.withCustomRequest = withCustomRequest;
|
||||
|
||||
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
|
||||
@ -3705,11 +3713,7 @@ const Endpoints = {
|
||||
unstarRepoForAuthenticatedUser: ["DELETE /user/starred/{owner}/{repo}"]
|
||||
},
|
||||
apps: {
|
||||
addRepoToInstallation: ["PUT /user/installations/{installation_id}/repositories/{repository_id}", {
|
||||
mediaType: {
|
||||
previews: ["machine-man"]
|
||||
}
|
||||
}],
|
||||
addRepoToInstallation: ["PUT /user/installations/{installation_id}/repositories/{repository_id}"],
|
||||
checkToken: ["POST /applications/{client_id}/token"],
|
||||
createContentAttachment: ["POST /content_references/{content_reference_id}/attachments", {
|
||||
mediaType: {
|
||||
@ -3717,81 +3721,29 @@ const Endpoints = {
|
||||
}
|
||||
}],
|
||||
createFromManifest: ["POST /app-manifests/{code}/conversions"],
|
||||
createInstallationAccessToken: ["POST /app/installations/{installation_id}/access_tokens", {
|
||||
mediaType: {
|
||||
previews: ["machine-man"]
|
||||
}
|
||||
}],
|
||||
createInstallationAccessToken: ["POST /app/installations/{installation_id}/access_tokens"],
|
||||
deleteAuthorization: ["DELETE /applications/{client_id}/grant"],
|
||||
deleteInstallation: ["DELETE /app/installations/{installation_id}", {
|
||||
mediaType: {
|
||||
previews: ["machine-man"]
|
||||
}
|
||||
}],
|
||||
deleteInstallation: ["DELETE /app/installations/{installation_id}"],
|
||||
deleteToken: ["DELETE /applications/{client_id}/token"],
|
||||
getAuthenticated: ["GET /app", {
|
||||
mediaType: {
|
||||
previews: ["machine-man"]
|
||||
}
|
||||
}],
|
||||
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"]
|
||||
}
|
||||
}],
|
||||
getAuthenticated: ["GET /app"],
|
||||
getBySlug: ["GET /apps/{app_slug}"],
|
||||
getInstallation: ["GET /app/installations/{installation_id}"],
|
||||
getOrgInstallation: ["GET /orgs/{org}/installation"],
|
||||
getRepoInstallation: ["GET /repos/{owner}/{repo}/installation"],
|
||||
getSubscriptionPlanForAccount: ["GET /marketplace_listing/accounts/{account_id}"],
|
||||
getSubscriptionPlanForAccountStubbed: ["GET /marketplace_listing/stubbed/accounts/{account_id}"],
|
||||
getUserInstallation: ["GET /users/{username}/installation", {
|
||||
mediaType: {
|
||||
previews: ["machine-man"]
|
||||
}
|
||||
}],
|
||||
getUserInstallation: ["GET /users/{username}/installation"],
|
||||
listAccountsForPlan: ["GET /marketplace_listing/plans/{plan_id}/accounts"],
|
||||
listAccountsForPlanStubbed: ["GET /marketplace_listing/stubbed/plans/{plan_id}/accounts"],
|
||||
listInstallationReposForAuthenticatedUser: ["GET /user/installations/{installation_id}/repositories", {
|
||||
mediaType: {
|
||||
previews: ["machine-man"]
|
||||
}
|
||||
}],
|
||||
listInstallations: ["GET /app/installations", {
|
||||
mediaType: {
|
||||
previews: ["machine-man"]
|
||||
}
|
||||
}],
|
||||
listInstallationsForAuthenticatedUser: ["GET /user/installations", {
|
||||
mediaType: {
|
||||
previews: ["machine-man"]
|
||||
}
|
||||
}],
|
||||
listInstallationReposForAuthenticatedUser: ["GET /user/installations/{installation_id}/repositories"],
|
||||
listInstallations: ["GET /app/installations"],
|
||||
listInstallationsForAuthenticatedUser: ["GET /user/installations"],
|
||||
listPlans: ["GET /marketplace_listing/plans"],
|
||||
listPlansStubbed: ["GET /marketplace_listing/stubbed/plans"],
|
||||
listReposAccessibleToInstallation: ["GET /installation/repositories", {
|
||||
mediaType: {
|
||||
previews: ["machine-man"]
|
||||
}
|
||||
}],
|
||||
listReposAccessibleToInstallation: ["GET /installation/repositories"],
|
||||
listSubscriptionsForAuthenticatedUser: ["GET /user/marketplace_purchases"],
|
||||
listSubscriptionsForAuthenticatedUserStubbed: ["GET /user/marketplace_purchases/stubbed"],
|
||||
removeRepoFromInstallation: ["DELETE /user/installations/{installation_id}/repositories/{repository_id}", {
|
||||
mediaType: {
|
||||
previews: ["machine-man"]
|
||||
}
|
||||
}],
|
||||
removeRepoFromInstallation: ["DELETE /user/installations/{installation_id}/repositories/{repository_id}"],
|
||||
resetToken: ["PATCH /applications/{client_id}/token"],
|
||||
revokeInstallationAccessToken: ["DELETE /installation/token"],
|
||||
suspendInstallation: ["PUT /app/installations/{installation_id}/suspended"],
|
||||
@ -3863,8 +3815,15 @@ const Endpoints = {
|
||||
}]
|
||||
},
|
||||
codeScanning: {
|
||||
getAlert: ["GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_id}"],
|
||||
listAlertsForRepo: ["GET /repos/{owner}/{repo}/code-scanning/alerts"]
|
||||
getAlert: ["GET /repos/{owner}/{repo}/code-scanning/alerts/{alert_number}", {}, {
|
||||
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: {
|
||||
getAllCodesOfConduct: ["GET /codes_of_conduct", {
|
||||
@ -4106,11 +4065,7 @@ const Endpoints = {
|
||||
getMembershipForUser: ["GET /orgs/{org}/memberships/{username}"],
|
||||
getWebhook: ["GET /orgs/{org}/hooks/{hook_id}"],
|
||||
list: ["GET /organizations"],
|
||||
listAppInstallations: ["GET /orgs/{org}/installations", {
|
||||
mediaType: {
|
||||
previews: ["machine-man"]
|
||||
}
|
||||
}],
|
||||
listAppInstallations: ["GET /orgs/{org}/installations"],
|
||||
listBlockedUsers: ["GET /orgs/{org}/blocks"],
|
||||
listForAuthenticatedUser: ["GET /user/orgs"],
|
||||
listForUser: ["GET /users/{username}/orgs"],
|
||||
@ -4723,7 +4678,7 @@ const Endpoints = {
|
||||
}
|
||||
};
|
||||
|
||||
const VERSION = "4.1.3";
|
||||
const VERSION = "4.2.0";
|
||||
|
||||
function endpointsToMethods(octokit, endpointsMap) {
|
||||
const newMethods = {};
|
||||
@ -5766,6 +5721,12 @@ function convertBody(buffer, headers) {
|
||||
// html4
|
||||
if (!res && 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) {
|
||||
res = /charset=(.*)/i.exec(res.pop());
|
||||
@ -6773,7 +6734,7 @@ function fetch(url, opts) {
|
||||
// HTTP fetch step 5.5
|
||||
switch (request.redirect) {
|
||||
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();
|
||||
return;
|
||||
case 'manual':
|
||||
@ -6812,7 +6773,8 @@ function fetch(url, opts) {
|
||||
method: request.method,
|
||||
body: request.body,
|
||||
signal: request.signal,
|
||||
timeout: request.timeout
|
||||
timeout: request.timeout,
|
||||
size: request.size
|
||||
};
|
||||
|
||||
// HTTP-redirect fetch step 9
|
||||
|
189
package-lock.json
generated
189
package-lock.json
generated
@ -1079,20 +1079,40 @@
|
||||
}
|
||||
},
|
||||
"@octokit/plugin-paginate-rest": {
|
||||
"version": "2.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.3.1.tgz",
|
||||
"integrity": "sha512-81A+ONLpcSX7vWxnEmVZteQPNsbdeScSVUqjgMYPSk1trzG69iYkhS42wPRWtN0nYw6OEmT48DNeQCjHeyroYw==",
|
||||
"version": "2.4.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.4.0.tgz",
|
||||
"integrity": "sha512-YT6Klz3LLH6/nNgi0pheJnUmTFW4kVnxGft+v8Itc41IIcjl7y1C8TatmKQBbCSuTSNFXO5pCENnqg6sjwpJhg==",
|
||||
"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": {
|
||||
"version": "4.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.1.3.tgz",
|
||||
"integrity": "sha512-az3seq9yuc0OXlNLrZ0fWTNbFuL4sN8GN1sLmovELg3+LnpWmOs3GAn2KGa6E7SKMgpCuFvJwvsHEfYasTHUxQ==",
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.2.0.tgz",
|
||||
"integrity": "sha512-1/qn1q1C1hGz6W/iEDm9DoyNoG/xdFDt78E3eZ5hHeUfJTLJgyAMdj9chL/cNBHjcjd+FH5aO1x0VCqR2RE0mw==",
|
||||
"requires": {
|
||||
"@octokit/types": "^5.1.1",
|
||||
"@octokit/types": "^5.5.0",
|
||||
"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": {
|
||||
@ -1235,9 +1255,9 @@
|
||||
}
|
||||
},
|
||||
"@types/jest": {
|
||||
"version": "26.0.13",
|
||||
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-26.0.13.tgz",
|
||||
"integrity": "sha512-sCzjKow4z9LILc6DhBvn5AkIfmQzDZkgtVVKmGwVrs5tuid38ws281D4l+7x1kP487+FlKDh5kfMZ8WSPAdmdA==",
|
||||
"version": "26.0.14",
|
||||
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-26.0.14.tgz",
|
||||
"integrity": "sha512-Hz5q8Vu0D288x3iWXePSn53W7hAjP0H7EQ6QvDO9c7t46mR0lNOLlfuwQ+JkVxuhygHzlzPX+0jKdA3ZgSh+Vg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"jest-diff": "^25.2.1",
|
||||
@ -1257,9 +1277,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"@types/node": {
|
||||
"version": "14.6.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.6.3.tgz",
|
||||
"integrity": "sha512-pC/hkcREG6YfDfui1FBmj8e20jFU5Exjw4NYDm8kEdrW+mOh0T1Zve8DWKnS7ZIZvgncrctcNCXF4Q2I+loyww=="
|
||||
"version": "14.10.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.10.3.tgz",
|
||||
"integrity": "sha512-zdN0hor7TLkjAdKTnYW+Y22oIhUUpil5ZD1V1OFq0CR0CLKw+NdR6dkziTfkWRLo6sKzisayoj/GNpNbe4LY9Q=="
|
||||
},
|
||||
"@types/normalize-package-data": {
|
||||
"version": "2.4.0",
|
||||
@ -1322,31 +1342,31 @@
|
||||
}
|
||||
},
|
||||
"@typescript-eslint/parser": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.0.1.tgz",
|
||||
"integrity": "sha512-1+qLmXHNAWSQ7RB6fdSQszAiA7JTwzakj5cNYjBTUmpH2cqilxMZEIV+DRKjVZs8NzP3ALmKexB0w/ExjcK9Iw==",
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.1.1.tgz",
|
||||
"integrity": "sha512-NLIhmicpKGfJbdXyQBz9j48PA6hq6e+SDOoXy7Ak6bq1ebGqbgG+fR1UIDAuay6OjQdot69c/URu2uLlsP8GQQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@typescript-eslint/scope-manager": "4.0.1",
|
||||
"@typescript-eslint/types": "4.0.1",
|
||||
"@typescript-eslint/typescript-estree": "4.0.1",
|
||||
"@typescript-eslint/scope-manager": "4.1.1",
|
||||
"@typescript-eslint/types": "4.1.1",
|
||||
"@typescript-eslint/typescript-estree": "4.1.1",
|
||||
"debug": "^4.1.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.0.1.tgz",
|
||||
"integrity": "sha512-S+gD3fgbkZYW2rnbjugNMqibm9HpEjqZBZkTiI3PwbbNGWmAcxolWIUwZ0SKeG4Dy2ktpKKaI/6+HGYVH8Qrlg==",
|
||||
"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": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.0.1.tgz",
|
||||
"integrity": "sha512-zGzleORFXrRWRJAMLTB2iJD1IZbCPkg4hsI8mGdpYlKaqzvKYSEWVAYh14eauaR+qIoZVWrXgYSXqLtTlxotiw==",
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.1.1.tgz",
|
||||
"integrity": "sha512-2AUg5v0liVBsqbGxBphbJ0QbGqSRVaF5qPoTPWcxop+66vMdU1h4CCvHxTC47+Qb+Pr4l2RhXDd41JNpwcQEKw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@typescript-eslint/types": "4.0.1",
|
||||
"@typescript-eslint/visitor-keys": "4.0.1",
|
||||
"@typescript-eslint/types": "4.1.1",
|
||||
"@typescript-eslint/visitor-keys": "4.1.1",
|
||||
"debug": "^4.1.1",
|
||||
"globby": "^11.0.1",
|
||||
"is-glob": "^4.0.1",
|
||||
@ -1356,12 +1376,12 @@
|
||||
}
|
||||
},
|
||||
"@typescript-eslint/visitor-keys": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.0.1.tgz",
|
||||
"integrity": "sha512-yBSqd6FjnTzbg5RUy9J+9kJEyQjTI34JdGMJz+9ttlJzLCnGkBikxw+N5n2VDcc3CesbIEJ0MnZc5uRYnrEnCw==",
|
||||
"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.0.1",
|
||||
"@typescript-eslint/types": "4.1.1",
|
||||
"eslint-visitor-keys": "^2.0.0"
|
||||
}
|
||||
},
|
||||
@ -1374,28 +1394,28 @@
|
||||
}
|
||||
},
|
||||
"@typescript-eslint/scope-manager": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.0.1.tgz",
|
||||
"integrity": "sha512-u3YEXVJ8jsj7QCJk3om0Y457fy2euEOkkzxIB/LKU3MdyI+FJ2gI0M4aKEaXzwCSfNDiZ13a3lDo5DVozc+XLQ==",
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.1.1.tgz",
|
||||
"integrity": "sha512-0W8TTobCvIIQ2FsrYTffyZGAAFUyIbEHq5EYJb1m7Rpd005jrnOvKOo8ywCLhs/Bm17C+KsrUboBvBAARQVvyA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@typescript-eslint/types": "4.0.1",
|
||||
"@typescript-eslint/visitor-keys": "4.0.1"
|
||||
"@typescript-eslint/types": "4.1.1",
|
||||
"@typescript-eslint/visitor-keys": "4.1.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@typescript-eslint/types": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.0.1.tgz",
|
||||
"integrity": "sha512-S+gD3fgbkZYW2rnbjugNMqibm9HpEjqZBZkTiI3PwbbNGWmAcxolWIUwZ0SKeG4Dy2ktpKKaI/6+HGYVH8Qrlg==",
|
||||
"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/visitor-keys": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.0.1.tgz",
|
||||
"integrity": "sha512-yBSqd6FjnTzbg5RUy9J+9kJEyQjTI34JdGMJz+9ttlJzLCnGkBikxw+N5n2VDcc3CesbIEJ0MnZc5uRYnrEnCw==",
|
||||
"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.0.1",
|
||||
"@typescript-eslint/types": "4.1.1",
|
||||
"eslint-visitor-keys": "^2.0.0"
|
||||
}
|
||||
},
|
||||
@ -1439,9 +1459,9 @@
|
||||
}
|
||||
},
|
||||
"@vercel/ncc": {
|
||||
"version": "0.24.0",
|
||||
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.24.0.tgz",
|
||||
"integrity": "sha512-crqItMcIwCkvdXY/V3/TzrHJQx6nbIaRqE1cOopJhgGX6izvNov40SmD//nS5flfEvdK54YGjwVVq+zG6crjOg==",
|
||||
"version": "0.24.1",
|
||||
"resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.24.1.tgz",
|
||||
"integrity": "sha512-r9m7brz2hNmq5TF3sxrK4qR/FhXn44XIMglQUir4sT7Sh5GOaYXlMYikHFwJStf8rmQGTlvOoBXt4yHVonRG8A==",
|
||||
"dev": true
|
||||
},
|
||||
"abab": {
|
||||
@ -1467,9 +1487,9 @@
|
||||
}
|
||||
},
|
||||
"acorn-jsx": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.2.0.tgz",
|
||||
"integrity": "sha512-HiUX/+K2YpkpJ+SzBffkM/AQ2YE03S0U1kjTLVpoJdhZMOWy8qvXVN9JdLqv2QsaQ6MPYQIuNmwD8zOiYUofLQ==",
|
||||
"version": "5.3.1",
|
||||
"resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.1.tgz",
|
||||
"integrity": "sha512-K0Ptm/47OKfQRpNQ2J/oIN/3QYiK6FwW+eJbILhsdxh2WTLdl+30o8aGdTbm5JbffpFFAg/g+zi1E+jvJha5ng==",
|
||||
"dev": true
|
||||
},
|
||||
"acorn-walk": {
|
||||
@ -2443,9 +2463,9 @@
|
||||
}
|
||||
},
|
||||
"eslint": {
|
||||
"version": "7.8.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-7.8.1.tgz",
|
||||
"integrity": "sha512-/2rX2pfhyUG0y+A123d0ccXtMm7DV7sH1m3lk9nk2DZ2LReq39FXHueR9xZwshE5MdfSf0xunSaMWRqyIA6M1w==",
|
||||
"version": "7.9.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-7.9.0.tgz",
|
||||
"integrity": "sha512-V6QyhX21+uXp4T+3nrNfI3hQNBDa/P8ga7LoQOenwrlEFXrEnUEE+ok1dMtaS3b6rmLXhT1TkTIsG75HMLbknA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/code-frame": "^7.0.0",
|
||||
@ -2652,40 +2672,65 @@
|
||||
}
|
||||
},
|
||||
"eslint-plugin-jest": {
|
||||
"version": "23.20.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-23.20.0.tgz",
|
||||
"integrity": "sha512-+6BGQt85OREevBDWCvhqj1yYA4+BFK4XnRZSGJionuEYmcglMZYLNNBBemwzbqUAckURaHdJSBcjHPyrtypZOw==",
|
||||
"version": "24.0.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-24.0.1.tgz",
|
||||
"integrity": "sha512-8tYFDqOHGr7vVfdVYspmlV4sRBTylrM4gSLgkGKlO6F+djDOEJ+tEU7I50smUs7AIvFnNZutXUQAMgI9s9N6xQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@typescript-eslint/experimental-utils": "^2.5.0"
|
||||
"@typescript-eslint/experimental-utils": "^4.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@typescript-eslint/experimental-utils": {
|
||||
"version": "2.34.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.34.0.tgz",
|
||||
"integrity": "sha512-eS6FTkq+wuMJ+sgtuNTtcqavWXqsflWcfBnlYhg/nS4aZ1leewkXGbvBhaapn1q6qf4M71bsR1tez5JTRMuqwA==",
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.1.1.tgz",
|
||||
"integrity": "sha512-jzYsNciHoa4Z3c1URtmeT/bamYm8Dwfw6vuN3WHIE/BXb1iC4KveAnXDErTAZtPVxTYBaYn3n2gbt6F6D2rm1A==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@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-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": {
|
||||
"version": "2.34.0",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.34.0.tgz",
|
||||
"integrity": "sha512-OMAr+nJWKdlVM9LOqCqh3pQQPwxHAN7Du8DR6dmwCrAmxtiXQnhHJ6tBNtf+cggqfo51SG/FCwnKhXCIM7hnVg==",
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.1.1.tgz",
|
||||
"integrity": "sha512-2AUg5v0liVBsqbGxBphbJ0QbGqSRVaF5qPoTPWcxop+66vMdU1h4CCvHxTC47+Qb+Pr4l2RhXDd41JNpwcQEKw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@typescript-eslint/types": "4.1.1",
|
||||
"@typescript-eslint/visitor-keys": "4.1.1",
|
||||
"debug": "^4.1.1",
|
||||
"eslint-visitor-keys": "^1.1.0",
|
||||
"glob": "^7.1.6",
|
||||
"globby": "^11.0.1",
|
||||
"is-glob": "^4.0.1",
|
||||
"lodash": "^4.17.15",
|
||||
"semver": "^7.3.2",
|
||||
"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
|
||||
},
|
||||
"node-fetch": {
|
||||
"version": "2.6.0",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz",
|
||||
"integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA=="
|
||||
"version": "2.6.1",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
|
||||
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw=="
|
||||
},
|
||||
"node-int64": {
|
||||
"version": "0.4.0",
|
||||
@ -6052,9 +6097,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"prettier": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.1.1.tgz",
|
||||
"integrity": "sha512-9bY+5ZWCfqj3ghYBLxApy2zf6m+NJo5GzmLTpr9FsApsfjriNnS2dahWReHMi7qNPhhHl9SYHJs2cHZLgexNIw==",
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.1.2.tgz",
|
||||
"integrity": "sha512-16c7K+x4qVlJg9rEbXl7HEGmQyZlG4R9AgP+oHKRMsMsuk8s+ATStlf1NpDqyBI1HpVyfjLOeMhH2LvuNvV5Vg==",
|
||||
"dev": true
|
||||
},
|
||||
"prettier-linter-helpers": {
|
||||
|
18
package.json
18
package.json
@ -32,22 +32,22 @@
|
||||
"@actions/core": "1.2.5",
|
||||
"@actions/exec": "1.0.4",
|
||||
"@octokit/core": "3.1.2",
|
||||
"@octokit/plugin-paginate-rest": "2.3.1",
|
||||
"@octokit/plugin-rest-endpoint-methods": "4.1.3",
|
||||
"@octokit/plugin-paginate-rest": "2.4.0",
|
||||
"@octokit/plugin-rest-endpoint-methods": "4.2.0",
|
||||
"uuid": "8.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "26.0.13",
|
||||
"@types/node": "14.6.3",
|
||||
"@typescript-eslint/parser": "4.0.1",
|
||||
"@vercel/ncc": "0.24.0",
|
||||
"eslint": "7.8.1",
|
||||
"@types/jest": "26.0.14",
|
||||
"@types/node": "14.10.3",
|
||||
"@typescript-eslint/parser": "4.1.1",
|
||||
"@vercel/ncc": "0.24.1",
|
||||
"eslint": "7.9.0",
|
||||
"eslint-plugin-github": "4.1.1",
|
||||
"eslint-plugin-jest": "23.20.0",
|
||||
"eslint-plugin-jest": "24.0.1",
|
||||
"jest": "26.4.2",
|
||||
"jest-circus": "26.4.2",
|
||||
"js-yaml": "3.14.0",
|
||||
"prettier": "2.1.1",
|
||||
"prettier": "2.1.2",
|
||||
"ts-jest": "26.3.0",
|
||||
"typescript": "4.0.2"
|
||||
}
|
||||
|
@ -10,6 +10,11 @@ interface Repository {
|
||||
repo: string
|
||||
}
|
||||
|
||||
interface Pull {
|
||||
number: number
|
||||
html_url: string
|
||||
}
|
||||
|
||||
export class GitHubHelper {
|
||||
private octokit: InstanceType<typeof Octokit>
|
||||
|
||||
@ -33,7 +38,7 @@ export class GitHubHelper {
|
||||
inputs: Inputs,
|
||||
baseRepository: string,
|
||||
headBranch: string
|
||||
): Promise<number> {
|
||||
): Promise<Pull> {
|
||||
// Try to create the pull request
|
||||
try {
|
||||
const {data: pull} = await this.octokit.pulls.create({
|
||||
@ -47,7 +52,10 @@ export class GitHubHelper {
|
||||
core.info(
|
||||
`Created pull request #${pull.number} (${headBranch} => ${inputs.base})`
|
||||
)
|
||||
return pull.number
|
||||
return {
|
||||
number: pull.number,
|
||||
html_url: pull.html_url
|
||||
}
|
||||
} catch (e) {
|
||||
if (
|
||||
!e.message ||
|
||||
@ -74,7 +82,10 @@ export class GitHubHelper {
|
||||
core.info(
|
||||
`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> {
|
||||
@ -98,16 +109,14 @@ export class GitHubHelper {
|
||||
const headBranch = `${headOwner}:${inputs.branch}`
|
||||
|
||||
// Create or update the pull request
|
||||
const pullNumber = await this.createOrUpdate(
|
||||
inputs,
|
||||
baseRepository,
|
||||
headBranch
|
||||
)
|
||||
const pull = await this.createOrUpdate(inputs, baseRepository, headBranch)
|
||||
|
||||
// Set outputs
|
||||
core.startGroup('Setting outputs')
|
||||
core.setOutput('pull-request-number', pullNumber)
|
||||
core.exportVariable('PULL_REQUEST_NUMBER', pullNumber)
|
||||
core.setOutput('pull-request-number', pull.number)
|
||||
core.setOutput('pull-request-url', pull.html_url)
|
||||
// Deprecated
|
||||
core.exportVariable('PULL_REQUEST_NUMBER', pull.number)
|
||||
core.endGroup()
|
||||
|
||||
// Set milestone, labels and assignees
|
||||
@ -127,7 +136,7 @@ export class GitHubHelper {
|
||||
if (Object.keys(updateIssueParams).length > 0) {
|
||||
await this.octokit.issues.update({
|
||||
...this.parseRepository(baseRepository),
|
||||
issue_number: pullNumber,
|
||||
issue_number: pull.number,
|
||||
...updateIssueParams
|
||||
})
|
||||
}
|
||||
@ -146,7 +155,7 @@ export class GitHubHelper {
|
||||
try {
|
||||
await this.octokit.pulls.requestReviewers({
|
||||
...this.parseRepository(baseRepository),
|
||||
pull_number: pullNumber,
|
||||
pull_number: pull.number,
|
||||
...requestReviewersParams
|
||||
})
|
||||
} catch (e) {
|
||||
|
Reference in New Issue
Block a user