console.log('hello world')
+
+// Add a list, second parameter indicates if list is ordered, defaults to false
+core.summary.addList(['item1','item2','item3'], true)
+// Output: To be or not to be+ +// Add an HTML anchor tag +core.summary.addLink('click here', 'https://github.com') +// Output: click here + +``` + +Tables are added using the `addTable()` method, and an array of `SummaryTableRow`. + +```typescript + +export type SummaryTableRow = (SummaryTableCell | string)[] + +export interface SummaryTableCell { + /** + * Cell content + */ + data: string + /** + * Render cell as header + * (optional) default: false + */ + header?: boolean + /** + * Number of columns the cell extends + * (optional) default: '1' + */ + colspan?: string + /** + * Number of rows the cell extends + * (optional) default: '1' + */ + rowspan?: string +} + +``` + +For example + +```typescript + +const tableData = [ + {data: 'Header1', header: true}, + {data: 'Header2', header: true}, + {data: 'Header3', header: true}, + {data: 'MyData1'}, + {data: 'MyData2'}, + {data: 'MyData3'} +] + +// Add an HTML table +core.summary.addTable([tableData]) +// Output:
Header1 | Header2 | Header3 |
---|---|---|
MyData1 | MyData2 | MyData3 |
+Browsers + | + +Load `@octokit/auth-token` directly from [cdn.skypack.dev](https://cdn.skypack.dev) + +```html + +``` + + |
---|---|
+Node + |
+
+Install with npm install @octokit/auth-token
+
+```js
+const { createTokenAuth } = require("@octokit/auth-token");
+// or: 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
+const { Octokit } = require("@octokit/core");
+// or: 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
+const { endpoint } = require("@octokit/endpoint");
+// or: 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() |
+