Add most recent action

This commit is contained in:
Danny McCormick
2019-08-06 16:25:08 -04:00
parent fa4fd2aed4
commit dc7133054e
82 changed files with 1919 additions and 1030 deletions

View File

@@ -8,11 +8,12 @@ Returns an [Octokit SDK] client. See https://octokit.github.io/rest.js for the A
```
const github = require('@actions/github');
const core = require('@actions/core');
// This should be a token with access to your repository scoped in as a secret.
const myToken = process.env.GITHUB_TOKEN
const myToken = core.getInput('myToken');
const octokit = new github.GitHub(myToken)
const octokit = new github.GitHub(myToken);
const pulls = await octokit.pulls.get({
owner: 'octokit',
@@ -21,15 +22,15 @@ const pulls = await octokit.pulls.get({
mediaType: {
format: 'diff'
}
})
});
console.log(pulls)
console.log(pulls);
```
You can also make GraphQL requests:
```
const result = await octokit.graphql(query, variables)
const result = await octokit.graphql(query, variables);
```
Finally, you can get the context of the current action:
@@ -37,11 +38,11 @@ Finally, you can get the context of the current action:
```
const github = require('@actions/github');
const context = github.context
const context = github.context;
const newIssue = await octokit.issues.create({
...context.repo,
title: 'New issue!',
body: 'Hello Universe!'
})
```
});
```

View File

@@ -1,5 +1,7 @@
import { GraphQlQueryResponse, Variables } from '@octokit/graphql';
import Octokit from '@octokit/rest';
import * as Context from './context';
export declare const context: Context.Context;
export declare class GitHub extends Octokit {
graphql: (query: string, variables?: Variables) => Promise<GraphQlQueryResponse>;
constructor(token: string);

View File

@@ -16,7 +16,7 @@ const rest_1 = __importDefault(require("@octokit/rest"));
const Context = __importStar(require("./context"));
// We need this in order to extend Octokit
rest_1.default.prototype = new rest_1.default();
module.exports.context = new Context.Context();
exports.context = new Context.Context();
class GitHub extends rest_1.default {
constructor(token) {
super({ auth: `token ${token}` });

View File

@@ -1 +1 @@
{"version":3,"file":"github.js","sourceRoot":"","sources":["../src/github.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gGAAgG;AAChG,8CAA0E;AAC1E,yDAAmC;AACnC,mDAAoC;AAEpC,0CAA0C;AAC1C,cAAO,CAAC,SAAS,GAAG,IAAI,cAAO,EAAE,CAAA;AAEjC,MAAM,CAAC,OAAO,CAAC,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,CAAA;AAE9C,MAAa,MAAO,SAAQ,cAAO;IAMjC,YAAY,KAAa;QACvB,KAAK,CAAC,EAAC,IAAI,EAAE,SAAS,KAAK,EAAE,EAAC,CAAC,CAAA;QAC/B,IAAI,CAAC,OAAO,GAAG,kBAAQ,CAAC;YACtB,OAAO,EAAE,EAAC,aAAa,EAAE,SAAS,KAAK,EAAE,EAAC;SAC3C,CAAC,CAAA;IACJ,CAAC;CACF;AAZD,wBAYC"}
{"version":3,"file":"github.js","sourceRoot":"","sources":["../src/github.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gGAAgG;AAChG,8CAA0E;AAC1E,yDAAmC;AACnC,mDAAoC;AAEpC,0CAA0C;AAC1C,cAAO,CAAC,SAAS,GAAG,IAAI,cAAO,EAAE,CAAA;AAEpB,QAAA,OAAO,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,CAAA;AAE5C,MAAa,MAAO,SAAQ,cAAO;IAMjC,YAAY,KAAa;QACvB,KAAK,CAAC,EAAC,IAAI,EAAE,SAAS,KAAK,EAAE,EAAC,CAAC,CAAA;QAC/B,IAAI,CAAC,OAAO,GAAG,kBAAQ,CAAC;YACtB,OAAO,EAAE,EAAC,aAAa,EAAE,SAAS,KAAK,EAAE,EAAC;SAC3C,CAAC,CAAA;IACJ,CAAC;CACF;AAZD,wBAYC"}

View File

@@ -1,13 +1,13 @@
export interface PayloadRepository {
[key: string]: any;
fullName?: string;
full_name?: string;
name: string;
owner: {
[key: string]: any;
login: string;
name?: string;
};
htmlUrl?: string;
html_url?: string;
}
export interface WebhookPayload {
[key: string]: any;
@@ -18,10 +18,10 @@ export interface WebhookPayload {
html_url?: string;
body?: string;
};
pullRequest?: {
pull_request?: {
[key: string]: any;
number: number;
htmlUrl?: string;
html_url?: string;
body?: string;
};
sender?: {

View File

@@ -2,27 +2,27 @@
"_from": "file:toolkit\\actions-github-0.0.0.tgz",
"_id": "@actions/github@0.0.0",
"_inBundle": false,
"_integrity": "sha512-K13pi9kbZqFnvhe8m6uqfz4kCnB4Ki6fzv4XBae1zDZfn2Si+Qx6j1pAfXSo7QI2+ZWAX/g0paFgcJsS6ZTWZA==",
"_integrity": "sha512-CByX5VIagC5BqGwsHD9Qt5MfN+H6GDC9qQl+MIUipaHTc89sUG/vAY/xQDS9vxuuRwrxbdERwKO3dR6U1BSziw==",
"_location": "/@actions/github",
"_phantomChildren": {},
"_requested": {
"type": "file",
"where": "C:\\Users\\damccorm\\Documents\\node12-template",
"where": "C:\\Users\\damccorm\\Documents\\stale-bot",
"raw": "@actions/github@file:toolkit/actions-github-0.0.0.tgz",
"name": "@actions/github",
"escapedName": "@actions%2fgithub",
"scope": "@actions",
"rawSpec": "file:toolkit/actions-github-0.0.0.tgz",
"saveSpec": "file:toolkit\\actions-github-0.0.0.tgz",
"fetchSpec": "C:\\Users\\damccorm\\Documents\\node12-template\\toolkit\\actions-github-0.0.0.tgz"
"fetchSpec": "C:\\Users\\damccorm\\Documents\\stale-bot\\toolkit\\actions-github-0.0.0.tgz"
},
"_requiredBy": [
"/"
],
"_resolved": "C:\\Users\\damccorm\\Documents\\node12-template\\toolkit\\actions-github-0.0.0.tgz",
"_shasum": "0764713c5b42ec9bbd9b4ca26b971dcdedadd820",
"_resolved": "C:\\Users\\damccorm\\Documents\\stale-bot\\toolkit\\actions-github-0.0.0.tgz",
"_shasum": "d9a87b3682d66d032fffcaff1adcdb2decd92b81",
"_spec": "@actions/github@file:toolkit/actions-github-0.0.0.tgz",
"_where": "C:\\Users\\damccorm\\Documents\\node12-template",
"_where": "C:\\Users\\damccorm\\Documents\\stale-bot",
"bugs": {
"url": "https://github.com/actions/toolkit/issues"
},