Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: try pr apis #13192

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/pull-request-review-rule-enforcer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Pull Request Review Rules Enforcement

on:
pull_request:

jobs:
check-pull-request-merge-readiness:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
with:
persist-credentials: false

- name: Check merge readiness
run: |
cd scripts
yarn install --immutable
yarn ts-node check-pull-request-merge-readiness.ts 13191 ${{ secrets.GITHUB_TOKEN }}
41 changes: 41 additions & 0 deletions scripts/check-pull-request-merge-readiness.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { Octokit } from '@octokit/rest';

const owner = 'aws-amplify';
const repo = 'amplify-cli';
const prNumber = Number.parseInt(process.argv[2]);
const githubToken = process.argv[3];
const octokit = new Octokit({
auth: githubToken,
});

const main = async () => {
const prIdentifier = {
owner,
repo,
pull_number: prNumber,
};
const pullRequest = await octokit.rest.pulls.get(prIdentifier);
console.log('####### octokit.rest.pulls.get ############');
console.log(JSON.stringify(pullRequest.data, null, 2));
console.log('###########################################');

const requestedReviewers = await octokit.rest.pulls.listRequestedReviewers(prIdentifier);
console.log('####### octokit.rest.pulls.listRequestedReviewers ############');
console.log(JSON.stringify(requestedReviewers.data, null, 2));
console.log('###########################################');

const reviews = await octokit.pulls.listReviews(prIdentifier);
console.log('####### octokit.pulls.listReviews ############');
console.log(JSON.stringify(reviews.data, null, 2));
console.log('###########################################');

const reviewComments = await octokit.pulls.listReviewComments(prIdentifier);
console.log('####### octokit.pulls.listReviewComments ############');
console.log(JSON.stringify(reviewComments.data, null, 2));
console.log('###########################################');
};

main().catch((err) => {
console.log(err);
process.exit(1);
});
1 change: 1 addition & 0 deletions scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"@octokit/rest": "^20.0.1",
"@types/fs-extra": "^9.0.13",
"@types/glob": "^7.2.0",
"@types/js-yaml": "^4.0.4",
Expand Down
158 changes: 157 additions & 1 deletion scripts/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,133 @@ __metadata:
languageName: node
linkType: hard

"@octokit/auth-token@npm:^4.0.0":
version: 4.0.0
resolution: "@octokit/auth-token@npm:4.0.0"
checksum: 57acaa6c394c5abab2f74e8e1dcf4e7a16b236f713c77a54b8f08e2d14114de94b37946259e33ec2aab0566b26f724c2b71d2602352b59e541a9854897618f3c
languageName: node
linkType: hard

"@octokit/core@npm:^5.0.0":
version: 5.0.0
resolution: "@octokit/core@npm:5.0.0"
dependencies:
"@octokit/auth-token": ^4.0.0
"@octokit/graphql": ^7.0.0
"@octokit/request": ^8.0.2
"@octokit/request-error": ^5.0.0
"@octokit/types": ^11.0.0
before-after-hook: ^2.2.0
universal-user-agent: ^6.0.0
checksum: b963c197af88b2b461c564d94ddb330a8a0b7f88e09b1986ca46cb3d63c95d98b338e1b548ad547131c2ffa2af3525d69ab492a74cd23fc4abc357d529c1e1d4
languageName: node
linkType: hard

"@octokit/endpoint@npm:^9.0.0":
version: 9.0.0
resolution: "@octokit/endpoint@npm:9.0.0"
dependencies:
"@octokit/types": ^11.0.0
is-plain-object: ^5.0.0
universal-user-agent: ^6.0.0
checksum: 8291a4378320ea4c9fe6878fbf7281be4dd96c4d6b4317b5eeec119c430c3ede5b53f6983b1c7dc3e7056bb60748186dfa1d674e00fc65cea26f7a62f21dc7b2
languageName: node
linkType: hard

