Compare commits

..

12 Commits

Author SHA1 Message Date
da928d5fcc Merge pull request #587 from peter-evans/url-output
feat: output the pull request url
2020-09-17 11:18:34 +09:00
2465e435b9 feat: output the pull request url 2020-09-17 10:41:26 +09:00
37b2bd1eca Merge pull request #584 from peter-evans/update-distribution
Update distribution
2020-09-17 10:39:30 +09:00
eb13e17e17 build: update distribution 2020-09-17 01:38:44 +00:00
a1ecc20658 Merge pull request #565 from peter-evans/update-dependencies
Update dependencies
2020-09-17 10:36:25 +09:00
ffcad23634 chore: update dependencies 2020-09-17 01:15:53 +00:00
f4b52b768a Merge pull request #574 from peter-evans/update-distribution
Update distribution
2020-09-13 15:13:25 +09:00
af682c8fcb build: update distribution 2020-09-13 06:11:21 +00:00
7378b23cb0 Merge pull request #569 from peter-evans/dependabot/npm_and_yarn/node-fetch-2.6.1
Bump node-fetch from 2.6.0 to 2.6.1
2020-09-13 15:08:27 +09:00
370ae6d537 Bump node-fetch from 2.6.0 to 2.6.1
Bumps [node-fetch](https://github.com/bitinn/node-fetch) from 2.6.0 to 2.6.1.
- [Release notes](https://github.com/bitinn/node-fetch/releases)
- [Changelog](https://github.com/node-fetch/node-fetch/blob/master/docs/CHANGELOG.md)
- [Commits](https://github.com/bitinn/node-fetch/compare/v2.6.0...v2.6.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-09-12 21:49:56 +00:00
ae0797ee12 ci: update commit message type 2020-09-07 17:25:24 +09:00
e05457394a ci: update commit messages 2020-09-07 15:26:59 +09:00
8 changed files with 205 additions and 186 deletions

View File

@ -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`

View File

@ -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

View File

@ -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

View File

@ -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:

138
dist/index.js vendored
View File

@ -906,7 +906,10 @@ 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 ||
@ -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: 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 +941,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 +964,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 +978,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)) {
@ -3483,7 +3491,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 +3713,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 +3721,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 +3815,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 +4065,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 +4678,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 +5721,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 +6734,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 +6773,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

189
package-lock.json generated
View File

@ -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": {

View File

@ -32,22 +32,22 @@
"@actions/core": "1.2.5", "@actions/core": "1.2.5",
"@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"
} }

View File

@ -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,7 +52,10 @@ 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 ||
@ -74,7 +82,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 +109,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 +136,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 +155,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) {