diff --git a/actions/cleanup/main.js b/actions/cleanup/main.js index 8040cfbbb..83929c1f0 100644 --- a/actions/cleanup/main.js +++ b/actions/cleanup/main.js @@ -4,6 +4,11 @@ const github = require("@actions/github"); const thisRepo = { owner: "eps1lon", repo: "mui-scripts-incubator" }; const muiRepo = { owner: "mui-org", repo: "material-ui" }; +/** + * `github.getOctokit()` produces `any` + * @typedef {import('@octokit/core').Octokit & { rest: import('@octokit/rest').RestEndpointMethodTypes }} Octokit + */ + main().catch((error) => { core.error(error.stdout); core.error(error.stderr); @@ -17,7 +22,7 @@ async function main() { /** * Deletes PRs tracking a Material-UI PR that is resolved (closed or merged) - * @param {import('@actions/github').GitHub} octokit + * @param {Octokit} octokit */ async function cleanupSnapshotPrsForClosedMuiPrs(octokit) { // find branches for Material-UI PRs @@ -26,7 +31,7 @@ async function cleanupSnapshotPrsForClosedMuiPrs(octokit) { `found ${branchesRelatedToMui.length} branches related to Material-UI` ); const tasks = branchesRelatedToMui.map(async (branch) => { - const { data: pullRequest } = await octokit.pulls.get({ + const { data: pullRequest } = await octokit.rest.pulls.get({ ...muiRepo, pull_number: branch.muiPrNumber, }); @@ -44,7 +49,7 @@ async function cleanupSnapshotPrsForClosedMuiPrs(octokit) { core.info( `Deleting ref '${ref}' for Material-UI PR #${branch.muiPrNumber} since it is '${pullRequest.state}'.` ); - return octokit.git + return octokit.rest.git .deleteRef({ ...thisRepo, ref: `heads/${branch.name}`, @@ -59,10 +64,10 @@ async function cleanupSnapshotPrsForClosedMuiPrs(octokit) { } /** * Only finds branches within the first 100 of the repository - * @param {import('@actions/github').GitHub} octokit + * @param {Octokit} octokit */ async function findBranchesRelatedToMui(octokit) { - const { data: branches } = await octokit.repos.listBranches({ + const { data: branches } = await octokit.rest.repos.listBranches({ ...thisRepo, per_page: 100, }); diff --git a/package.json b/package.json index 7c436559b..2db4ec928 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ ], "devDependencies": { "@actions/core": "1.4.0", - "@actions/github": "4.0.0", + "@actions/github": "5.0.0", "eslint": "7.31.0", "eslint-plugin-react": "7.24.0" }, diff --git a/yarn.lock b/yarn.lock index fbe59bff4..33d488832 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7,20 +7,20 @@ resolved "https://registry.yarnpkg.com/@actions/core/-/core-1.4.0.tgz#cf2e6ee317e314b03886adfeb20e448d50d6e524" integrity sha512-CGx2ilGq5i7zSLgiiGUtBCxhRRxibJYU6Fim0Q1Wg2aQL2LTnF27zbqZOrxfvFQ55eSBW0L8uVStgtKMpa0Qlg== -"@actions/github@4.0.0": - version "4.0.0" - resolved "https://registry.yarnpkg.com/@actions/github/-/github-4.0.0.tgz#d520483151a2bf5d2dc9cd0f20f9ac3a2e458816" - integrity sha512-Ej/Y2E+VV6sR9X7pWL5F3VgEWrABaT292DRqRU6R4hnQjPtC/zD3nagxVdXWiRQvYDh8kHXo7IDmG42eJ/dOMA== +"@actions/github@5.0.0": + version "5.0.0" + resolved "https://registry.yarnpkg.com/@actions/github/-/github-5.0.0.tgz#1754127976c50bd88b2e905f10d204d76d1472f8" + integrity sha512-QvE9eAAfEsS+yOOk0cylLBIO/d6WyWIOvsxxzdrPFaud39G6BOkUwScXZn1iBzQzHyu9SBkkLSWlohDWdsasAQ== dependencies: - "@actions/http-client" "^1.0.8" - "@octokit/core" "^3.0.0" - "@octokit/plugin-paginate-rest" "^2.2.3" - "@octokit/plugin-rest-endpoint-methods" "^4.0.0" + "@actions/http-client" "^1.0.11" + "@octokit/core" "^3.4.0" + "@octokit/plugin-paginate-rest" "^2.13.3" + "@octokit/plugin-rest-endpoint-methods" "^5.1.1" -"@actions/http-client@^1.0.8": - version "1.0.9" - resolved "https://registry.yarnpkg.com/@actions/http-client/-/http-client-1.0.9.tgz#af1947d020043dbc6a3b4c5918892095c30ffb52" - integrity sha512-0O4SsJ7q+MK0ycvXPl2e6bMXV7dxAXOGjrXS1eTF9s2S401Tp6c/P3c3Joz04QefC1J6Gt942Wl2jbm3f4mLcg== +"@actions/http-client@^1.0.11": + version "1.0.11" + resolved "https://registry.yarnpkg.com/@actions/http-client/-/http-client-1.0.11.tgz#c58b12e9aa8b159ee39e7dd6cbd0e91d905633c0" + integrity sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg== dependencies: tunnel "0.0.6" @@ -1517,19 +1517,7 @@ dependencies: "@octokit/types" "^6.0.0" -"@octokit/core@^3.0.0": - version "3.2.4" - resolved "https://registry.yarnpkg.com/@octokit/core/-/core-3.2.4.tgz#5791256057a962eca972e31818f02454897fd106" - integrity sha512-d9dTsqdePBqOn7aGkyRFe7pQpCXdibSJ5SFnrTr0axevObZrpz3qkWm7t/NjYv5a66z6vhfteriaq4FRz3e0Qg== - dependencies: - "@octokit/auth-token" "^2.4.4" - "@octokit/graphql" "^4.5.8" - "@octokit/request" "^5.4.12" - "@octokit/types" "^6.0.3" - before-after-hook "^2.1.0" - universal-user-agent "^6.0.0" - -"@octokit/core@^3.5.0": +"@octokit/core@^3.4.0", "@octokit/core@^3.5.0": version "3.5.1" resolved "https://registry.yarnpkg.com/@octokit/core/-/core-3.5.1.tgz#8601ceeb1ec0e1b1b8217b960a413ed8e947809b" integrity sha512-omncwpLVxMP+GLpLPgeGJBF6IWJFjXDS5flY5VbppePYX9XehevbDykRH9PdCdvqt9TS5AOTiDide7h0qrkHjw== @@ -1584,7 +1572,14 @@ resolved "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-9.1.1.tgz#fb87f2e2f44b95a5720d61dee409a9f1fbc59217" integrity sha512-xmyPP9tVb4T4A6Lk6SL6ScnIqAHpPV4jfMZI8VtY286212ri9J/6IFGuLsZ26daADUmriuLejake4k+azEfnaw== -"@octokit/plugin-paginate-rest@^2.2.3", "@octokit/plugin-paginate-rest@^2.6.2": +"@octokit/plugin-paginate-rest@^2.13.3": + version "2.14.0" + resolved "https://registry.yarnpkg.com/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.14.0.tgz#f469cb4a908792fb44679c5973d8bba820c88b0f" + integrity sha512-S2uEu2uHeI7Vf+Lvj8tv3O5/5TCAa8GHS0dUQN7gdM7vKA6ZHAbR6HkAVm5yMb1mbedLEbxOuQ+Fa0SQ7tCDLA== + dependencies: + "@octokit/types" "^6.18.0" + +"@octokit/plugin-paginate-rest@^2.6.2": version "2.6.2" resolved "https://registry.yarnpkg.com/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.6.2.tgz#45d13dbf5ff8aed54f1a3716b1d57fdc62720c5f" integrity sha512-3Dy7/YZAwdOaRpGQoNHPeT0VU1fYLpIUdPyvR37IyFLgd6XSij4j9V/xN/+eSjF2KKvmfIulEh9LF1tRPjIiDA== @@ -1596,7 +1591,7 @@ resolved "https://registry.yarnpkg.com/@octokit/plugin-request-log/-/plugin-request-log-1.0.2.tgz#394d59ec734cd2f122431fbaf05099861ece3c44" integrity sha512-oTJSNAmBqyDR41uSMunLQKMX0jmEXbwD1fpz8FG27lScV3RhtGfBa1/BBLym+PxcC16IBlF7KH9vP1BUYxA+Eg== -"@octokit/plugin-rest-endpoint-methods@5.5.1": +"@octokit/plugin-rest-endpoint-methods@5.5.1", "@octokit/plugin-rest-endpoint-methods@^5.1.1": version "5.5.1" resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.5.1.tgz#31cce8fc3eda4d186bd90828cb7a2203ad95e3d1" integrity sha512-Al57+OZmO65JpiPk4JS6u6kQ2y9qjoZtY1IWiSshc4N+F7EcrK8Rgy/cUJBB4WIcSFUQyF66EJQK1oKgXWeRNw== @@ -1604,14 +1599,6 @@ "@octokit/types" "^6.21.1" deprecation "^2.3.1" -"@octokit/plugin-rest-endpoint-methods@^4.0.0": - version "4.13.0" - resolved "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-4.13.0.tgz#59a90f59a564d416214ab191c3ffcd641f175e6a" - integrity sha512-Ofusy7BwHkU7z4TNsVdf7wm5W3KR625KqlQj4AiWPnBvclmZU0Y2bVK8b8Mz8nW7sEX9TJcCdX6KeaincE/cLw== - dependencies: - "@octokit/types" "^6.11.0" - deprecation "^2.3.1" - "@octokit/request-error@^2.0.0": version "2.0.2" resolved "https://registry.yarnpkg.com/@octokit/request-error/-/request-error-2.0.2.tgz#0e76b83f5d8fdda1db99027ea5f617c2e6ba9ed0" @@ -1630,7 +1617,7 @@ deprecation "^2.0.0" once "^1.4.0" -"@octokit/request@^5.3.0", "@octokit/request@^5.4.12": +"@octokit/request@^5.3.0": version "5.4.12" resolved "https://registry.yarnpkg.com/@octokit/request/-/request-5.4.12.tgz#b04826fa934670c56b135a81447be2c1723a2ffc" integrity sha512-MvWYdxengUWTGFpfpefBBpVmmEYfkwMoxonIB3sUGp5rhdgwjXL1ejo6JbgzG/QD9B/NYt/9cJX1pxXeSIUCkg== @@ -1673,7 +1660,7 @@ dependencies: "@types/node" ">= 8" -"@octokit/types@^6.0.0", "@octokit/types@^6.0.1", "@octokit/types@^6.0.3", "@octokit/types@^6.11.0": +"@octokit/types@^6.0.0", "@octokit/types@^6.0.1", "@octokit/types@^6.0.3": version "6.14.2" resolved "https://registry.yarnpkg.com/@octokit/types/-/types-6.14.2.tgz#64c9457f38fb8522bdbba3c8cc814590a2d61bf5" integrity sha512-wiQtW9ZSy4OvgQ09iQOdyXYNN60GqjCL/UdMsepDr1Gr0QzpW6irIKbH3REuAHXAhxkEk9/F2a3Gcs1P6kW5jA== @@ -1687,7 +1674,7 @@ dependencies: "@octokit/openapi-types" "^8.2.1" -"@octokit/types@^6.21.1": +"@octokit/types@^6.18.0", "@octokit/types@^6.21.1": version "6.21.1" resolved "https://registry.yarnpkg.com/@octokit/types/-/types-6.21.1.tgz#d0f2b7598c88e13d0bd87e330d975e3fb2a90180" integrity sha512-PP+m3T5EWZKawru4zi/FvX8KL2vkO5f1fLthx78/7743p7RtJUevt3z7698k+7oAYRA7YuVqfXthSEHqkDvZ8g== @@ -2210,11 +2197,6 @@ bcrypt-pbkdf@^1.0.0: dependencies: tweetnacl "^0.14.3" -before-after-hook@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-2.1.0.tgz#b6c03487f44e24200dd30ca5e6a1979c5d2fb635" - integrity sha512-IWIbu7pMqyw3EAJHzzHbWa85b6oud/yfKYg5rqB5hNE8CeMi3nX+2C2sj0HswfblST86hpVEOAb9x34NZd6P7A== - before-after-hook@^2.2.0: version "2.2.2" resolved "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-2.2.2.tgz#a6e8ca41028d90ee2c24222f201c90956091613e"