"@octokit/graphql@npm:^7.0.0":
version: 7.0.1
resolution: "@octokit/graphql@npm:7.0.1"
dependencies:
"@octokit/request": ^8.0.1
"@octokit/types": ^11.0.0
universal-user-agent: ^6.0.0
checksum: bfc79dff1a96210afcd27051a7b5fcacfc20d549f3d8bf1ac162ebe5a825d429d3b4f217a73169f8d5549fed535582e303a89b65f5a356557a91319326d80605
languageName: node
linkType: hard

"@octokit/openapi-types@npm:^18.0.0":
version: 18.0.0
resolution: "@octokit/openapi-types@npm:18.0.0"
checksum: d90fab10d962be71e72b85ffab2055cffd9c3196ff1edc3e4106deb78e99e8782965cf7aa6a4c1398f828e4d0c3e0f905915debfe34396d956dfce8e75b21664
languageName: node
linkType: hard

"@octokit/plugin-paginate-rest@npm:^8.0.0":
version: 8.0.0
resolution: "@octokit/plugin-paginate-rest@npm:8.0.0"
dependencies:
"@octokit/types": ^11.0.0
peerDependencies:
"@octokit/core": ">=5"
checksum: 72eb881b5d6dc71f0619a41f0918a7c2d7a4aba50c83a72267e81b5528bb882e1f6e83fb7ba90a602c60dd434e76bdc34c1fc2a11526b51c58c8d9ead55bf17a
languageName: node
linkType: hard

"@octokit/plugin-request-log@npm:^4.0.0":
version: 4.0.0
resolution: "@octokit/plugin-request-log@npm:4.0.0"
peerDependencies:
"@octokit/core": ">=5"
checksum: ca6db112f288326d2f11de5170e7d6429ba54f04a22dc1e5d06c8d626f72bd2effeb0218a8f73bc9e23657b5a89194cd297964ace54693d2dfdfba3828920b45
languageName: node
linkType: hard

"@octokit/plugin-rest-endpoint-methods@npm:^9.0.0":
version: 9.0.0
resolution: "@octokit/plugin-rest-endpoint-methods@npm:9.0.0"
dependencies:
"@octokit/types": ^11.0.0
peerDependencies:
"@octokit/core": ">=5"
checksum: 17219d5bb00022dd49145bb9068e3b5142e30956eeabeaf1b6389766b916bcd16c8c849484cd5db7b6888b080ae167ec71c14a22cfa7a511df0ddc0f7cc0e680
languageName: node
linkType: hard

"@octokit/request-error@npm:^5.0.0":
version: 5.0.0
resolution: "@octokit/request-error@npm:5.0.0"
dependencies:
"@octokit/types": ^11.0.0
deprecation: ^2.0.0
once: ^1.4.0
checksum: c681fede406b6338e22c8dcc57ab306558201e1f35545dde09a4d6edae279a874393081c5f28b165dbfc3f9367cc627050b06a87229904cfd2083b186e508c34
languageName: node
linkType: hard

"@octokit/request@npm:^8.0.1, @octokit/request@npm:^8.0.2":
version: 8.1.1
resolution: "@octokit/request@npm:8.1.1"
dependencies:
"@octokit/endpoint": ^9.0.0
"@octokit/request-error": ^5.0.0
"@octokit/types": ^11.1.0
is-plain-object: ^5.0.0
universal-user-agent: ^6.0.0
checksum: 07fa47fff16be4ff36599752e31d54713137e140fe5e4604cb77da6b466b1e5c2eb093a3151112637aac5d341922685de10f5a6589881177a1559d7597a63e15
languageName: node
linkType: hard

"@octokit/rest@npm:^20.0.1":
version: 20.0.1
resolution: "@octokit/rest@npm:20.0.1"
dependencies:
"@octokit/core": ^5.0.0
"@octokit/plugin-paginate-rest": ^8.0.0
"@octokit/plugin-request-log": ^4.0.0
"@octokit/plugin-rest-endpoint-methods": ^9.0.0
checksum: 4a2e8a623750233b7387d2bc0a9097b0f6caf8b1200bf7a9782b525cf745a8d65f3803f67619a9e4822c50e11ebbb5097fc744a021b5beebcb24452d025a9428
languageName: node
linkType: hard

