diff --git a/.github/scripts/validate-and-merge.js b/.github/scripts/validate-and-merge.mjs similarity index 87% rename from .github/scripts/validate-and-merge.js rename to .github/scripts/validate-and-merge.mjs index 4e56965..f230bd3 100644 --- a/.github/scripts/validate-and-merge.js +++ b/.github/scripts/validate-and-merge.mjs @@ -1,7 +1,9 @@ +import { createRequire } from 'module'; +import fetch from 'node-fetch'; +const require = createRequire(import.meta.url); const fs = require('fs'); -const { Octokit } = require('@octokit/rest'); -const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN }); + const owner = process.env.REPO_OWNER; const repo = process.env.REPO_NAME; @@ -18,6 +20,14 @@ const requiredKeys = [ ]; async function validateAndMerge() { + const { Octokit } = await import('@octokit/rest'); + + const octokit = new Octokit({ + auth: process.env.GITHUB_TOKEN, + request: { + fetch: fetch, + }, + }); try { const { data: pr } = await octokit.pulls.get({ owner, diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml index 57a86b6..803f112 100644 --- a/.github/workflows/auto-merge.yml +++ b/.github/workflows/auto-merge.yml @@ -12,7 +12,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: '16' + node-version: '18' - name: Install dependencies run: npm install - name: Validate and auto-merge PR @@ -21,4 +21,4 @@ jobs: PR_NUMBER: ${{ github.event.pull_request.number }} REPO_OWNER: ${{ github.repository_owner }} REPO_NAME: ${{ github.event.repository.name }} - run: node .github/scripts/validate-and-merge.js \ No newline at end of file + run: node --experimental-modules .github/scripts/validate-and-merge.mjs \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e212594 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ + +node_modules diff --git a/node_modules/.yarn-integrity b/node_modules/.yarn-integrity new file mode 100644 index 0000000..b96230f --- /dev/null +++ b/node_modules/.yarn-integrity @@ -0,0 +1,33 @@ +{ + "systemParams": "darwin-arm64-108", + "modulesFolders": [ + "node_modules" + ], + "flags": [], + "linkedModules": [], + "topLevelPatterns": [ + "@octokit/rest@^21.0.2" + ], + "lockfileEntries": { + "@octokit/auth-token@^5.0.0": "https://registry.yarnpkg.com/@octokit/auth-token/-/auth-token-5.1.1.tgz#3bbfe905111332a17f72d80bd0b51a3e2fa2cf07", + "@octokit/core@^6.1.2": "https://registry.yarnpkg.com/@octokit/core/-/core-6.1.2.tgz#20442d0a97c411612da206411e356014d1d1bd17", + "@octokit/endpoint@^10.0.0": "https://registry.yarnpkg.com/@octokit/endpoint/-/endpoint-10.1.1.tgz#1a9694e7aef6aa9d854dc78dd062945945869bcc", + "@octokit/graphql@^8.0.0": "https://registry.yarnpkg.com/@octokit/graphql/-/graphql-8.1.1.tgz#3cacab5f2e55d91c733e3bf481d3a3f8a5f639c4", + "@octokit/openapi-types@^22.2.0": "https://registry.yarnpkg.com/@octokit/openapi-types/-/openapi-types-22.2.0.tgz#75aa7dcd440821d99def6a60b5f014207ae4968e", + "@octokit/plugin-paginate-rest@^11.0.0": "https://registry.yarnpkg.com/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-11.3.5.tgz#a1929b3ba3dc7b63bc73bb6d3c7a3faf2a9c7649", + "@octokit/plugin-request-log@^5.3.1": "https://registry.yarnpkg.com/@octokit/plugin-request-log/-/plugin-request-log-5.3.1.tgz#ccb75d9705de769b2aa82bcd105cc96eb0c00f69", + "@octokit/plugin-rest-endpoint-methods@^13.0.0": "https://registry.yarnpkg.com/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-13.2.6.tgz#b9d343dbe88a6cb70cc7fa16faa98f0a29ffe654", + "@octokit/request-error@^6.0.1": "https://registry.yarnpkg.com/@octokit/request-error/-/request-error-6.1.5.tgz#907099e341c4e6179db623a0328d678024f54653", + "@octokit/request@^9.0.0": "https://registry.yarnpkg.com/@octokit/request/-/request-9.1.3.tgz#42b693bc06238f43af3c037ebfd35621c6457838", + "@octokit/rest@^21.0.2": "https://registry.yarnpkg.com/@octokit/rest/-/rest-21.0.2.tgz#9b767dbc1098daea8310fd8b76bf7a97215d5972", + "@octokit/types@^13.0.0": "https://registry.yarnpkg.com/@octokit/types/-/types-13.6.1.tgz#432fc6c0aaae54318e5b2d3e15c22ac97fc9b15f", + "@octokit/types@^13.1.0": "https://registry.yarnpkg.com/@octokit/types/-/types-13.6.1.tgz#432fc6c0aaae54318e5b2d3e15c22ac97fc9b15f", + "@octokit/types@^13.6.0": "https://registry.yarnpkg.com/@octokit/types/-/types-13.6.1.tgz#432fc6c0aaae54318e5b2d3e15c22ac97fc9b15f", + "@octokit/types@^13.6.1": "https://registry.yarnpkg.com/@octokit/types/-/types-13.6.1.tgz#432fc6c0aaae54318e5b2d3e15c22ac97fc9b15f", + "before-after-hook@^3.0.2": "https://registry.yarnpkg.com/before-after-hook/-/before-after-hook-3.0.2.tgz#d5665a5fa8b62294a5aa0a499f933f4a1016195d", + "universal-user-agent@^7.0.0": "https://registry.yarnpkg.com/universal-user-agent/-/universal-user-agent-7.0.2.tgz#52e7d0e9b3dc4df06cc33cb2b9fd79041a54827e", + "universal-user-agent@^7.0.2": "https://registry.yarnpkg.com/universal-user-agent/-/universal-user-agent-7.0.2.tgz#52e7d0e9b3dc4df06cc33cb2b9fd79041a54827e" + }, + "files": [], + "artifacts": {} +} \ No newline at end of file diff --git a/node_modules/@octokit/auth-token/LICENSE b/node_modules/@octokit/auth-token/LICENSE new file mode 100644 index 0000000..ef2c18e --- /dev/null +++ b/node_modules/@octokit/auth-token/LICENSE @@ -0,0 +1,21 @@ +The MIT License + +Copyright (c) 2019 Octokit contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/@octokit/auth-token/README.md b/node_modules/@octokit/auth-token/README.md new file mode 100644 index 0000000..f94e2f2 --- /dev/null +++ b/node_modules/@octokit/auth-token/README.md @@ -0,0 +1,284 @@ +# auth-token.js + +> GitHub API token authentication for browsers and Node.js + +[](https://www.npmjs.com/package/@octokit/auth-token) +[](https://github.com/octokit/auth-token.js/actions?query=workflow%3ATest) + +`@octokit/auth-token` is the simplest of [GitHub’s authentication strategies](https://github.com/octokit/auth.js). + +It is useful if you want to support multiple authentication strategies, as it’s API is compatible with its sibling packages for [basic](https://github.com/octokit/auth-basic.js), [GitHub App](https://github.com/octokit/auth-app.js) and [OAuth app](https://github.com/octokit/auth.js) authentication. + + + +- [Usage](#usage) +- [`createTokenAuth(token) options`](#createtokenauthtoken-options) +- [`auth()`](#auth) +- [Authentication object](#authentication-object) +- [`auth.hook(request, route, options)` or `auth.hook(request, options)`](#authhookrequest-route-options-or-authhookrequest-options) +- [Find more information](#find-more-information) + - [Find out what scopes are enabled for oauth tokens](#find-out-what-scopes-are-enabled-for-oauth-tokens) + - [Find out if token is a personal access token or if it belongs to an OAuth app](#find-out-if-token-is-a-personal-access-token-or-if-it-belongs-to-an-oauth-app) + - [Find out what permissions are enabled for a repository](#find-out-what-permissions-are-enabled-for-a-repository) + - [Use token for git operations](#use-token-for-git-operations) +- [License](#license) + + + +## Usage + +
| +Browsers + | + +Load `@octokit/auth-token` directly from [esm.sh](https://esm.sh) + +```html + +``` + + |
|---|---|
| +Node + |
+
+Install with npm install @octokit/auth-token
+
+```js
+import { createTokenAuth } from "@octokit/auth-token";
+```
+
+ |
| + name + | ++ type + | ++ description + | +
|---|---|---|
+ type
+ |
+
+ string
+ |
+
+ "token"
+ |
+
+ token
+ |
+
+ string
+ |
+ + The provided token. + | +
+ tokenType
+ |
+
+ string
+ |
+
+ Can be either "oauth" for personal access tokens and OAuth tokens, "installation" for installation access tokens (includes GITHUB_TOKEN provided to GitHub Actions), "app" for a GitHub App JSON Web Token, or "user-to-server" for a user authentication token through an app installation.
+ |
+
| +Browsers + |
+Load @octokit/core directly from esm.sh
+
+```html
+
+```
+
+ |
|---|---|
| +Node + |
+
+Install with npm install @octokit/core
+
+```js
+import { Octokit } from "@octokit/core";
+```
+
+ |
| + name + | ++ type + | ++ description + | +
|---|---|---|
+ options.authStrategy
+ |
+
+ Function |
+
+ Defaults to @octokit/auth-token. See Authentication below for examples.
+ |
+
+ options.auth
+ |
+
+ String or Object
+ |
+ + See Authentication below for examples. + | +
+ options.baseUrl
+ |
+
+ String
+ |
+ + +When using with GitHub Enterprise Server, set `options.baseUrl` to the root URL of the API. For example, if your GitHub Enterprise Server's hostname is `github.acme-inc.com`, then set `options.baseUrl` to `https://github.acme-inc.com/api/v3`. Example + +```js +const octokit = new Octokit({ + baseUrl: "https://github.acme-inc.com/api/v3", +}); +``` + + |
+ options.previews
+ |
+
+ Array of Strings
+ |
+ + +Some REST API endpoints require preview headers to be set, or enable +additional features. Preview headers can be set on a per-request basis, e.g. + +```js +octokit.request("POST /repos/{owner}/{repo}/pulls", { + mediaType: { + previews: ["shadow-cat"], + }, + owner, + repo, + title: "My pull request", + base: "main", + head: "my-feature", + draft: true, +}); +``` + +You can also set previews globally, by setting the `options.previews` option on the constructor. Example: + +```js +const octokit = new Octokit({ + previews: ["shadow-cat"], +}); +``` + + |
+ options.request
+ |
+
+ Object
+ |
+ + +Set a default request timeout (`options.request.timeout`) or an [`http(s).Agent`](https://nodejs.org/api/http.html#http_class_http_agent) e.g. for proxy usage (Node only, `options.request.agent`). + +There are more `options.request.*` options, see [`@octokit/request` options](https://github.com/octokit/request.js#request). `options.request` can also be set on a per-request basis. + + |
+ options.timeZone
+ |
+
+ String
+ |
+ + +Sets the `Time-Zone` header which defines a timezone according to the [list of names from the Olson database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones). + +```js +const octokit = new Octokit({ + timeZone: "America/Los_Angeles", +}); +``` + +The time zone header will determine the timezone used for generating the timestamp when creating commits. See [GitHub's Timezones documentation](https://developer.github.com/v3/#timezones). + + |
+ options.userAgent
+ |
+
+ String
+ |
+ + +A custom user agent string for your app or library. Example + +```js +const octokit = new Octokit({ + userAgent: "my-app/v1.2.3", +}); +``` + + |
| +Browsers + |
+Load @octokit/endpoint directly from esm.sh
+
+```html
+
+```
+
+ |
|---|---|
| +Node + |
+
+Install with npm install @octokit/endpoint
+
+```js
+import { endpoint } from "@octokit/endpoint";
+```
+
+ |
| + name + | ++ type + | ++ description + | +
|---|---|---|
+ route
+ |
+ + String + | +
+ If set, it has to be a string consisting of URL and the request method, e.g., GET /orgs/{org}. If it’s set to a URL, only the method defaults to GET.
+ |
+
+ options.method
+ |
+ + String + | +
+ Required unless route is set. Any supported http verb. Defaults to GET.
+ |
+
+ options.url
+ |
+ + String + | +
+ Required unless route is set. A path or full URL which may contain :variable or {variable} placeholders,
+ e.g., /orgs/{org}/repos. The url is parsed using url-template.
+ |
+
+ options.baseUrl
+ |
+ + String + | +
+ Defaults to https://api.github.com.
+ |
+
+ options.headers
+ |
+ + Object + | +
+ Custom headers. Passed headers are merged with defaults: + headers['user-agent'] defaults to octokit-endpoint.js/1.2.3 (where 1.2.3 is the released version).+ headers['accept'] defaults to application/vnd.github.v3+json.+ |
+
+ options.mediaType.format
+ |
+ + String + | +
+ Media type param, such as raw, diff, or text+json. See Media Types. Setting options.mediaType.format will amend the headers.accept value.
+ |
+
+ options.data
+ |
+ + Any + | +
+ Set request body directly instead of setting it to JSON based on additional parameters. See "The data parameter" below.
+ |
+
+ options.request
+ |
+ + Object + | +
+ Pass custom meta information for the request. The request object will be returned as is.
+ |
+
| + key + | ++ type + | ++ description + | +
|---|---|---|
method |
+ String | +The http method. Always lowercase. | +
url |
+ String | +The url with placeholders replaced with passed parameters. | +
headers |
+ Object | +All header names are lowercased. | +
body |
+ Any | +The request body if one is present. Only for PATCH, POST, PUT, DELETE requests. |
+
request |
+ Object | +Request meta option, it will be returned as it was passed into endpoint() |
+