"@octokit/types@npm:^11.0.0, @octokit/types@npm:^11.1.0":
version: 11.1.0
resolution: "@octokit/types@npm:11.1.0"
dependencies:
"@octokit/openapi-types": ^18.0.0
checksum: c2b6e6a8c3ed5ecd5619e71ebc10676f928c16bce9665ec56661a79d998fb5a8f3796ff58311b41b63328c1976d2a45f7c6d8ef6f831629547fccbd601b98424
languageName: node
linkType: hard

"@tsconfig/node10@npm:^1.0.7":
version: 1.0.8
resolution: "@tsconfig/node10@npm:1.0.8"
Expand Down Expand Up @@ -171,6 +298,13 @@ __metadata:
languageName: node
linkType: hard

"before-after-hook@npm:^2.2.0":
version: 2.2.3
resolution: "before-after-hook@npm:2.2.3"
checksum: 0488c4ae12df758ca9d49b3bb27b47fd559677965c52cae7b335784724fb8bf96c42b6e5ba7d7afcbc31facb0e294c3ef717cc41c5bc2f7bd9e76f8b90acd31c
languageName: node
linkType: hard

"brace-expansion@npm:^1.1.7":
version: 1.1.11
resolution: "brace-expansion@npm:1.1.11"
Expand Down Expand Up @@ -206,6 +340,13 @@ __metadata:
languageName: node
linkType: hard

"deprecation@npm:^2.0.0":
version: 2.3.1
resolution: "deprecation@npm:2.3.1"
checksum: 23d688ba66b74d09b908c40a76179418acbeeb0bfdf218c8075c58ad8d0c315130cb91aa3dffb623aa3a411a3569ce56c6460de6c8d69071c17fe6dd2442f032
languageName: node
linkType: hard

"diff@npm:^4.0.1":
version: 4.0.2
resolution: "diff@npm:4.0.2"
Expand Down Expand Up @@ -320,6 +461,13 @@ __metadata:
languageName: node
linkType: hard

"is-plain-object@npm:^5.0.0":
version: 5.0.0
resolution: "is-plain-object@npm:5.0.0"
checksum: 893e42bad832aae3511c71fd61c0bf61aa3a6d853061c62a307261842727d0d25f761ce9379f7ba7226d6179db2a3157efa918e7fe26360f3bf0842d9f28942c
languageName: node
linkType: hard

"is-stream@npm:^2.0.0":
version: 2.0.1
resolution: "is-stream@npm:2.0.1"
Expand Down Expand Up @@ -409,7 +557,7 @@ __metadata:
languageName: node
linkType: hard

"once@npm:^1.3.0":
"once@npm:^1.3.0, once@npm:^1.4.0":
version: 1.4.0
resolution: "once@npm:1.4.0"
dependencies:
Expand Down Expand Up @@ -445,6 +593,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "scripts@workspace:."
dependencies:
"@octokit/rest": ^20.0.1
"@types/fs-extra": ^9.0.13
"@types/glob": ^7.2.0
"@types/js-yaml": ^4.0.4
Expand Down Expand Up @@ -562,6 +711,13 @@ __metadata:
languageName: node
linkType: hard

"universal-user-agent@npm:^6.0.0":
version: 6.0.0
resolution: "universal-user-agent@npm:6.0.0"
checksum: ebeb0206963666c13bcf9ebc86d0577c7daed5870c05cd34d4972ee7a43b9ef20679baf2a8c83bf1b71d899bae67243ac4982d84ddaf9ba0355ff76595819961
languageName: node
linkType: hard

"universalify@npm:^2.0.0":
version: 2.0.0
resolution: "universalify@npm:2.0.0"
Expand Down