diff --git a/__tests__/InputHelper.test.ts b/__tests__/InputHelper.test.ts deleted file mode 100644 index a0e4e8a6..00000000 --- a/__tests__/InputHelper.test.ts +++ /dev/null @@ -1,107 +0,0 @@ -import * as core from '@actions/core' -import { Env, resolve, defaultVars, testEvents, inputTestInputs, inferTestInputs, getTestEvents, Context } from './common/env' -import { getInputs, inferInput, IInferred } from '../src/InputHelper' - -let env: Env // env object -let envVars: any -let context: Context -const inputs: any = { githubToken: "1234abcd" } - -describe.each(testEvents)('Testing github action event %s...', event => { - // create a brand new context object for each event test set - beforeAll(() => { - let inputs: any = { githubToken: "1234abcd" } - let envVars: any = { ...defaultVars, ...{GITHUB_EVENT_PATH: resolve(__dirname, `payloads/events/${event}.json`)}} - env = new Env(envVars, inputs) - context = env.context - }) - // reset mocks and context object after each test - afterEach(() => { - env.reset() - }) - // reset mock after each event test set - afterAll(() => { - env.reset({}, {}, false, false) - }) - it('Sets correct default input parameters.', () => { - let data = getInputs(context) - // evaluate outputs - if (event.includes('push')) { - expect(data.prNumber).toBe(NaN) - expect(data.pushAfter).toBe(context.payload.after) - expect(data.pushBefore).toBe(context.payload.before) - } - if (event.includes('pull_request') || event.includes('issue_comment')) { - expect(data.prNumber).toBe(context.issue.number) - if (event === 'pull_request_synchronize') { - expect(data.pushAfter).toBe(context.payload.after) - expect(data.pushBefore).toBe(context.payload.before) - } else { - expect(data.pushAfter).toBeFalsy() - expect(data.pushBefore).toBeFalsy() - } - } - expect(data.githubToken).toBe(env.inputs.githubToken) - expect(data.githubRepo).toBe(process.env['GITHUB_REPOSITORY']) - expect(data.output).toBe('json') - expect(data.fileOutput).toBe('json') - expect(core.error).not.toHaveBeenCalled() - }) - it('Throws error with no token (undefined) process.env["GITHUB_TOKEN"] or (undefined) input githubToken', () => { - env.reset({}, {}, false, false) // no process.env token and token input - expect(() => { - getInputs(context) - }).toThrowError('Received no token, a token is a requirement.') - }) - it('Throws error with empty string ("") process.env["GITHUB_TOKEN"] or empty string ("") input githubToken', () => { - // empty process.env token - env.reset({ GITHUB_TOKEN: '' }, { githubToken: '' }, true, true) // empty process.env token and token input - expect(() => { - getInputs(context) - }).toThrowError('Received no token, a token is a requirement.') - }) - // test getInputs function - it.each(getTestEvents(inputTestInputs, event))('Sets %s input "%s" should be %p', (inputName, input, expected) => { - env.reset({}, { [inputName]: input }) - let data = getInputs(context) - // evaluate outputs - if (event.includes('push')) { - expect(data.prNumber).toBe((inputName === 'prNumber') ? expected : NaN) - expect(data.pushAfter).toBe((inputName === 'pushAfter') ? expected : context.payload.after ) - expect(data.pushBefore).toBe((inputName === 'pushBefore') ? expected : context.payload.before) - } - if (event.includes('pull_request') || event.includes('issue_comment')) { - expect(data.prNumber).toBe((inputName === 'prNumber') ? expected : context.issue.number) - if (event === 'pull_request_synchronize') { - expect(data.pushAfter).toBe((inputName === 'pushAfter') ? expected : context.payload.after ) - expect(data.pushBefore).toBe((inputName === 'pushBefore') ? expected : context.payload.before) - } else { - expect(data.pushAfter).toBe((inputName === 'pushAfter') ? expected : false ) - expect(data.pushBefore).toBe((inputName === 'pushBefore') ? expected : false ) - } - } - expect(data.githubToken).toBe((inputName === 'githubToken') ? expected : env.inputs.githubToken) - expect(data.githubRepo).toBe((inputName === 'githubRepo') ? expected : process.env['GITHUB_REPOSITORY']) - expect(data.output).toBe((inputName === 'output') ? expected : 'json') - expect(data.fileOutput).toBe((inputName === 'fileOutput') ? expected : 'json') - expect(data[inputName]).toBe(expected) - expect(core.error).not.toHaveBeenCalled() - }) - // test inferInput function - it.each(getTestEvents(inferTestInputs, event))('%s', (title, input, expected) => { - if (title.includes('ERROR')) { - expect(() => { - inferInput(input.event, input.before, input.after, input.pr) - }).toThrowError(`from ${input.event}, but received no in`) - } else { - let data = inferInput(input.event, input.before, input.after, input.pr) - Object.keys(data).forEach(key => expect(data[key]).toBe(expected[key])) - } - // evaluate outputs - if (title.includes('WARN weird')) expect(core.warning).toHaveBeenCalledWith(expect.stringContaining(`received a before(${input.before}) or after(${input.after}) value.`)) - if (title.includes('WARN all')) expect(core.warning).toHaveBeenCalledWith(expect.stringContaining(`but received a before(${input.before}), after(${input.after}), and PR(${input.pr}).`)) - if (title.includes('ERROR single')) expect(core.error).toHaveBeenCalledWith(expect.stringContaining(`from ${input.event}, but only received a before(${input.before}) or after(${input.after})`)) - else if (title.includes('ERROR with no inputs')) expect(core.error).toHaveBeenCalledWith(expect.stringContaining(`from ${input.event}, but received no in`)) - else expect(core.error).not.toHaveBeenCalled() - }) -}) diff --git a/__tests__/common/env.ts b/__tests__/common/env.ts deleted file mode 100644 index 696347b0..00000000 --- a/__tests__/common/env.ts +++ /dev/null @@ -1,194 +0,0 @@ -// imports -import { resolve as _resolve } from 'path' -import * as _Context from '@actions/github/lib/context' -import * as core from '@actions/core' -import { IInferred } from '../../src/InputHelper' -import { weirdFileArray, normalFileArray } from '../common/files' -// exports -export { Context } from '@actions/github/lib/context' -export { resolve as resolve } from 'path' - - - - -// InputHelper inputs -export const inputTestInputs: any[] = [ - { inputs: ['githubRepo', 'trilom-test/file-changes-action', 'trilom-test/file-changes-action'], events: "all"}, - { inputs: ['githubToken', '12345abcde', '12345abcde'], events: "all"}, - { inputs: ['pushBefore', 'abcd1234', 'abcd1234'], events: "all"}, - { inputs: ['pushAfter', '1234abcd', '1234abcd'], events: "all"}, - { inputs: ['prNumber', '1', 1], events: "all"}, - { inputs: ['output', 'json', 'json'], events: "all"}, - { inputs: ['fileOutput', 'json', 'json'], events: "all"} -] -export const inferTestInputs: any[] = [ - { inputs: ['Sets PUSH inferred outputs with pr inputs and PUSH inputs and PULL_REQUEST event', - { event: 'pull_request', before: '1234abcd', after: 'abcd1234', pr: 3 }, - { event_type: 'push', before: '1234abcd', after: 'abcd1234' } as IInferred], - events: ['pull_request_opened', 'pull_request_reopened', 'pull_request_synchronize']}, - { inputs: ['Sets PULL_REQUEST inferred outputs with single PUSH input and PULL_REQUEST event, ALSO WARN weird', - { event: 'pull_request', before: '1234abcd', after: '', pr: 2 }, - { event_type: 'pull_request', pr: 2 } as IInferred], - events: ['pull_request_opened', 'pull_request_reopened', 'pull_request_synchronize']}, - { inputs: ['Sets PULL_REQUEST inferred outputs with no PUSH inputs and PULL_REQUEST event', - { event: 'pull_request', before: '', after: '', pr: 4 }, - { event_type: 'pull_request', pr: 4 } as IInferred], - events: ['pull_request_opened', 'pull_request_reopened', 'pull_request_synchronize']}, - { inputs: ['Sets PULL_REQUEST inferred outputs with pr input and PUSH event', - { event: 'push', before: 'abcd12345', after: '12345abcd', pr: 1 }, - { event_type: 'pull_request', pr: 1 } as IInferred], - events: ['push', 'push_merge']}, - { inputs: ['Sets PUSH inferred outputs with no pr input and PUSH event', - { event: 'push', before: 'abcd1234', after: '1234abcd', pr: NaN }, - { event_type: 'push', before: 'abcd1234', after: '1234abcd' } as IInferred], - events: ['push', 'push_merge']}, - { inputs: ['Sets PUSH inferred outputs with PUSH and PULL_REQUEST inputs NOT PUSH or PULL_REQUEST event, ALSO WARN all', - { event: 'schedule', before: 'abcd12345', after: '12345abcd', pr: 1 }, - { event_type: 'push', before: 'abcd12345', after: '12345abcd' } as IInferred], - events: ['issue_comment_created', 'issue_comment_edited', 'schedule']}, - { inputs: ['Sets PULL_REQUEST inferred outputs with single PUSH and PULL_REQUEST inputs NOT PUSH or PULL_REQUEST event, ALSO WARN weird', - { event: 'schedule', before: '', after: 'abcd12345', pr: 3 }, - { event_type: 'pull_request', pr: 3 } as IInferred], - events: ['issue_comment_created', 'issue_comment_edited', 'schedule']}, - { inputs: ['Sets PULL_REQUEST inferred outputs with PULL_REQUEST input NOT PUSH or PULL_REQUEST event', - { event: 'schedule', before: '', after: '', pr: 44 }, - { event_type: 'pull_request', pr: 44 } as IInferred], - events: ['issue_comment_created', 'issue_comment_edited', 'schedule']}, - { inputs: ['Sets PUSH inferred outputs with PUSH inputs NOT PUSH or PULL_REQUEST event', - { event: 'schedule', before: 'abcd12345', after: '12345abcd', pr: NaN }, - { event_type: 'push', before: 'abcd12345', after: '12345abcd', pr: 44 } as IInferred], - events: ['issue_comment_created', 'issue_comment_edited', 'schedule']}, - { inputs: ['Throws ERROR with no inputs NOT PUSH or PULL_REQUEST event', - { event: 'schedule', before: '', after: '', pr: NaN }, - {} as IInferred], - events: ['issue_comment_created', 'issue_comment_edited', 'schedule']} -] -// FilesHelper inputs -export const ChangedFilesInputs: any[] = [ - { - inputs: ['Set output string to specified output format for ChangedFiles.getOutput', - [ - { format: 'json', changedFiles: normalFileArray }, - { format: ' ', changedFiles: normalFileArray }, - { format: ',', changedFiles: normalFileArray }, - { format: 'json', changedFiles: normalFileArray } - ], - [ - { format: 'json'} - ]], - events: "push" } -] -export const writeOutputInputs: any[] = [ - { inputs: ['Sets core.setOutput outputs with specified format', - { format: 'json', changedFiles: {} }, - {}], - events: "push" } -] -// GithubHelper inputs -// main inputs -export const defaultVars: any = { - GITHUB_TOKEN: 'abcd1234', - HOME: _resolve(__dirname, 'workspace'), - GITHUB_WORKSPACE: _resolve(__dirname, 'workspace/github'), - GITHUB_REPOSITORY: "trilom-test/file-changes-action", - GITHUB_ACTION: 'file-changes-action', - GITHUB_EVENT_PATH: _resolve(__dirname, `payloads/events/push.json`) -} - -export const testEvents: string[] = [ - 'issue_comment_created', - 'issue_comment_edited', - 'pull_request_opened', - 'pull_request_reopened', - 'pull_request_synchronize', - 'push_merge', - 'push', - 'schedule' -] - -export function getTestEvents(inputs: any, event: string): any[][] { - let ret: any[][] = [] - inputs.forEach(test => { - if (typeof test.events === 'string' && test.events === 'all') ret.push(test.inputs) // add for all events - else if (typeof test.events === 'string' && test.events === event) ret.push(test.inputs) // add for named event - else if (Array.isArray(test.events) && test.events.includes(event)) ret.push(test.inputs) // add for named event in list - }) - return ret -} - -export class Env { - context: _Context.Context // context object - _inputs: any = {} // mock object for action inputs - _inputsOriginal: any // storage for action inputs - set inputs(inputs: any | undefined) { // mock object setter for action inputs - if (typeof inputs === 'undefined') this._inputs - for (const key in inputs) - this._inputs[key] = inputs[key as keyof typeof inputs] - } - get inputs() { // mock object getter for action inputs - return this._inputs - } - _envDefault: any = process.env // storage for original process.env - _envOriginal: any // storage for process.env inputs - _issue: any = {} // mock object for context.issue - _issueOriginal: any = {} // original context.issue - _repo: any = {} // mock object for context.repo - _repoOriginal: any = {} // original context.repo - // set mocks - inputSpy: jest.SpyInstance // mock for core.getInput - repoSpy: jest.SpyInstance // mock for context.repo - issueSpy: jest.SpyInstance // mock for context.issue - logSpy: jest.SpyInstance // mock for console.log - debugSpy: jest.SpyInstance // mock for core.debug - infoSpy: jest.SpyInstance // mock for core.info - warningSpy: jest.SpyInstance // mock for core.warning - errorSpy: jest.SpyInstance // mock for core.error - - reset( - envVars: any = {}, // pass in envVars - inputs: any = {}, // pass in inputs for action - envVarsOriginal: boolean = true, // bool (true) to include original passed in envVars with this resetted object - inputsOriginal: boolean = true, // bool (true) to include original pass in action inputs with this resetted object - init?: boolean): void { // bool (false) to return before restting repo and issue context.issue and context.repo - // if (process.env['GITHUB_EVENT_PATH']?.includes('pull_request')) { - // console.error(`before add original GITHUB_TOKEN ${JSON.stringify(process.env['GITHUB_TOKEN'])}, original inputs ${JSON.stringify(inputs)}, default GITHUB_TOKEN ${JSON.stringify(this._envDefault['GITHUB_TOKEN'])}, original original GITHUB_TOKEN ${JSON.stringify(this._envOriginal['GITHUB_TOKEN'])}`) - // } - if (envVarsOriginal) envVars = { ...this._envOriginal, ...envVars } - if (inputsOriginal) inputs = { ...this._inputsOriginal, ...inputs } - // if (process.env['GITHUB_EVENT_PATH']?.includes('pull_request')) { - // console.error(`after add original GITHUB_TOKEN ${JSON.stringify(process.env['GITHUB_TOKEN'])}, original inputs ${JSON.stringify(inputs)}, default GITHUB_TOKEN ${JSON.stringify(this._envDefault['GITHUB_TOKEN'])}, original original GITHUB_TOKEN ${JSON.stringify(this._envOriginal['GITHUB_TOKEN'])}`) - // } - // reset mocks - process.env = { ...this._envDefault, ...envVars } // set action process.env variables - this._inputs = { ...inputs } // set action inputs - if (init) return // if init then return to copy original repo/issue for mocks - this._issue = this._issueOriginal // reset issue mock - this._repo = this._repoOriginal - // if (process.env['GITHUB_EVENT_PATH']?.includes('pull_request')) { - // console.error(`RESET\ngithubToken: ${process.env['githubToken']}\nGITHUB_TOKEN: ${process.env['GITHUB_TOKEN']}\ninput: ${inputs['githubToken']}`) - // } - - } - - constructor(envVars: any = {}, inputs: any = {}) { - // console.error(`Creating Env object...\nenvVars:${JSON.stringify(envVars)}\ninputs:${JSON.stringify(inputs)}`) - this._envOriginal = { ...envVars } // store original input env - this._inputsOriginal = { ...inputs } // store original action inputs - this.reset(envVars, inputs, true, true, true) // set env vars and inputs - this.context = new _Context.Context() // create context with env vars - this._issue = this._issueOriginal = this.context.issue || { repo: 'file-changes-action', owner: 'trilom'} // copy init var for context.issue - this._repo = this._repoOriginal = this.context.repo || { repo: 'file-changes-action', owner: 'trilom' } // copy init var for context.repo - // create mocks - this.inputSpy = jest.spyOn(core, 'getInput').mockImplementation((name: string) => this._inputs[name]); - this.issueSpy = jest.spyOn(this.context, 'issue', 'get').mockImplementation(() => this._issue) - this.repoSpy = jest.spyOn(this.context, 'repo', 'get').mockImplementation(() => this._repo) - this.debugSpy = jest.spyOn(core, 'debug').mockImplementation(jest.fn()) - this.infoSpy = jest.spyOn(core, 'info').mockImplementation(jest.fn()) - this.warningSpy = jest.spyOn(core, 'warning').mockImplementation(jest.fn()) - this.errorSpy = jest.spyOn(core, 'error').mockImplementation(jest.fn()) - this.logSpy = jest.spyOn(console, 'log').mockImplementation(line => { - // uncomment to debug - process.stderr.write('log:' + line + '\n'); - }); - } -} \ No newline at end of file diff --git a/__tests__/helpers/setup.ts b/__tests__/helpers/setup.ts deleted file mode 100644 index 7bb8b8b9..00000000 --- a/__tests__/helpers/setup.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { resolve, join } from 'path' -import {readFileSync} from 'fs' -import * as dotenv from 'dotenv' - -export const path = join(__dirname, '..') - -export interface ProcessEnv { - [key: string]: string | undefined -} - -// init environment -export function initConfig(force: boolean = true, path?: string): void { - if (process.env['GITHUB_REPOSITORY'] === 'trilom-test/file-changes-action' || - ! process.env['GITHUB_REPOSITORY']) { - // path to root - const realPath = path || resolve(__dirname, '..') - // location of environment - const envPath = resolve(realPath, ".env") - // set environment - dotenv.config({ path: envPath }) - // reset environment to file if force - if (force) resetConfig(envPath) - // set path vars to current path based on env + current - const envVars = ['GITHUB_EVENT_PATH', 'HOME', 'GITHUB_WORKSPACE'] - envVars.forEach(s => { - if (!process.env[s]?.includes(realPath)) process.env[s] = join(realPath, process.env[s] || '') - }) - } -} -async function resetConfig(path: string): Promise { - const envConfig = dotenv.parse(readFileSync(path)) - for (const k in envConfig) { - process.env[k] = envConfig[k] - } -} \ No newline at end of file diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts deleted file mode 100644 index efcf95e4..00000000 --- a/__tests__/main.test.ts +++ /dev/null @@ -1,27 +0,0 @@ -import {wait} from '../src/wait' -import * as process from 'process' -import * as cp from 'child_process' -import * as path from 'path' - -test('throws invalid number', async () => { - const input = parseInt('foo', 10) - await expect(wait(input)).rejects.toThrow('milliseconds not a number') -}) - -test('wait 500 ms', async () => { - const start = new Date() - await wait(500) - const end = new Date() - var delta = Math.abs(end.getTime() - start.getTime()) - expect(delta).toBeGreaterThan(450) -}) - -// shows how the runner will run a javascript action with env / stdout protocol -test('test runs', () => { - process.env['INPUT_MILLISECONDS'] = '500' - const ip = path.join(__dirname, '..', 'lib', 'main.js') - const options: cp.ExecSyncOptions = { - env: process.env - } - console.log(cp.execSync(`node ${ip}`, options).toString()) -}) diff --git a/__tests__/payloads/events/issue_comment_created.json b/__tests__/payloads/events/issue_comment_created.json deleted file mode 100644 index 4f3d66a4..00000000 --- a/__tests__/payloads/events/issue_comment_created.json +++ /dev/null @@ -1,204 +0,0 @@ -{ - "action": "created", - "comment": { - "author_association": "OWNER", - "body": "comment", - "created_at": "2020-03-05T01:48:18Z", - "html_url": "https://github.com/trilom-test/file-changes-action/pull/5#issuecomment-594984510", - "id": 594984510, - "issue_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/5", - "node_id": "MDEyOklzc3VlQ29tbWVudDU5NDk4NDUxMA==", - "updated_at": "2020-03-05T01:48:18Z", - "url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/comments/594984510", - "user": { - "avatar_url": "https://avatars3.githubusercontent.com/u/61441570?v=4", - "events_url": "https://api.github.com/users/trilom-test/events{/privacy}", - "followers_url": "https://api.github.com/users/trilom-test/followers", - "following_url": "https://api.github.com/users/trilom-test/following{/other_user}", - "gists_url": "https://api.github.com/users/trilom-test/gists{/gist_id}", - "gravatar_id": "", - "html_url": "https://github.com/trilom-test", - "id": 61441570, - "login": "trilom-test", - "node_id": "MDQ6VXNlcjYxNDQxNTcw", - "organizations_url": "https://api.github.com/users/trilom-test/orgs", - "received_events_url": "https://api.github.com/users/trilom-test/received_events", - "repos_url": "https://api.github.com/users/trilom-test/repos", - "site_admin": false, - "starred_url": "https://api.github.com/users/trilom-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/trilom-test/subscriptions", - "type": "User", - "url": "https://api.github.com/users/trilom-test" - } - }, - "issue": { - "assignee": null, - "assignees": [], - "author_association": "OWNER", - "body": "", - "closed_at": null, - "comments": 1, - "comments_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/5/comments", - "created_at": "2020-03-05T01:48:12Z", - "events_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/5/events", - "html_url": "https://github.com/trilom-test/file-changes-action/pull/5", - "id": 575936509, - "labels": [], - "labels_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/5/labels{/name}", - "locked": false, - "milestone": null, - "node_id": "MDExOlB1bGxSZXF1ZXN0Mzg0MDIyMTM5", - "number": 5, - "pull_request": { - "diff_url": "https://github.com/trilom-test/file-changes-action/pull/5.diff", - "html_url": "https://github.com/trilom-test/file-changes-action/pull/5", - "patch_url": "https://github.com/trilom-test/file-changes-action/pull/5.patch", - "url": "https://api.github.com/repos/trilom-test/file-changes-action/pulls/5" - }, - "repository_url": "https://api.github.com/repos/trilom-test/file-changes-action", - "state": "open", - "title": "test", - "updated_at": "2020-03-05T01:48:18Z", - "url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/5", - "user": { - "avatar_url": "https://avatars3.githubusercontent.com/u/61441570?v=4", - "events_url": "https://api.github.com/users/trilom-test/events{/privacy}", - "followers_url": "https://api.github.com/users/trilom-test/followers", - "following_url": "https://api.github.com/users/trilom-test/following{/other_user}", - "gists_url": "https://api.github.com/users/trilom-test/gists{/gist_id}", - "gravatar_id": "", - "html_url": "https://github.com/trilom-test", - "id": 61441570, - "login": "trilom-test", - "node_id": "MDQ6VXNlcjYxNDQxNTcw", - "organizations_url": "https://api.github.com/users/trilom-test/orgs", - "received_events_url": "https://api.github.com/users/trilom-test/received_events", - "repos_url": "https://api.github.com/users/trilom-test/repos", - "site_admin": false, - "starred_url": "https://api.github.com/users/trilom-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/trilom-test/subscriptions", - "type": "User", - "url": "https://api.github.com/users/trilom-test" - } - }, - "repository": { - "archive_url": "https://api.github.com/repos/trilom-test/file-changes-action/{archive_format}{/ref}", - "archived": false, - "assignees_url": "https://api.github.com/repos/trilom-test/file-changes-action/assignees{/user}", - "blobs_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/blobs{/sha}", - "branches_url": "https://api.github.com/repos/trilom-test/file-changes-action/branches{/branch}", - "clone_url": "https://github.com/trilom-test/file-changes-action.git", - "collaborators_url": "https://api.github.com/repos/trilom-test/file-changes-action/collaborators{/collaborator}", - "comments_url": "https://api.github.com/repos/trilom-test/file-changes-action/comments{/number}", - "commits_url": "https://api.github.com/repos/trilom-test/file-changes-action/commits{/sha}", - "compare_url": "https://api.github.com/repos/trilom-test/file-changes-action/compare/{base}...{head}", - "contents_url": "https://api.github.com/repos/trilom-test/file-changes-action/contents/{+path}", - "contributors_url": "https://api.github.com/repos/trilom-test/file-changes-action/contributors", - "created_at": "2020-02-25T04:29:40Z", - "default_branch": "releases/v1", - "deployments_url": "https://api.github.com/repos/trilom-test/file-changes-action/deployments", - "description": "This action can be added, and you will get outputs of all of the files that have changed in your repository for you to use.", - "disabled": false, - "downloads_url": "https://api.github.com/repos/trilom-test/file-changes-action/downloads", - "events_url": "https://api.github.com/repos/trilom-test/file-changes-action/events", - "fork": true, - "forks": 0, - "forks_count": 0, - "forks_url": "https://api.github.com/repos/trilom-test/file-changes-action/forks", - "full_name": "trilom-test/file-changes-action", - "git_commits_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/commits{/sha}", - "git_refs_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/refs{/sha}", - "git_tags_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/tags{/sha}", - "git_url": "git://github.com/trilom-test/file-changes-action.git", - "has_downloads": true, - "has_issues": false, - "has_pages": false, - "has_projects": true, - "has_wiki": true, - "homepage": null, - "hooks_url": "https://api.github.com/repos/trilom-test/file-changes-action/hooks", - "html_url": "https://github.com/trilom-test/file-changes-action", - "id": 242909684, - "issue_comment_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/comments{/number}", - "issue_events_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/events{/number}", - "issues_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues{/number}", - "keys_url": "https://api.github.com/repos/trilom-test/file-changes-action/keys{/key_id}", - "labels_url": "https://api.github.com/repos/trilom-test/file-changes-action/labels{/name}", - "language": "JavaScript", - "languages_url": "https://api.github.com/repos/trilom-test/file-changes-action/languages", - "license": { - "key": "mit", - "name": "MIT License", - "node_id": "MDc6TGljZW5zZTEz", - "spdx_id": "MIT", - "url": "https://api.github.com/licenses/mit" - }, - "merges_url": "https://api.github.com/repos/trilom-test/file-changes-action/merges", - "milestones_url": "https://api.github.com/repos/trilom-test/file-changes-action/milestones{/number}", - "mirror_url": null, - "name": "file-changes-action", - "node_id": "MDEwOlJlcG9zaXRvcnkyNDI5MDk2ODQ=", - "notifications_url": "https://api.github.com/repos/trilom-test/file-changes-action/notifications{?since,all,participating}", - "open_issues": 1, - "open_issues_count": 1, - "owner": { - "avatar_url": "https://avatars3.githubusercontent.com/u/61441570?v=4", - "events_url": "https://api.github.com/users/trilom-test/events{/privacy}", - "followers_url": "https://api.github.com/users/trilom-test/followers", - "following_url": "https://api.github.com/users/trilom-test/following{/other_user}", - "gists_url": "https://api.github.com/users/trilom-test/gists{/gist_id}", - "gravatar_id": "", - "html_url": "https://github.com/trilom-test", - "id": 61441570, - "login": "trilom-test", - "node_id": "MDQ6VXNlcjYxNDQxNTcw", - "organizations_url": "https://api.github.com/users/trilom-test/orgs", - "received_events_url": "https://api.github.com/users/trilom-test/received_events", - "repos_url": "https://api.github.com/users/trilom-test/repos", - "site_admin": false, - "starred_url": "https://api.github.com/users/trilom-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/trilom-test/subscriptions", - "type": "User", - "url": "https://api.github.com/users/trilom-test" - }, - "private": false, - "pulls_url": "https://api.github.com/repos/trilom-test/file-changes-action/pulls{/number}", - "pushed_at": "2020-03-05T01:48:13Z", - "releases_url": "https://api.github.com/repos/trilom-test/file-changes-action/releases{/id}", - "size": 29568, - "ssh_url": "git@github.com:trilom-test/file-changes-action.git", - "stargazers_count": 0, - "stargazers_url": "https://api.github.com/repos/trilom-test/file-changes-action/stargazers", - "statuses_url": "https://api.github.com/repos/trilom-test/file-changes-action/statuses/{sha}", - "subscribers_url": "https://api.github.com/repos/trilom-test/file-changes-action/subscribers", - "subscription_url": "https://api.github.com/repos/trilom-test/file-changes-action/subscription", - "svn_url": "https://github.com/trilom-test/file-changes-action", - "tags_url": "https://api.github.com/repos/trilom-test/file-changes-action/tags", - "teams_url": "https://api.github.com/repos/trilom-test/file-changes-action/teams", - "trees_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/trees{/sha}", - "updated_at": "2020-03-05T01:45:22Z", - "url": "https://api.github.com/repos/trilom-test/file-changes-action", - "watchers": 0, - "watchers_count": 0 - }, - "sender": { - "avatar_url": "https://avatars3.githubusercontent.com/u/61441570?v=4", - "events_url": "https://api.github.com/users/trilom-test/events{/privacy}", - "followers_url": "https://api.github.com/users/trilom-test/followers", - "following_url": "https://api.github.com/users/trilom-test/following{/other_user}", - "gists_url": "https://api.github.com/users/trilom-test/gists{/gist_id}", - "gravatar_id": "", - "html_url": "https://github.com/trilom-test", - "id": 61441570, - "login": "trilom-test", - "node_id": "MDQ6VXNlcjYxNDQxNTcw", - "organizations_url": "https://api.github.com/users/trilom-test/orgs", - "received_events_url": "https://api.github.com/users/trilom-test/received_events", - "repos_url": "https://api.github.com/users/trilom-test/repos", - "site_admin": false, - "starred_url": "https://api.github.com/users/trilom-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/trilom-test/subscriptions", - "type": "User", - "url": "https://api.github.com/users/trilom-test" - } -} \ No newline at end of file diff --git a/__tests__/payloads/events/issue_comment_edited.json b/__tests__/payloads/events/issue_comment_edited.json deleted file mode 100644 index bce685bf..00000000 --- a/__tests__/payloads/events/issue_comment_edited.json +++ /dev/null @@ -1,209 +0,0 @@ -{ - "action": "edited", - "changes": { - "body": { - "from": "comment" - } - }, - "comment": { - "author_association": "OWNER", - "body": "commentet", - "created_at": "2020-03-05T01:48:18Z", - "html_url": "https://github.com/trilom-test/file-changes-action/pull/5#issuecomment-594984510", - "id": 594984510, - "issue_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/5", - "node_id": "MDEyOklzc3VlQ29tbWVudDU5NDk4NDUxMA==", - "updated_at": "2020-03-05T01:48:22Z", - "url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/comments/594984510", - "user": { - "avatar_url": "https://avatars3.githubusercontent.com/u/61441570?v=4", - "events_url": "https://api.github.com/users/trilom-test/events{/privacy}", - "followers_url": "https://api.github.com/users/trilom-test/followers", - "following_url": "https://api.github.com/users/trilom-test/following{/other_user}", - "gists_url": "https://api.github.com/users/trilom-test/gists{/gist_id}", - "gravatar_id": "", - "html_url": "https://github.com/trilom-test", - "id": 61441570, - "login": "trilom-test", - "node_id": "MDQ6VXNlcjYxNDQxNTcw", - "organizations_url": "https://api.github.com/users/trilom-test/orgs", - "received_events_url": "https://api.github.com/users/trilom-test/received_events", - "repos_url": "https://api.github.com/users/trilom-test/repos", - "site_admin": false, - "starred_url": "https://api.github.com/users/trilom-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/trilom-test/subscriptions", - "type": "User", - "url": "https://api.github.com/users/trilom-test" - } - }, - "issue": { - "assignee": null, - "assignees": [], - "author_association": "OWNER", - "body": "", - "closed_at": null, - "comments": 1, - "comments_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/5/comments", - "created_at": "2020-03-05T01:48:12Z", - "events_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/5/events", - "html_url": "https://github.com/trilom-test/file-changes-action/pull/5", - "id": 575936509, - "labels": [], - "labels_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/5/labels{/name}", - "locked": false, - "milestone": null, - "node_id": "MDExOlB1bGxSZXF1ZXN0Mzg0MDIyMTM5", - "number": 5, - "pull_request": { - "diff_url": "https://github.com/trilom-test/file-changes-action/pull/5.diff", - "html_url": "https://github.com/trilom-test/file-changes-action/pull/5", - "patch_url": "https://github.com/trilom-test/file-changes-action/pull/5.patch", - "url": "https://api.github.com/repos/trilom-test/file-changes-action/pulls/5" - }, - "repository_url": "https://api.github.com/repos/trilom-test/file-changes-action", - "state": "open", - "title": "test", - "updated_at": "2020-03-05T01:48:22Z", - "url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/5", - "user": { - "avatar_url": "https://avatars3.githubusercontent.com/u/61441570?v=4", - "events_url": "https://api.github.com/users/trilom-test/events{/privacy}", - "followers_url": "https://api.github.com/users/trilom-test/followers", - "following_url": "https://api.github.com/users/trilom-test/following{/other_user}", - "gists_url": "https://api.github.com/users/trilom-test/gists{/gist_id}", - "gravatar_id": "", - "html_url": "https://github.com/trilom-test", - "id": 61441570, - "login": "trilom-test", - "node_id": "MDQ6VXNlcjYxNDQxNTcw", - "organizations_url": "https://api.github.com/users/trilom-test/orgs", - "received_events_url": "https://api.github.com/users/trilom-test/received_events", - "repos_url": "https://api.github.com/users/trilom-test/repos", - "site_admin": false, - "starred_url": "https://api.github.com/users/trilom-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/trilom-test/subscriptions", - "type": "User", - "url": "https://api.github.com/users/trilom-test" - } - }, - "repository": { - "archive_url": "https://api.github.com/repos/trilom-test/file-changes-action/{archive_format}{/ref}", - "archived": false, - "assignees_url": "https://api.github.com/repos/trilom-test/file-changes-action/assignees{/user}", - "blobs_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/blobs{/sha}", - "branches_url": "https://api.github.com/repos/trilom-test/file-changes-action/branches{/branch}", - "clone_url": "https://github.com/trilom-test/file-changes-action.git", - "collaborators_url": "https://api.github.com/repos/trilom-test/file-changes-action/collaborators{/collaborator}", - "comments_url": "https://api.github.com/repos/trilom-test/file-changes-action/comments{/number}", - "commits_url": "https://api.github.com/repos/trilom-test/file-changes-action/commits{/sha}", - "compare_url": "https://api.github.com/repos/trilom-test/file-changes-action/compare/{base}...{head}", - "contents_url": "https://api.github.com/repos/trilom-test/file-changes-action/contents/{+path}", - "contributors_url": "https://api.github.com/repos/trilom-test/file-changes-action/contributors", - "created_at": "2020-02-25T04:29:40Z", - "default_branch": "releases/v1", - "deployments_url": "https://api.github.com/repos/trilom-test/file-changes-action/deployments", - "description": "This action can be added, and you will get outputs of all of the files that have changed in your repository for you to use.", - "disabled": false, - "downloads_url": "https://api.github.com/repos/trilom-test/file-changes-action/downloads", - "events_url": "https://api.github.com/repos/trilom-test/file-changes-action/events", - "fork": true, - "forks": 0, - "forks_count": 0, - "forks_url": "https://api.github.com/repos/trilom-test/file-changes-action/forks", - "full_name": "trilom-test/file-changes-action", - "git_commits_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/commits{/sha}", - "git_refs_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/refs{/sha}", - "git_tags_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/tags{/sha}", - "git_url": "git://github.com/trilom-test/file-changes-action.git", - "has_downloads": true, - "has_issues": false, - "has_pages": false, - "has_projects": true, - "has_wiki": true, - "homepage": null, - "hooks_url": "https://api.github.com/repos/trilom-test/file-changes-action/hooks", - "html_url": "https://github.com/trilom-test/file-changes-action", - "id": 242909684, - "issue_comment_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/comments{/number}", - "issue_events_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/events{/number}", - "issues_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues{/number}", - "keys_url": "https://api.github.com/repos/trilom-test/file-changes-action/keys{/key_id}", - "labels_url": "https://api.github.com/repos/trilom-test/file-changes-action/labels{/name}", - "language": "JavaScript", - "languages_url": "https://api.github.com/repos/trilom-test/file-changes-action/languages", - "license": { - "key": "mit", - "name": "MIT License", - "node_id": "MDc6TGljZW5zZTEz", - "spdx_id": "MIT", - "url": "https://api.github.com/licenses/mit" - }, - "merges_url": "https://api.github.com/repos/trilom-test/file-changes-action/merges", - "milestones_url": "https://api.github.com/repos/trilom-test/file-changes-action/milestones{/number}", - "mirror_url": null, - "name": "file-changes-action", - "node_id": "MDEwOlJlcG9zaXRvcnkyNDI5MDk2ODQ=", - "notifications_url": "https://api.github.com/repos/trilom-test/file-changes-action/notifications{?since,all,participating}", - "open_issues": 1, - "open_issues_count": 1, - "owner": { - "avatar_url": "https://avatars3.githubusercontent.com/u/61441570?v=4", - "events_url": "https://api.github.com/users/trilom-test/events{/privacy}", - "followers_url": "https://api.github.com/users/trilom-test/followers", - "following_url": "https://api.github.com/users/trilom-test/following{/other_user}", - "gists_url": "https://api.github.com/users/trilom-test/gists{/gist_id}", - "gravatar_id": "", - "html_url": "https://github.com/trilom-test", - "id": 61441570, - "login": "trilom-test", - "node_id": "MDQ6VXNlcjYxNDQxNTcw", - "organizations_url": "https://api.github.com/users/trilom-test/orgs", - "received_events_url": "https://api.github.com/users/trilom-test/received_events", - "repos_url": "https://api.github.com/users/trilom-test/repos", - "site_admin": false, - "starred_url": "https://api.github.com/users/trilom-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/trilom-test/subscriptions", - "type": "User", - "url": "https://api.github.com/users/trilom-test" - }, - "private": false, - "pulls_url": "https://api.github.com/repos/trilom-test/file-changes-action/pulls{/number}", - "pushed_at": "2020-03-05T01:48:13Z", - "releases_url": "https://api.github.com/repos/trilom-test/file-changes-action/releases{/id}", - "size": 29568, - "ssh_url": "git@github.com:trilom-test/file-changes-action.git", - "stargazers_count": 0, - "stargazers_url": "https://api.github.com/repos/trilom-test/file-changes-action/stargazers", - "statuses_url": "https://api.github.com/repos/trilom-test/file-changes-action/statuses/{sha}", - "subscribers_url": "https://api.github.com/repos/trilom-test/file-changes-action/subscribers", - "subscription_url": "https://api.github.com/repos/trilom-test/file-changes-action/subscription", - "svn_url": "https://github.com/trilom-test/file-changes-action", - "tags_url": "https://api.github.com/repos/trilom-test/file-changes-action/tags", - "teams_url": "https://api.github.com/repos/trilom-test/file-changes-action/teams", - "trees_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/trees{/sha}", - "updated_at": "2020-03-05T01:45:22Z", - "url": "https://api.github.com/repos/trilom-test/file-changes-action", - "watchers": 0, - "watchers_count": 0 - }, - "sender": { - "avatar_url": "https://avatars3.githubusercontent.com/u/61441570?v=4", - "events_url": "https://api.github.com/users/trilom-test/events{/privacy}", - "followers_url": "https://api.github.com/users/trilom-test/followers", - "following_url": "https://api.github.com/users/trilom-test/following{/other_user}", - "gists_url": "https://api.github.com/users/trilom-test/gists{/gist_id}", - "gravatar_id": "", - "html_url": "https://github.com/trilom-test", - "id": 61441570, - "login": "trilom-test", - "node_id": "MDQ6VXNlcjYxNDQxNTcw", - "organizations_url": "https://api.github.com/users/trilom-test/orgs", - "received_events_url": "https://api.github.com/users/trilom-test/received_events", - "repos_url": "https://api.github.com/users/trilom-test/repos", - "site_admin": false, - "starred_url": "https://api.github.com/users/trilom-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/trilom-test/subscriptions", - "type": "User", - "url": "https://api.github.com/users/trilom-test" - } -} \ No newline at end of file diff --git a/__tests__/payloads/events/pull_request_opened.json b/__tests__/payloads/events/pull_request_opened.json deleted file mode 100644 index 77311eb5..00000000 --- a/__tests__/payloads/events/pull_request_opened.json +++ /dev/null @@ -1,464 +0,0 @@ -{ - "action": "opened", - "number": 5, - "pull_request": { - "_links": { - "comments": { - "href": "https://api.github.com/repos/trilom-test/file-changes-action/issues/5/comments" - }, - "commits": { - "href": "https://api.github.com/repos/trilom-test/file-changes-action/pulls/5/commits" - }, - "html": { - "href": "https://github.com/trilom-test/file-changes-action/pull/5" - }, - "issue": { - "href": "https://api.github.com/repos/trilom-test/file-changes-action/issues/5" - }, - "review_comment": { - "href": "https://api.github.com/repos/trilom-test/file-changes-action/pulls/comments{/number}" - }, - "review_comments": { - "href": "https://api.github.com/repos/trilom-test/file-changes-action/pulls/5/comments" - }, - "self": { - "href": "https://api.github.com/repos/trilom-test/file-changes-action/pulls/5" - }, - "statuses": { - "href": "https://api.github.com/repos/trilom-test/file-changes-action/statuses/513ca39ff3756e5b510ad752edaba6a0aeb2efac" - } - }, - "additions": 6, - "assignee": null, - "assignees": [], - "author_association": "OWNER", - "base": { - "label": "trilom-test:develop", - "ref": "develop", - "repo": { - "archive_url": "https://api.github.com/repos/trilom-test/file-changes-action/{archive_format}{/ref}", - "archived": false, - "assignees_url": "https://api.github.com/repos/trilom-test/file-changes-action/assignees{/user}", - "blobs_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/blobs{/sha}", - "branches_url": "https://api.github.com/repos/trilom-test/file-changes-action/branches{/branch}", - "clone_url": "https://github.com/trilom-test/file-changes-action.git", - "collaborators_url": "https://api.github.com/repos/trilom-test/file-changes-action/collaborators{/collaborator}", - "comments_url": "https://api.github.com/repos/trilom-test/file-changes-action/comments{/number}", - "commits_url": "https://api.github.com/repos/trilom-test/file-changes-action/commits{/sha}", - "compare_url": "https://api.github.com/repos/trilom-test/file-changes-action/compare/{base}...{head}", - "contents_url": "https://api.github.com/repos/trilom-test/file-changes-action/contents/{+path}", - "contributors_url": "https://api.github.com/repos/trilom-test/file-changes-action/contributors", - "created_at": "2020-02-25T04:29:40Z", - "default_branch": "releases/v1", - "deployments_url": "https://api.github.com/repos/trilom-test/file-changes-action/deployments", - "description": "This action can be added, and you will get outputs of all of the files that have changed in your repository for you to use.", - "disabled": false, - "downloads_url": "https://api.github.com/repos/trilom-test/file-changes-action/downloads", - "events_url": "https://api.github.com/repos/trilom-test/file-changes-action/events", - "fork": true, - "forks": 0, - "forks_count": 0, - "forks_url": "https://api.github.com/repos/trilom-test/file-changes-action/forks", - "full_name": "trilom-test/file-changes-action", - "git_commits_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/commits{/sha}", - "git_refs_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/refs{/sha}", - "git_tags_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/tags{/sha}", - "git_url": "git://github.com/trilom-test/file-changes-action.git", - "has_downloads": true, - "has_issues": false, - "has_pages": false, - "has_projects": true, - "has_wiki": true, - "homepage": null, - "hooks_url": "https://api.github.com/repos/trilom-test/file-changes-action/hooks", - "html_url": "https://github.com/trilom-test/file-changes-action", - "id": 242909684, - "issue_comment_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/comments{/number}", - "issue_events_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/events{/number}", - "issues_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues{/number}", - "keys_url": "https://api.github.com/repos/trilom-test/file-changes-action/keys{/key_id}", - "labels_url": "https://api.github.com/repos/trilom-test/file-changes-action/labels{/name}", - "language": "JavaScript", - "languages_url": "https://api.github.com/repos/trilom-test/file-changes-action/languages", - "license": { - "key": "mit", - "name": "MIT License", - "node_id": "MDc6TGljZW5zZTEz", - "spdx_id": "MIT", - "url": "https://api.github.com/licenses/mit" - }, - "merges_url": "https://api.github.com/repos/trilom-test/file-changes-action/merges", - "milestones_url": "https://api.github.com/repos/trilom-test/file-changes-action/milestones{/number}", - "mirror_url": null, - "name": "file-changes-action", - "node_id": "MDEwOlJlcG9zaXRvcnkyNDI5MDk2ODQ=", - "notifications_url": "https://api.github.com/repos/trilom-test/file-changes-action/notifications{?since,all,participating}", - "open_issues": 1, - "open_issues_count": 1, - "owner": { - "avatar_url": "https://avatars3.githubusercontent.com/u/61441570?v=4", - "events_url": "https://api.github.com/users/trilom-test/events{/privacy}", - "followers_url": "https://api.github.com/users/trilom-test/followers", - "following_url": "https://api.github.com/users/trilom-test/following{/other_user}", - "gists_url": "https://api.github.com/users/trilom-test/gists{/gist_id}", - "gravatar_id": "", - "html_url": "https://github.com/trilom-test", - "id": 61441570, - "login": "trilom-test", - "node_id": "MDQ6VXNlcjYxNDQxNTcw", - "organizations_url": "https://api.github.com/users/trilom-test/orgs", - "received_events_url": "https://api.github.com/users/trilom-test/received_events", - "repos_url": "https://api.github.com/users/trilom-test/repos", - "site_admin": false, - "starred_url": "https://api.github.com/users/trilom-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/trilom-test/subscriptions", - "type": "User", - "url": "https://api.github.com/users/trilom-test" - }, - "private": false, - "pulls_url": "https://api.github.com/repos/trilom-test/file-changes-action/pulls{/number}", - "pushed_at": "2020-03-05T01:45:20Z", - "releases_url": "https://api.github.com/repos/trilom-test/file-changes-action/releases{/id}", - "size": 29568, - "ssh_url": "git@github.com:trilom-test/file-changes-action.git", - "stargazers_count": 0, - "stargazers_url": "https://api.github.com/repos/trilom-test/file-changes-action/stargazers", - "statuses_url": "https://api.github.com/repos/trilom-test/file-changes-action/statuses/{sha}", - "subscribers_url": "https://api.github.com/repos/trilom-test/file-changes-action/subscribers", - "subscription_url": "https://api.github.com/repos/trilom-test/file-changes-action/subscription", - "svn_url": "https://github.com/trilom-test/file-changes-action", - "tags_url": "https://api.github.com/repos/trilom-test/file-changes-action/tags", - "teams_url": "https://api.github.com/repos/trilom-test/file-changes-action/teams", - "trees_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/trees{/sha}", - "updated_at": "2020-03-05T01:45:22Z", - "url": "https://api.github.com/repos/trilom-test/file-changes-action", - "watchers": 0, - "watchers_count": 0 - }, - "sha": "6fa4d89edfa019c534c43bf283c361b770d584fc", - "user": { - "avatar_url": "https://avatars3.githubusercontent.com/u/61441570?v=4", - "events_url": "https://api.github.com/users/trilom-test/events{/privacy}", - "followers_url": "https://api.github.com/users/trilom-test/followers", - "following_url": "https://api.github.com/users/trilom-test/following{/other_user}", - "gists_url": "https://api.github.com/users/trilom-test/gists{/gist_id}", - "gravatar_id": "", - "html_url": "https://github.com/trilom-test", - "id": 61441570, - "login": "trilom-test", - "node_id": "MDQ6VXNlcjYxNDQxNTcw", - "organizations_url": "https://api.github.com/users/trilom-test/orgs", - "received_events_url": "https://api.github.com/users/trilom-test/received_events", - "repos_url": "https://api.github.com/users/trilom-test/repos", - "site_admin": false, - "starred_url": "https://api.github.com/users/trilom-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/trilom-test/subscriptions", - "type": "User", - "url": "https://api.github.com/users/trilom-test" - } - }, - "body": "", - "changed_files": 1, - "closed_at": null, - "comments": 0, - "comments_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/5/comments", - "commits": 3, - "commits_url": "https://api.github.com/repos/trilom-test/file-changes-action/pulls/5/commits", - "created_at": "2020-03-05T01:48:12Z", - "deletions": 0, - "diff_url": "https://github.com/trilom-test/file-changes-action/pull/5.diff", - "draft": false, - "head": { - "label": "trilom-test:releases/v1", - "ref": "releases/v1", - "repo": { - "archive_url": "https://api.github.com/repos/trilom-test/file-changes-action/{archive_format}{/ref}", - "archived": false, - "assignees_url": "https://api.github.com/repos/trilom-test/file-changes-action/assignees{/user}", - "blobs_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/blobs{/sha}", - "branches_url": "https://api.github.com/repos/trilom-test/file-changes-action/branches{/branch}", - "clone_url": "https://github.com/trilom-test/file-changes-action.git", - "collaborators_url": "https://api.github.com/repos/trilom-test/file-changes-action/collaborators{/collaborator}", - "comments_url": "https://api.github.com/repos/trilom-test/file-changes-action/comments{/number}", - "commits_url": "https://api.github.com/repos/trilom-test/file-changes-action/commits{/sha}", - "compare_url": "https://api.github.com/repos/trilom-test/file-changes-action/compare/{base}...{head}", - "contents_url": "https://api.github.com/repos/trilom-test/file-changes-action/contents/{+path}", - "contributors_url": "https://api.github.com/repos/trilom-test/file-changes-action/contributors", - "created_at": "2020-02-25T04:29:40Z", - "default_branch": "releases/v1", - "deployments_url": "https://api.github.com/repos/trilom-test/file-changes-action/deployments", - "description": "This action can be added, and you will get outputs of all of the files that have changed in your repository for you to use.", - "disabled": false, - "downloads_url": "https://api.github.com/repos/trilom-test/file-changes-action/downloads", - "events_url": "https://api.github.com/repos/trilom-test/file-changes-action/events", - "fork": true, - "forks": 0, - "forks_count": 0, - "forks_url": "https://api.github.com/repos/trilom-test/file-changes-action/forks", - "full_name": "trilom-test/file-changes-action", - "git_commits_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/commits{/sha}", - "git_refs_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/refs{/sha}", - "git_tags_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/tags{/sha}", - "git_url": "git://github.com/trilom-test/file-changes-action.git", - "has_downloads": true, - "has_issues": false, - "has_pages": false, - "has_projects": true, - "has_wiki": true, - "homepage": null, - "hooks_url": "https://api.github.com/repos/trilom-test/file-changes-action/hooks", - "html_url": "https://github.com/trilom-test/file-changes-action", - "id": 242909684, - "issue_comment_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/comments{/number}", - "issue_events_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/events{/number}", - "issues_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues{/number}", - "keys_url": "https://api.github.com/repos/trilom-test/file-changes-action/keys{/key_id}", - "labels_url": "https://api.github.com/repos/trilom-test/file-changes-action/labels{/name}", - "language": "JavaScript", - "languages_url": "https://api.github.com/repos/trilom-test/file-changes-action/languages", - "license": { - "key": "mit", - "name": "MIT License", - "node_id": "MDc6TGljZW5zZTEz", - "spdx_id": "MIT", - "url": "https://api.github.com/licenses/mit" - }, - "merges_url": "https://api.github.com/repos/trilom-test/file-changes-action/merges", - "milestones_url": "https://api.github.com/repos/trilom-test/file-changes-action/milestones{/number}", - "mirror_url": null, - "name": "file-changes-action", - "node_id": "MDEwOlJlcG9zaXRvcnkyNDI5MDk2ODQ=", - "notifications_url": "https://api.github.com/repos/trilom-test/file-changes-action/notifications{?since,all,participating}", - "open_issues": 1, - "open_issues_count": 1, - "owner": { - "avatar_url": "https://avatars3.githubusercontent.com/u/61441570?v=4", - "events_url": "https://api.github.com/users/trilom-test/events{/privacy}", - "followers_url": "https://api.github.com/users/trilom-test/followers", - "following_url": "https://api.github.com/users/trilom-test/following{/other_user}", - "gists_url": "https://api.github.com/users/trilom-test/gists{/gist_id}", - "gravatar_id": "", - "html_url": "https://github.com/trilom-test", - "id": 61441570, - "login": "trilom-test", - "node_id": "MDQ6VXNlcjYxNDQxNTcw", - "organizations_url": "https://api.github.com/users/trilom-test/orgs", - "received_events_url": "https://api.github.com/users/trilom-test/received_events", - "repos_url": "https://api.github.com/users/trilom-test/repos", - "site_admin": false, - "starred_url": "https://api.github.com/users/trilom-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/trilom-test/subscriptions", - "type": "User", - "url": "https://api.github.com/users/trilom-test" - }, - "private": false, - "pulls_url": "https://api.github.com/repos/trilom-test/file-changes-action/pulls{/number}", - "pushed_at": "2020-03-05T01:45:20Z", - "releases_url": "https://api.github.com/repos/trilom-test/file-changes-action/releases{/id}", - "size": 29568, - "ssh_url": "git@github.com:trilom-test/file-changes-action.git", - "stargazers_count": 0, - "stargazers_url": "https://api.github.com/repos/trilom-test/file-changes-action/stargazers", - "statuses_url": "https://api.github.com/repos/trilom-test/file-changes-action/statuses/{sha}", - "subscribers_url": "https://api.github.com/repos/trilom-test/file-changes-action/subscribers", - "subscription_url": "https://api.github.com/repos/trilom-test/file-changes-action/subscription", - "svn_url": "https://github.com/trilom-test/file-changes-action", - "tags_url": "https://api.github.com/repos/trilom-test/file-changes-action/tags", - "teams_url": "https://api.github.com/repos/trilom-test/file-changes-action/teams", - "trees_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/trees{/sha}", - "updated_at": "2020-03-05T01:45:22Z", - "url": "https://api.github.com/repos/trilom-test/file-changes-action", - "watchers": 0, - "watchers_count": 0 - }, - "sha": "513ca39ff3756e5b510ad752edaba6a0aeb2efac", - "user": { - "avatar_url": "https://avatars3.githubusercontent.com/u/61441570?v=4", - "events_url": "https://api.github.com/users/trilom-test/events{/privacy}", - "followers_url": "https://api.github.com/users/trilom-test/followers", - "following_url": "https://api.github.com/users/trilom-test/following{/other_user}", - "gists_url": "https://api.github.com/users/trilom-test/gists{/gist_id}", - "gravatar_id": "", - "html_url": "https://github.com/trilom-test", - "id": 61441570, - "login": "trilom-test", - "node_id": "MDQ6VXNlcjYxNDQxNTcw", - "organizations_url": "https://api.github.com/users/trilom-test/orgs", - "received_events_url": "https://api.github.com/users/trilom-test/received_events", - "repos_url": "https://api.github.com/users/trilom-test/repos", - "site_admin": false, - "starred_url": "https://api.github.com/users/trilom-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/trilom-test/subscriptions", - "type": "User", - "url": "https://api.github.com/users/trilom-test" - } - }, - "html_url": "https://github.com/trilom-test/file-changes-action/pull/5", - "id": 384022139, - "issue_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/5", - "labels": [], - "locked": false, - "maintainer_can_modify": false, - "merge_commit_sha": null, - "mergeable": null, - "mergeable_state": "unknown", - "merged": false, - "merged_at": null, - "merged_by": null, - "milestone": null, - "node_id": "MDExOlB1bGxSZXF1ZXN0Mzg0MDIyMTM5", - "number": 5, - "patch_url": "https://github.com/trilom-test/file-changes-action/pull/5.patch", - "rebaseable": null, - "requested_reviewers": [], - "requested_teams": [], - "review_comment_url": "https://api.github.com/repos/trilom-test/file-changes-action/pulls/comments{/number}", - "review_comments": 0, - "review_comments_url": "https://api.github.com/repos/trilom-test/file-changes-action/pulls/5/comments", - "state": "open", - "statuses_url": "https://api.github.com/repos/trilom-test/file-changes-action/statuses/513ca39ff3756e5b510ad752edaba6a0aeb2efac", - "title": "test", - "updated_at": "2020-03-05T01:48:12Z", - "url": "https://api.github.com/repos/trilom-test/file-changes-action/pulls/5", - "user": { - "avatar_url": "https://avatars3.githubusercontent.com/u/61441570?v=4", - "events_url": "https://api.github.com/users/trilom-test/events{/privacy}", - "followers_url": "https://api.github.com/users/trilom-test/followers", - "following_url": "https://api.github.com/users/trilom-test/following{/other_user}", - "gists_url": "https://api.github.com/users/trilom-test/gists{/gist_id}", - "gravatar_id": "", - "html_url": "https://github.com/trilom-test", - "id": 61441570, - "login": "trilom-test", - "node_id": "MDQ6VXNlcjYxNDQxNTcw", - "organizations_url": "https://api.github.com/users/trilom-test/orgs", - "received_events_url": "https://api.github.com/users/trilom-test/received_events", - "repos_url": "https://api.github.com/users/trilom-test/repos", - "site_admin": false, - "starred_url": "https://api.github.com/users/trilom-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/trilom-test/subscriptions", - "type": "User", - "url": "https://api.github.com/users/trilom-test" - } - }, - "repository": { - "archive_url": "https://api.github.com/repos/trilom-test/file-changes-action/{archive_format}{/ref}", - "archived": false, - "assignees_url": "https://api.github.com/repos/trilom-test/file-changes-action/assignees{/user}", - "blobs_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/blobs{/sha}", - "branches_url": "https://api.github.com/repos/trilom-test/file-changes-action/branches{/branch}", - "clone_url": "https://github.com/trilom-test/file-changes-action.git", - "collaborators_url": "https://api.github.com/repos/trilom-test/file-changes-action/collaborators{/collaborator}", - "comments_url": "https://api.github.com/repos/trilom-test/file-changes-action/comments{/number}", - "commits_url": "https://api.github.com/repos/trilom-test/file-changes-action/commits{/sha}", - "compare_url": "https://api.github.com/repos/trilom-test/file-changes-action/compare/{base}...{head}", - "contents_url": "https://api.github.com/repos/trilom-test/file-changes-action/contents/{+path}", - "contributors_url": "https://api.github.com/repos/trilom-test/file-changes-action/contributors", - "created_at": "2020-02-25T04:29:40Z", - "default_branch": "releases/v1", - "deployments_url": "https://api.github.com/repos/trilom-test/file-changes-action/deployments", - "description": "This action can be added, and you will get outputs of all of the files that have changed in your repository for you to use.", - "disabled": false, - "downloads_url": "https://api.github.com/repos/trilom-test/file-changes-action/downloads", - "events_url": "https://api.github.com/repos/trilom-test/file-changes-action/events", - "fork": true, - "forks": 0, - "forks_count": 0, - "forks_url": "https://api.github.com/repos/trilom-test/file-changes-action/forks", - "full_name": "trilom-test/file-changes-action", - "git_commits_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/commits{/sha}", - "git_refs_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/refs{/sha}", - "git_tags_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/tags{/sha}", - "git_url": "git://github.com/trilom-test/file-changes-action.git", - "has_downloads": true, - "has_issues": false, - "has_pages": false, - "has_projects": true, - "has_wiki": true, - "homepage": null, - "hooks_url": "https://api.github.com/repos/trilom-test/file-changes-action/hooks", - "html_url": "https://github.com/trilom-test/file-changes-action", - "id": 242909684, - "issue_comment_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/comments{/number}", - "issue_events_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/events{/number}", - "issues_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues{/number}", - "keys_url": "https://api.github.com/repos/trilom-test/file-changes-action/keys{/key_id}", - "labels_url": "https://api.github.com/repos/trilom-test/file-changes-action/labels{/name}", - "language": "JavaScript", - "languages_url": "https://api.github.com/repos/trilom-test/file-changes-action/languages", - "license": { - "key": "mit", - "name": "MIT License", - "node_id": "MDc6TGljZW5zZTEz", - "spdx_id": "MIT", - "url": "https://api.github.com/licenses/mit" - }, - "merges_url": "https://api.github.com/repos/trilom-test/file-changes-action/merges", - "milestones_url": "https://api.github.com/repos/trilom-test/file-changes-action/milestones{/number}", - "mirror_url": null, - "name": "file-changes-action", - "node_id": "MDEwOlJlcG9zaXRvcnkyNDI5MDk2ODQ=", - "notifications_url": "https://api.github.com/repos/trilom-test/file-changes-action/notifications{?since,all,participating}", - "open_issues": 1, - "open_issues_count": 1, - "owner": { - "avatar_url": "https://avatars3.githubusercontent.com/u/61441570?v=4", - "events_url": "https://api.github.com/users/trilom-test/events{/privacy}", - "followers_url": "https://api.github.com/users/trilom-test/followers", - "following_url": "https://api.github.com/users/trilom-test/following{/other_user}", - "gists_url": "https://api.github.com/users/trilom-test/gists{/gist_id}", - "gravatar_id": "", - "html_url": "https://github.com/trilom-test", - "id": 61441570, - "login": "trilom-test", - "node_id": "MDQ6VXNlcjYxNDQxNTcw", - "organizations_url": "https://api.github.com/users/trilom-test/orgs", - "received_events_url": "https://api.github.com/users/trilom-test/received_events", - "repos_url": "https://api.github.com/users/trilom-test/repos", - "site_admin": false, - "starred_url": "https://api.github.com/users/trilom-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/trilom-test/subscriptions", - "type": "User", - "url": "https://api.github.com/users/trilom-test" - }, - "private": false, - "pulls_url": "https://api.github.com/repos/trilom-test/file-changes-action/pulls{/number}", - "pushed_at": "2020-03-05T01:45:20Z", - "releases_url": "https://api.github.com/repos/trilom-test/file-changes-action/releases{/id}", - "size": 29568, - "ssh_url": "git@github.com:trilom-test/file-changes-action.git", - "stargazers_count": 0, - "stargazers_url": "https://api.github.com/repos/trilom-test/file-changes-action/stargazers", - "statuses_url": "https://api.github.com/repos/trilom-test/file-changes-action/statuses/{sha}", - "subscribers_url": "https://api.github.com/repos/trilom-test/file-changes-action/subscribers", - "subscription_url": "https://api.github.com/repos/trilom-test/file-changes-action/subscription", - "svn_url": "https://github.com/trilom-test/file-changes-action", - "tags_url": "https://api.github.com/repos/trilom-test/file-changes-action/tags", - "teams_url": "https://api.github.com/repos/trilom-test/file-changes-action/teams", - "trees_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/trees{/sha}", - "updated_at": "2020-03-05T01:45:22Z", - "url": "https://api.github.com/repos/trilom-test/file-changes-action", - "watchers": 0, - "watchers_count": 0 - }, - "sender": { - "avatar_url": "https://avatars3.githubusercontent.com/u/61441570?v=4", - "events_url": "https://api.github.com/users/trilom-test/events{/privacy}", - "followers_url": "https://api.github.com/users/trilom-test/followers", - "following_url": "https://api.github.com/users/trilom-test/following{/other_user}", - "gists_url": "https://api.github.com/users/trilom-test/gists{/gist_id}", - "gravatar_id": "", - "html_url": "https://github.com/trilom-test", - "id": 61441570, - "login": "trilom-test", - "node_id": "MDQ6VXNlcjYxNDQxNTcw", - "organizations_url": "https://api.github.com/users/trilom-test/orgs", - "received_events_url": "https://api.github.com/users/trilom-test/received_events", - "repos_url": "https://api.github.com/users/trilom-test/repos", - "site_admin": false, - "starred_url": "https://api.github.com/users/trilom-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/trilom-test/subscriptions", - "type": "User", - "url": "https://api.github.com/users/trilom-test" - } -} \ No newline at end of file diff --git a/__tests__/payloads/events/pull_request_reopened.json b/__tests__/payloads/events/pull_request_reopened.json deleted file mode 100644 index d1e314c1..00000000 --- a/__tests__/payloads/events/pull_request_reopened.json +++ /dev/null @@ -1,464 +0,0 @@ -{ - "action": "reopened", - "number": 5, - "pull_request": { - "_links": { - "comments": { - "href": "https://api.github.com/repos/trilom-test/file-changes-action/issues/5/comments" - }, - "commits": { - "href": "https://api.github.com/repos/trilom-test/file-changes-action/pulls/5/commits" - }, - "html": { - "href": "https://github.com/trilom-test/file-changes-action/pull/5" - }, - "issue": { - "href": "https://api.github.com/repos/trilom-test/file-changes-action/issues/5" - }, - "review_comment": { - "href": "https://api.github.com/repos/trilom-test/file-changes-action/pulls/comments{/number}" - }, - "review_comments": { - "href": "https://api.github.com/repos/trilom-test/file-changes-action/pulls/5/comments" - }, - "self": { - "href": "https://api.github.com/repos/trilom-test/file-changes-action/pulls/5" - }, - "statuses": { - "href": "https://api.github.com/repos/trilom-test/file-changes-action/statuses/513ca39ff3756e5b510ad752edaba6a0aeb2efac" - } - }, - "additions": 6, - "assignee": null, - "assignees": [], - "author_association": "OWNER", - "base": { - "label": "trilom-test:develop", - "ref": "develop", - "repo": { - "archive_url": "https://api.github.com/repos/trilom-test/file-changes-action/{archive_format}{/ref}", - "archived": false, - "assignees_url": "https://api.github.com/repos/trilom-test/file-changes-action/assignees{/user}", - "blobs_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/blobs{/sha}", - "branches_url": "https://api.github.com/repos/trilom-test/file-changes-action/branches{/branch}", - "clone_url": "https://github.com/trilom-test/file-changes-action.git", - "collaborators_url": "https://api.github.com/repos/trilom-test/file-changes-action/collaborators{/collaborator}", - "comments_url": "https://api.github.com/repos/trilom-test/file-changes-action/comments{/number}", - "commits_url": "https://api.github.com/repos/trilom-test/file-changes-action/commits{/sha}", - "compare_url": "https://api.github.com/repos/trilom-test/file-changes-action/compare/{base}...{head}", - "contents_url": "https://api.github.com/repos/trilom-test/file-changes-action/contents/{+path}", - "contributors_url": "https://api.github.com/repos/trilom-test/file-changes-action/contributors", - "created_at": "2020-02-25T04:29:40Z", - "default_branch": "releases/v1", - "deployments_url": "https://api.github.com/repos/trilom-test/file-changes-action/deployments", - "description": "This action can be added, and you will get outputs of all of the files that have changed in your repository for you to use.", - "disabled": false, - "downloads_url": "https://api.github.com/repos/trilom-test/file-changes-action/downloads", - "events_url": "https://api.github.com/repos/trilom-test/file-changes-action/events", - "fork": true, - "forks": 0, - "forks_count": 0, - "forks_url": "https://api.github.com/repos/trilom-test/file-changes-action/forks", - "full_name": "trilom-test/file-changes-action", - "git_commits_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/commits{/sha}", - "git_refs_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/refs{/sha}", - "git_tags_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/tags{/sha}", - "git_url": "git://github.com/trilom-test/file-changes-action.git", - "has_downloads": true, - "has_issues": false, - "has_pages": false, - "has_projects": true, - "has_wiki": true, - "homepage": null, - "hooks_url": "https://api.github.com/repos/trilom-test/file-changes-action/hooks", - "html_url": "https://github.com/trilom-test/file-changes-action", - "id": 242909684, - "issue_comment_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/comments{/number}", - "issue_events_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/events{/number}", - "issues_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues{/number}", - "keys_url": "https://api.github.com/repos/trilom-test/file-changes-action/keys{/key_id}", - "labels_url": "https://api.github.com/repos/trilom-test/file-changes-action/labels{/name}", - "language": "JavaScript", - "languages_url": "https://api.github.com/repos/trilom-test/file-changes-action/languages", - "license": { - "key": "mit", - "name": "MIT License", - "node_id": "MDc6TGljZW5zZTEz", - "spdx_id": "MIT", - "url": "https://api.github.com/licenses/mit" - }, - "merges_url": "https://api.github.com/repos/trilom-test/file-changes-action/merges", - "milestones_url": "https://api.github.com/repos/trilom-test/file-changes-action/milestones{/number}", - "mirror_url": null, - "name": "file-changes-action", - "node_id": "MDEwOlJlcG9zaXRvcnkyNDI5MDk2ODQ=", - "notifications_url": "https://api.github.com/repos/trilom-test/file-changes-action/notifications{?since,all,participating}", - "open_issues": 1, - "open_issues_count": 1, - "owner": { - "avatar_url": "https://avatars3.githubusercontent.com/u/61441570?v=4", - "events_url": "https://api.github.com/users/trilom-test/events{/privacy}", - "followers_url": "https://api.github.com/users/trilom-test/followers", - "following_url": "https://api.github.com/users/trilom-test/following{/other_user}", - "gists_url": "https://api.github.com/users/trilom-test/gists{/gist_id}", - "gravatar_id": "", - "html_url": "https://github.com/trilom-test", - "id": 61441570, - "login": "trilom-test", - "node_id": "MDQ6VXNlcjYxNDQxNTcw", - "organizations_url": "https://api.github.com/users/trilom-test/orgs", - "received_events_url": "https://api.github.com/users/trilom-test/received_events", - "repos_url": "https://api.github.com/users/trilom-test/repos", - "site_admin": false, - "starred_url": "https://api.github.com/users/trilom-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/trilom-test/subscriptions", - "type": "User", - "url": "https://api.github.com/users/trilom-test" - }, - "private": false, - "pulls_url": "https://api.github.com/repos/trilom-test/file-changes-action/pulls{/number}", - "pushed_at": "2020-03-05T01:48:13Z", - "releases_url": "https://api.github.com/repos/trilom-test/file-changes-action/releases{/id}", - "size": 29568, - "ssh_url": "git@github.com:trilom-test/file-changes-action.git", - "stargazers_count": 0, - "stargazers_url": "https://api.github.com/repos/trilom-test/file-changes-action/stargazers", - "statuses_url": "https://api.github.com/repos/trilom-test/file-changes-action/statuses/{sha}", - "subscribers_url": "https://api.github.com/repos/trilom-test/file-changes-action/subscribers", - "subscription_url": "https://api.github.com/repos/trilom-test/file-changes-action/subscription", - "svn_url": "https://github.com/trilom-test/file-changes-action", - "tags_url": "https://api.github.com/repos/trilom-test/file-changes-action/tags", - "teams_url": "https://api.github.com/repos/trilom-test/file-changes-action/teams", - "trees_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/trees{/sha}", - "updated_at": "2020-03-05T01:45:22Z", - "url": "https://api.github.com/repos/trilom-test/file-changes-action", - "watchers": 0, - "watchers_count": 0 - }, - "sha": "6fa4d89edfa019c534c43bf283c361b770d584fc", - "user": { - "avatar_url": "https://avatars3.githubusercontent.com/u/61441570?v=4", - "events_url": "https://api.github.com/users/trilom-test/events{/privacy}", - "followers_url": "https://api.github.com/users/trilom-test/followers", - "following_url": "https://api.github.com/users/trilom-test/following{/other_user}", - "gists_url": "https://api.github.com/users/trilom-test/gists{/gist_id}", - "gravatar_id": "", - "html_url": "https://github.com/trilom-test", - "id": 61441570, - "login": "trilom-test", - "node_id": "MDQ6VXNlcjYxNDQxNTcw", - "organizations_url": "https://api.github.com/users/trilom-test/orgs", - "received_events_url": "https://api.github.com/users/trilom-test/received_events", - "repos_url": "https://api.github.com/users/trilom-test/repos", - "site_admin": false, - "starred_url": "https://api.github.com/users/trilom-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/trilom-test/subscriptions", - "type": "User", - "url": "https://api.github.com/users/trilom-test" - } - }, - "body": "", - "changed_files": 1, - "closed_at": null, - "comments": 1, - "comments_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/5/comments", - "commits": 3, - "commits_url": "https://api.github.com/repos/trilom-test/file-changes-action/pulls/5/commits", - "created_at": "2020-03-05T01:48:12Z", - "deletions": 0, - "diff_url": "https://github.com/trilom-test/file-changes-action/pull/5.diff", - "draft": false, - "head": { - "label": "trilom-test:releases/v1", - "ref": "releases/v1", - "repo": { - "archive_url": "https://api.github.com/repos/trilom-test/file-changes-action/{archive_format}{/ref}", - "archived": false, - "assignees_url": "https://api.github.com/repos/trilom-test/file-changes-action/assignees{/user}", - "blobs_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/blobs{/sha}", - "branches_url": "https://api.github.com/repos/trilom-test/file-changes-action/branches{/branch}", - "clone_url": "https://github.com/trilom-test/file-changes-action.git", - "collaborators_url": "https://api.github.com/repos/trilom-test/file-changes-action/collaborators{/collaborator}", - "comments_url": "https://api.github.com/repos/trilom-test/file-changes-action/comments{/number}", - "commits_url": "https://api.github.com/repos/trilom-test/file-changes-action/commits{/sha}", - "compare_url": "https://api.github.com/repos/trilom-test/file-changes-action/compare/{base}...{head}", - "contents_url": "https://api.github.com/repos/trilom-test/file-changes-action/contents/{+path}", - "contributors_url": "https://api.github.com/repos/trilom-test/file-changes-action/contributors", - "created_at": "2020-02-25T04:29:40Z", - "default_branch": "releases/v1", - "deployments_url": "https://api.github.com/repos/trilom-test/file-changes-action/deployments", - "description": "This action can be added, and you will get outputs of all of the files that have changed in your repository for you to use.", - "disabled": false, - "downloads_url": "https://api.github.com/repos/trilom-test/file-changes-action/downloads", - "events_url": "https://api.github.com/repos/trilom-test/file-changes-action/events", - "fork": true, - "forks": 0, - "forks_count": 0, - "forks_url": "https://api.github.com/repos/trilom-test/file-changes-action/forks", - "full_name": "trilom-test/file-changes-action", - "git_commits_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/commits{/sha}", - "git_refs_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/refs{/sha}", - "git_tags_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/tags{/sha}", - "git_url": "git://github.com/trilom-test/file-changes-action.git", - "has_downloads": true, - "has_issues": false, - "has_pages": false, - "has_projects": true, - "has_wiki": true, - "homepage": null, - "hooks_url": "https://api.github.com/repos/trilom-test/file-changes-action/hooks", - "html_url": "https://github.com/trilom-test/file-changes-action", - "id": 242909684, - "issue_comment_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/comments{/number}", - "issue_events_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/events{/number}", - "issues_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues{/number}", - "keys_url": "https://api.github.com/repos/trilom-test/file-changes-action/keys{/key_id}", - "labels_url": "https://api.github.com/repos/trilom-test/file-changes-action/labels{/name}", - "language": "JavaScript", - "languages_url": "https://api.github.com/repos/trilom-test/file-changes-action/languages", - "license": { - "key": "mit", - "name": "MIT License", - "node_id": "MDc6TGljZW5zZTEz", - "spdx_id": "MIT", - "url": "https://api.github.com/licenses/mit" - }, - "merges_url": "https://api.github.com/repos/trilom-test/file-changes-action/merges", - "milestones_url": "https://api.github.com/repos/trilom-test/file-changes-action/milestones{/number}", - "mirror_url": null, - "name": "file-changes-action", - "node_id": "MDEwOlJlcG9zaXRvcnkyNDI5MDk2ODQ=", - "notifications_url": "https://api.github.com/repos/trilom-test/file-changes-action/notifications{?since,all,participating}", - "open_issues": 1, - "open_issues_count": 1, - "owner": { - "avatar_url": "https://avatars3.githubusercontent.com/u/61441570?v=4", - "events_url": "https://api.github.com/users/trilom-test/events{/privacy}", - "followers_url": "https://api.github.com/users/trilom-test/followers", - "following_url": "https://api.github.com/users/trilom-test/following{/other_user}", - "gists_url": "https://api.github.com/users/trilom-test/gists{/gist_id}", - "gravatar_id": "", - "html_url": "https://github.com/trilom-test", - "id": 61441570, - "login": "trilom-test", - "node_id": "MDQ6VXNlcjYxNDQxNTcw", - "organizations_url": "https://api.github.com/users/trilom-test/orgs", - "received_events_url": "https://api.github.com/users/trilom-test/received_events", - "repos_url": "https://api.github.com/users/trilom-test/repos", - "site_admin": false, - "starred_url": "https://api.github.com/users/trilom-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/trilom-test/subscriptions", - "type": "User", - "url": "https://api.github.com/users/trilom-test" - }, - "private": false, - "pulls_url": "https://api.github.com/repos/trilom-test/file-changes-action/pulls{/number}", - "pushed_at": "2020-03-05T01:48:13Z", - "releases_url": "https://api.github.com/repos/trilom-test/file-changes-action/releases{/id}", - "size": 29568, - "ssh_url": "git@github.com:trilom-test/file-changes-action.git", - "stargazers_count": 0, - "stargazers_url": "https://api.github.com/repos/trilom-test/file-changes-action/stargazers", - "statuses_url": "https://api.github.com/repos/trilom-test/file-changes-action/statuses/{sha}", - "subscribers_url": "https://api.github.com/repos/trilom-test/file-changes-action/subscribers", - "subscription_url": "https://api.github.com/repos/trilom-test/file-changes-action/subscription", - "svn_url": "https://github.com/trilom-test/file-changes-action", - "tags_url": "https://api.github.com/repos/trilom-test/file-changes-action/tags", - "teams_url": "https://api.github.com/repos/trilom-test/file-changes-action/teams", - "trees_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/trees{/sha}", - "updated_at": "2020-03-05T01:45:22Z", - "url": "https://api.github.com/repos/trilom-test/file-changes-action", - "watchers": 0, - "watchers_count": 0 - }, - "sha": "513ca39ff3756e5b510ad752edaba6a0aeb2efac", - "user": { - "avatar_url": "https://avatars3.githubusercontent.com/u/61441570?v=4", - "events_url": "https://api.github.com/users/trilom-test/events{/privacy}", - "followers_url": "https://api.github.com/users/trilom-test/followers", - "following_url": "https://api.github.com/users/trilom-test/following{/other_user}", - "gists_url": "https://api.github.com/users/trilom-test/gists{/gist_id}", - "gravatar_id": "", - "html_url": "https://github.com/trilom-test", - "id": 61441570, - "login": "trilom-test", - "node_id": "MDQ6VXNlcjYxNDQxNTcw", - "organizations_url": "https://api.github.com/users/trilom-test/orgs", - "received_events_url": "https://api.github.com/users/trilom-test/received_events", - "repos_url": "https://api.github.com/users/trilom-test/repos", - "site_admin": false, - "starred_url": "https://api.github.com/users/trilom-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/trilom-test/subscriptions", - "type": "User", - "url": "https://api.github.com/users/trilom-test" - } - }, - "html_url": "https://github.com/trilom-test/file-changes-action/pull/5", - "id": 384022139, - "issue_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/5", - "labels": [], - "locked": false, - "maintainer_can_modify": false, - "merge_commit_sha": "5eb7f07e7e5577545e46e59a8805ece7ae6f6ca6", - "mergeable": null, - "mergeable_state": "unknown", - "merged": false, - "merged_at": null, - "merged_by": null, - "milestone": null, - "node_id": "MDExOlB1bGxSZXF1ZXN0Mzg0MDIyMTM5", - "number": 5, - "patch_url": "https://github.com/trilom-test/file-changes-action/pull/5.patch", - "rebaseable": null, - "requested_reviewers": [], - "requested_teams": [], - "review_comment_url": "https://api.github.com/repos/trilom-test/file-changes-action/pulls/comments{/number}", - "review_comments": 0, - "review_comments_url": "https://api.github.com/repos/trilom-test/file-changes-action/pulls/5/comments", - "state": "open", - "statuses_url": "https://api.github.com/repos/trilom-test/file-changes-action/statuses/513ca39ff3756e5b510ad752edaba6a0aeb2efac", - "title": "test", - "updated_at": "2020-03-05T01:48:28Z", - "url": "https://api.github.com/repos/trilom-test/file-changes-action/pulls/5", - "user": { - "avatar_url": "https://avatars3.githubusercontent.com/u/61441570?v=4", - "events_url": "https://api.github.com/users/trilom-test/events{/privacy}", - "followers_url": "https://api.github.com/users/trilom-test/followers", - "following_url": "https://api.github.com/users/trilom-test/following{/other_user}", - "gists_url": "https://api.github.com/users/trilom-test/gists{/gist_id}", - "gravatar_id": "", - "html_url": "https://github.com/trilom-test", - "id": 61441570, - "login": "trilom-test", - "node_id": "MDQ6VXNlcjYxNDQxNTcw", - "organizations_url": "https://api.github.com/users/trilom-test/orgs", - "received_events_url": "https://api.github.com/users/trilom-test/received_events", - "repos_url": "https://api.github.com/users/trilom-test/repos", - "site_admin": false, - "starred_url": "https://api.github.com/users/trilom-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/trilom-test/subscriptions", - "type": "User", - "url": "https://api.github.com/users/trilom-test" - } - }, - "repository": { - "archive_url": "https://api.github.com/repos/trilom-test/file-changes-action/{archive_format}{/ref}", - "archived": false, - "assignees_url": "https://api.github.com/repos/trilom-test/file-changes-action/assignees{/user}", - "blobs_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/blobs{/sha}", - "branches_url": "https://api.github.com/repos/trilom-test/file-changes-action/branches{/branch}", - "clone_url": "https://github.com/trilom-test/file-changes-action.git", - "collaborators_url": "https://api.github.com/repos/trilom-test/file-changes-action/collaborators{/collaborator}", - "comments_url": "https://api.github.com/repos/trilom-test/file-changes-action/comments{/number}", - "commits_url": "https://api.github.com/repos/trilom-test/file-changes-action/commits{/sha}", - "compare_url": "https://api.github.com/repos/trilom-test/file-changes-action/compare/{base}...{head}", - "contents_url": "https://api.github.com/repos/trilom-test/file-changes-action/contents/{+path}", - "contributors_url": "https://api.github.com/repos/trilom-test/file-changes-action/contributors", - "created_at": "2020-02-25T04:29:40Z", - "default_branch": "releases/v1", - "deployments_url": "https://api.github.com/repos/trilom-test/file-changes-action/deployments", - "description": "This action can be added, and you will get outputs of all of the files that have changed in your repository for you to use.", - "disabled": false, - "downloads_url": "https://api.github.com/repos/trilom-test/file-changes-action/downloads", - "events_url": "https://api.github.com/repos/trilom-test/file-changes-action/events", - "fork": true, - "forks": 0, - "forks_count": 0, - "forks_url": "https://api.github.com/repos/trilom-test/file-changes-action/forks", - "full_name": "trilom-test/file-changes-action", - "git_commits_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/commits{/sha}", - "git_refs_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/refs{/sha}", - "git_tags_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/tags{/sha}", - "git_url": "git://github.com/trilom-test/file-changes-action.git", - "has_downloads": true, - "has_issues": false, - "has_pages": false, - "has_projects": true, - "has_wiki": true, - "homepage": null, - "hooks_url": "https://api.github.com/repos/trilom-test/file-changes-action/hooks", - "html_url": "https://github.com/trilom-test/file-changes-action", - "id": 242909684, - "issue_comment_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/comments{/number}", - "issue_events_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/events{/number}", - "issues_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues{/number}", - "keys_url": "https://api.github.com/repos/trilom-test/file-changes-action/keys{/key_id}", - "labels_url": "https://api.github.com/repos/trilom-test/file-changes-action/labels{/name}", - "language": "JavaScript", - "languages_url": "https://api.github.com/repos/trilom-test/file-changes-action/languages", - "license": { - "key": "mit", - "name": "MIT License", - "node_id": "MDc6TGljZW5zZTEz", - "spdx_id": "MIT", - "url": "https://api.github.com/licenses/mit" - }, - "merges_url": "https://api.github.com/repos/trilom-test/file-changes-action/merges", - "milestones_url": "https://api.github.com/repos/trilom-test/file-changes-action/milestones{/number}", - "mirror_url": null, - "name": "file-changes-action", - "node_id": "MDEwOlJlcG9zaXRvcnkyNDI5MDk2ODQ=", - "notifications_url": "https://api.github.com/repos/trilom-test/file-changes-action/notifications{?since,all,participating}", - "open_issues": 1, - "open_issues_count": 1, - "owner": { - "avatar_url": "https://avatars3.githubusercontent.com/u/61441570?v=4", - "events_url": "https://api.github.com/users/trilom-test/events{/privacy}", - "followers_url": "https://api.github.com/users/trilom-test/followers", - "following_url": "https://api.github.com/users/trilom-test/following{/other_user}", - "gists_url": "https://api.github.com/users/trilom-test/gists{/gist_id}", - "gravatar_id": "", - "html_url": "https://github.com/trilom-test", - "id": 61441570, - "login": "trilom-test", - "node_id": "MDQ6VXNlcjYxNDQxNTcw", - "organizations_url": "https://api.github.com/users/trilom-test/orgs", - "received_events_url": "https://api.github.com/users/trilom-test/received_events", - "repos_url": "https://api.github.com/users/trilom-test/repos", - "site_admin": false, - "starred_url": "https://api.github.com/users/trilom-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/trilom-test/subscriptions", - "type": "User", - "url": "https://api.github.com/users/trilom-test" - }, - "private": false, - "pulls_url": "https://api.github.com/repos/trilom-test/file-changes-action/pulls{/number}", - "pushed_at": "2020-03-05T01:48:13Z", - "releases_url": "https://api.github.com/repos/trilom-test/file-changes-action/releases{/id}", - "size": 29568, - "ssh_url": "git@github.com:trilom-test/file-changes-action.git", - "stargazers_count": 0, - "stargazers_url": "https://api.github.com/repos/trilom-test/file-changes-action/stargazers", - "statuses_url": "https://api.github.com/repos/trilom-test/file-changes-action/statuses/{sha}", - "subscribers_url": "https://api.github.com/repos/trilom-test/file-changes-action/subscribers", - "subscription_url": "https://api.github.com/repos/trilom-test/file-changes-action/subscription", - "svn_url": "https://github.com/trilom-test/file-changes-action", - "tags_url": "https://api.github.com/repos/trilom-test/file-changes-action/tags", - "teams_url": "https://api.github.com/repos/trilom-test/file-changes-action/teams", - "trees_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/trees{/sha}", - "updated_at": "2020-03-05T01:45:22Z", - "url": "https://api.github.com/repos/trilom-test/file-changes-action", - "watchers": 0, - "watchers_count": 0 - }, - "sender": { - "avatar_url": "https://avatars3.githubusercontent.com/u/61441570?v=4", - "events_url": "https://api.github.com/users/trilom-test/events{/privacy}", - "followers_url": "https://api.github.com/users/trilom-test/followers", - "following_url": "https://api.github.com/users/trilom-test/following{/other_user}", - "gists_url": "https://api.github.com/users/trilom-test/gists{/gist_id}", - "gravatar_id": "", - "html_url": "https://github.com/trilom-test", - "id": 61441570, - "login": "trilom-test", - "node_id": "MDQ6VXNlcjYxNDQxNTcw", - "organizations_url": "https://api.github.com/users/trilom-test/orgs", - "received_events_url": "https://api.github.com/users/trilom-test/received_events", - "repos_url": "https://api.github.com/users/trilom-test/repos", - "site_admin": false, - "starred_url": "https://api.github.com/users/trilom-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/trilom-test/subscriptions", - "type": "User", - "url": "https://api.github.com/users/trilom-test" - } -} \ No newline at end of file diff --git a/__tests__/payloads/events/pull_request_synchronize.json b/__tests__/payloads/events/pull_request_synchronize.json deleted file mode 100644 index bd0adc4b..00000000 --- a/__tests__/payloads/events/pull_request_synchronize.json +++ /dev/null @@ -1,466 +0,0 @@ -{ - "action": "synchronize", - "after": "0a8847551b2045730dc5c1681d59717288619f94", - "before": "787a72d40923de2f5308e7095ff9e6063fdbc219", - "number": 3, - "pull_request": { - "_links": { - "comments": { - "href": "https://api.github.com/repos/trilom-test/file-changes-action/issues/3/comments" - }, - "commits": { - "href": "https://api.github.com/repos/trilom-test/file-changes-action/pulls/3/commits" - }, - "html": { - "href": "https://github.com/trilom-test/file-changes-action/pull/3" - }, - "issue": { - "href": "https://api.github.com/repos/trilom-test/file-changes-action/issues/3" - }, - "review_comment": { - "href": "https://api.github.com/repos/trilom-test/file-changes-action/pulls/comments{/number}" - }, - "review_comments": { - "href": "https://api.github.com/repos/trilom-test/file-changes-action/pulls/3/comments" - }, - "self": { - "href": "https://api.github.com/repos/trilom-test/file-changes-action/pulls/3" - }, - "statuses": { - "href": "https://api.github.com/repos/trilom-test/file-changes-action/statuses/0a8847551b2045730dc5c1681d59717288619f94" - } - }, - "additions": 39, - "assignee": null, - "assignees": [], - "author_association": "OWNER", - "base": { - "label": "trilom-test:develop", - "ref": "develop", - "repo": { - "archive_url": "https://api.github.com/repos/trilom-test/file-changes-action/{archive_format}{/ref}", - "archived": false, - "assignees_url": "https://api.github.com/repos/trilom-test/file-changes-action/assignees{/user}", - "blobs_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/blobs{/sha}", - "branches_url": "https://api.github.com/repos/trilom-test/file-changes-action/branches{/branch}", - "clone_url": "https://github.com/trilom-test/file-changes-action.git", - "collaborators_url": "https://api.github.com/repos/trilom-test/file-changes-action/collaborators{/collaborator}", - "comments_url": "https://api.github.com/repos/trilom-test/file-changes-action/comments{/number}", - "commits_url": "https://api.github.com/repos/trilom-test/file-changes-action/commits{/sha}", - "compare_url": "https://api.github.com/repos/trilom-test/file-changes-action/compare/{base}...{head}", - "contents_url": "https://api.github.com/repos/trilom-test/file-changes-action/contents/{+path}", - "contributors_url": "https://api.github.com/repos/trilom-test/file-changes-action/contributors", - "created_at": "2020-02-25T04:29:40Z", - "default_branch": "releases/v1", - "deployments_url": "https://api.github.com/repos/trilom-test/file-changes-action/deployments", - "description": "This action can be added, and you will get outputs of all of the files that have changed in your repository for you to use.", - "disabled": false, - "downloads_url": "https://api.github.com/repos/trilom-test/file-changes-action/downloads", - "events_url": "https://api.github.com/repos/trilom-test/file-changes-action/events", - "fork": true, - "forks": 0, - "forks_count": 0, - "forks_url": "https://api.github.com/repos/trilom-test/file-changes-action/forks", - "full_name": "trilom-test/file-changes-action", - "git_commits_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/commits{/sha}", - "git_refs_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/refs{/sha}", - "git_tags_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/tags{/sha}", - "git_url": "git://github.com/trilom-test/file-changes-action.git", - "has_downloads": true, - "has_issues": false, - "has_pages": false, - "has_projects": true, - "has_wiki": true, - "homepage": null, - "hooks_url": "https://api.github.com/repos/trilom-test/file-changes-action/hooks", - "html_url": "https://github.com/trilom-test/file-changes-action", - "id": 242909684, - "issue_comment_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/comments{/number}", - "issue_events_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/events{/number}", - "issues_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues{/number}", - "keys_url": "https://api.github.com/repos/trilom-test/file-changes-action/keys{/key_id}", - "labels_url": "https://api.github.com/repos/trilom-test/file-changes-action/labels{/name}", - "language": "JavaScript", - "languages_url": "https://api.github.com/repos/trilom-test/file-changes-action/languages", - "license": { - "key": "mit", - "name": "MIT License", - "node_id": "MDc6TGljZW5zZTEz", - "spdx_id": "MIT", - "url": "https://api.github.com/licenses/mit" - }, - "merges_url": "https://api.github.com/repos/trilom-test/file-changes-action/merges", - "milestones_url": "https://api.github.com/repos/trilom-test/file-changes-action/milestones{/number}", - "mirror_url": null, - "name": "file-changes-action", - "node_id": "MDEwOlJlcG9zaXRvcnkyNDI5MDk2ODQ=", - "notifications_url": "https://api.github.com/repos/trilom-test/file-changes-action/notifications{?since,all,participating}", - "open_issues": 1, - "open_issues_count": 1, - "owner": { - "avatar_url": "https://avatars3.githubusercontent.com/u/61441570?v=4", - "events_url": "https://api.github.com/users/trilom-test/events{/privacy}", - "followers_url": "https://api.github.com/users/trilom-test/followers", - "following_url": "https://api.github.com/users/trilom-test/following{/other_user}", - "gists_url": "https://api.github.com/users/trilom-test/gists{/gist_id}", - "gravatar_id": "", - "html_url": "https://github.com/trilom-test", - "id": 61441570, - "login": "trilom-test", - "node_id": "MDQ6VXNlcjYxNDQxNTcw", - "organizations_url": "https://api.github.com/users/trilom-test/orgs", - "received_events_url": "https://api.github.com/users/trilom-test/received_events", - "repos_url": "https://api.github.com/users/trilom-test/repos", - "site_admin": false, - "starred_url": "https://api.github.com/users/trilom-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/trilom-test/subscriptions", - "type": "User", - "url": "https://api.github.com/users/trilom-test" - }, - "private": false, - "pulls_url": "https://api.github.com/repos/trilom-test/file-changes-action/pulls{/number}", - "pushed_at": "2020-03-02T09:50:55Z", - "releases_url": "https://api.github.com/repos/trilom-test/file-changes-action/releases{/id}", - "size": 29569, - "ssh_url": "git@github.com:trilom-test/file-changes-action.git", - "stargazers_count": 0, - "stargazers_url": "https://api.github.com/repos/trilom-test/file-changes-action/stargazers", - "statuses_url": "https://api.github.com/repos/trilom-test/file-changes-action/statuses/{sha}", - "subscribers_url": "https://api.github.com/repos/trilom-test/file-changes-action/subscribers", - "subscription_url": "https://api.github.com/repos/trilom-test/file-changes-action/subscription", - "svn_url": "https://github.com/trilom-test/file-changes-action", - "tags_url": "https://api.github.com/repos/trilom-test/file-changes-action/tags", - "teams_url": "https://api.github.com/repos/trilom-test/file-changes-action/teams", - "trees_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/trees{/sha}", - "updated_at": "2020-03-02T03:52:45Z", - "url": "https://api.github.com/repos/trilom-test/file-changes-action", - "watchers": 0, - "watchers_count": 0 - }, - "sha": "06257961b2029c629a743a665e17e3430d741919", - "user": { - "avatar_url": "https://avatars3.githubusercontent.com/u/61441570?v=4", - "events_url": "https://api.github.com/users/trilom-test/events{/privacy}", - "followers_url": "https://api.github.com/users/trilom-test/followers", - "following_url": "https://api.github.com/users/trilom-test/following{/other_user}", - "gists_url": "https://api.github.com/users/trilom-test/gists{/gist_id}", - "gravatar_id": "", - "html_url": "https://github.com/trilom-test", - "id": 61441570, - "login": "trilom-test", - "node_id": "MDQ6VXNlcjYxNDQxNTcw", - "organizations_url": "https://api.github.com/users/trilom-test/orgs", - "received_events_url": "https://api.github.com/users/trilom-test/received_events", - "repos_url": "https://api.github.com/users/trilom-test/repos", - "site_admin": false, - "starred_url": "https://api.github.com/users/trilom-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/trilom-test/subscriptions", - "type": "User", - "url": "https://api.github.com/users/trilom-test" - } - }, - "body": "", - "changed_files": 1, - "closed_at": null, - "comments": 0, - "comments_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/3/comments", - "commits": 2, - "commits_url": "https://api.github.com/repos/trilom-test/file-changes-action/pulls/3/commits", - "created_at": "2020-03-02T03:53:01Z", - "deletions": 3, - "diff_url": "https://github.com/trilom-test/file-changes-action/pull/3.diff", - "draft": false, - "head": { - "label": "trilom-test:releases/v1", - "ref": "releases/v1", - "repo": { - "archive_url": "https://api.github.com/repos/trilom-test/file-changes-action/{archive_format}{/ref}", - "archived": false, - "assignees_url": "https://api.github.com/repos/trilom-test/file-changes-action/assignees{/user}", - "blobs_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/blobs{/sha}", - "branches_url": "https://api.github.com/repos/trilom-test/file-changes-action/branches{/branch}", - "clone_url": "https://github.com/trilom-test/file-changes-action.git", - "collaborators_url": "https://api.github.com/repos/trilom-test/file-changes-action/collaborators{/collaborator}", - "comments_url": "https://api.github.com/repos/trilom-test/file-changes-action/comments{/number}", - "commits_url": "https://api.github.com/repos/trilom-test/file-changes-action/commits{/sha}", - "compare_url": "https://api.github.com/repos/trilom-test/file-changes-action/compare/{base}...{head}", - "contents_url": "https://api.github.com/repos/trilom-test/file-changes-action/contents/{+path}", - "contributors_url": "https://api.github.com/repos/trilom-test/file-changes-action/contributors", - "created_at": "2020-02-25T04:29:40Z", - "default_branch": "releases/v1", - "deployments_url": "https://api.github.com/repos/trilom-test/file-changes-action/deployments", - "description": "This action can be added, and you will get outputs of all of the files that have changed in your repository for you to use.", - "disabled": false, - "downloads_url": "https://api.github.com/repos/trilom-test/file-changes-action/downloads", - "events_url": "https://api.github.com/repos/trilom-test/file-changes-action/events", - "fork": true, - "forks": 0, - "forks_count": 0, - "forks_url": "https://api.github.com/repos/trilom-test/file-changes-action/forks", - "full_name": "trilom-test/file-changes-action", - "git_commits_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/commits{/sha}", - "git_refs_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/refs{/sha}", - "git_tags_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/tags{/sha}", - "git_url": "git://github.com/trilom-test/file-changes-action.git", - "has_downloads": true, - "has_issues": false, - "has_pages": false, - "has_projects": true, - "has_wiki": true, - "homepage": null, - "hooks_url": "https://api.github.com/repos/trilom-test/file-changes-action/hooks", - "html_url": "https://github.com/trilom-test/file-changes-action", - "id": 242909684, - "issue_comment_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/comments{/number}", - "issue_events_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/events{/number}", - "issues_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues{/number}", - "keys_url": "https://api.github.com/repos/trilom-test/file-changes-action/keys{/key_id}", - "labels_url": "https://api.github.com/repos/trilom-test/file-changes-action/labels{/name}", - "language": "JavaScript", - "languages_url": "https://api.github.com/repos/trilom-test/file-changes-action/languages", - "license": { - "key": "mit", - "name": "MIT License", - "node_id": "MDc6TGljZW5zZTEz", - "spdx_id": "MIT", - "url": "https://api.github.com/licenses/mit" - }, - "merges_url": "https://api.github.com/repos/trilom-test/file-changes-action/merges", - "milestones_url": "https://api.github.com/repos/trilom-test/file-changes-action/milestones{/number}", - "mirror_url": null, - "name": "file-changes-action", - "node_id": "MDEwOlJlcG9zaXRvcnkyNDI5MDk2ODQ=", - "notifications_url": "https://api.github.com/repos/trilom-test/file-changes-action/notifications{?since,all,participating}", - "open_issues": 1, - "open_issues_count": 1, - "owner": { - "avatar_url": "https://avatars3.githubusercontent.com/u/61441570?v=4", - "events_url": "https://api.github.com/users/trilom-test/events{/privacy}", - "followers_url": "https://api.github.com/users/trilom-test/followers", - "following_url": "https://api.github.com/users/trilom-test/following{/other_user}", - "gists_url": "https://api.github.com/users/trilom-test/gists{/gist_id}", - "gravatar_id": "", - "html_url": "https://github.com/trilom-test", - "id": 61441570, - "login": "trilom-test", - "node_id": "MDQ6VXNlcjYxNDQxNTcw", - "organizations_url": "https://api.github.com/users/trilom-test/orgs", - "received_events_url": "https://api.github.com/users/trilom-test/received_events", - "repos_url": "https://api.github.com/users/trilom-test/repos", - "site_admin": false, - "starred_url": "https://api.github.com/users/trilom-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/trilom-test/subscriptions", - "type": "User", - "url": "https://api.github.com/users/trilom-test" - }, - "private": false, - "pulls_url": "https://api.github.com/repos/trilom-test/file-changes-action/pulls{/number}", - "pushed_at": "2020-03-02T09:50:55Z", - "releases_url": "https://api.github.com/repos/trilom-test/file-changes-action/releases{/id}", - "size": 29569, - "ssh_url": "git@github.com:trilom-test/file-changes-action.git", - "stargazers_count": 0, - "stargazers_url": "https://api.github.com/repos/trilom-test/file-changes-action/stargazers", - "statuses_url": "https://api.github.com/repos/trilom-test/file-changes-action/statuses/{sha}", - "subscribers_url": "https://api.github.com/repos/trilom-test/file-changes-action/subscribers", - "subscription_url": "https://api.github.com/repos/trilom-test/file-changes-action/subscription", - "svn_url": "https://github.com/trilom-test/file-changes-action", - "tags_url": "https://api.github.com/repos/trilom-test/file-changes-action/tags", - "teams_url": "https://api.github.com/repos/trilom-test/file-changes-action/teams", - "trees_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/trees{/sha}", - "updated_at": "2020-03-02T03:52:45Z", - "url": "https://api.github.com/repos/trilom-test/file-changes-action", - "watchers": 0, - "watchers_count": 0 - }, - "sha": "0a8847551b2045730dc5c1681d59717288619f94", - "user": { - "avatar_url": "https://avatars3.githubusercontent.com/u/61441570?v=4", - "events_url": "https://api.github.com/users/trilom-test/events{/privacy}", - "followers_url": "https://api.github.com/users/trilom-test/followers", - "following_url": "https://api.github.com/users/trilom-test/following{/other_user}", - "gists_url": "https://api.github.com/users/trilom-test/gists{/gist_id}", - "gravatar_id": "", - "html_url": "https://github.com/trilom-test", - "id": 61441570, - "login": "trilom-test", - "node_id": "MDQ6VXNlcjYxNDQxNTcw", - "organizations_url": "https://api.github.com/users/trilom-test/orgs", - "received_events_url": "https://api.github.com/users/trilom-test/received_events", - "repos_url": "https://api.github.com/users/trilom-test/repos", - "site_admin": false, - "starred_url": "https://api.github.com/users/trilom-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/trilom-test/subscriptions", - "type": "User", - "url": "https://api.github.com/users/trilom-test" - } - }, - "html_url": "https://github.com/trilom-test/file-changes-action/pull/3", - "id": 382158986, - "issue_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/3", - "labels": [], - "locked": false, - "maintainer_can_modify": false, - "merge_commit_sha": "8cee61b88b5359f49111ee556d9f7b0cbbeb3d9d", - "mergeable": null, - "mergeable_state": "unknown", - "merged": false, - "merged_at": null, - "merged_by": null, - "milestone": null, - "node_id": "MDExOlB1bGxSZXF1ZXN0MzgyMTU4OTg2", - "number": 3, - "patch_url": "https://github.com/trilom-test/file-changes-action/pull/3.patch", - "rebaseable": null, - "requested_reviewers": [], - "requested_teams": [], - "review_comment_url": "https://api.github.com/repos/trilom-test/file-changes-action/pulls/comments{/number}", - "review_comments": 0, - "review_comments_url": "https://api.github.com/repos/trilom-test/file-changes-action/pulls/3/comments", - "state": "open", - "statuses_url": "https://api.github.com/repos/trilom-test/file-changes-action/statuses/0a8847551b2045730dc5c1681d59717288619f94", - "title": "Update main.yml", - "updated_at": "2020-03-02T09:50:56Z", - "url": "https://api.github.com/repos/trilom-test/file-changes-action/pulls/3", - "user": { - "avatar_url": "https://avatars3.githubusercontent.com/u/61441570?v=4", - "events_url": "https://api.github.com/users/trilom-test/events{/privacy}", - "followers_url": "https://api.github.com/users/trilom-test/followers", - "following_url": "https://api.github.com/users/trilom-test/following{/other_user}", - "gists_url": "https://api.github.com/users/trilom-test/gists{/gist_id}", - "gravatar_id": "", - "html_url": "https://github.com/trilom-test", - "id": 61441570, - "login": "trilom-test", - "node_id": "MDQ6VXNlcjYxNDQxNTcw", - "organizations_url": "https://api.github.com/users/trilom-test/orgs", - "received_events_url": "https://api.github.com/users/trilom-test/received_events", - "repos_url": "https://api.github.com/users/trilom-test/repos", - "site_admin": false, - "starred_url": "https://api.github.com/users/trilom-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/trilom-test/subscriptions", - "type": "User", - "url": "https://api.github.com/users/trilom-test" - } - }, - "repository": { - "archive_url": "https://api.github.com/repos/trilom-test/file-changes-action/{archive_format}{/ref}", - "archived": false, - "assignees_url": "https://api.github.com/repos/trilom-test/file-changes-action/assignees{/user}", - "blobs_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/blobs{/sha}", - "branches_url": "https://api.github.com/repos/trilom-test/file-changes-action/branches{/branch}", - "clone_url": "https://github.com/trilom-test/file-changes-action.git", - "collaborators_url": "https://api.github.com/repos/trilom-test/file-changes-action/collaborators{/collaborator}", - "comments_url": "https://api.github.com/repos/trilom-test/file-changes-action/comments{/number}", - "commits_url": "https://api.github.com/repos/trilom-test/file-changes-action/commits{/sha}", - "compare_url": "https://api.github.com/repos/trilom-test/file-changes-action/compare/{base}...{head}", - "contents_url": "https://api.github.com/repos/trilom-test/file-changes-action/contents/{+path}", - "contributors_url": "https://api.github.com/repos/trilom-test/file-changes-action/contributors", - "created_at": "2020-02-25T04:29:40Z", - "default_branch": "releases/v1", - "deployments_url": "https://api.github.com/repos/trilom-test/file-changes-action/deployments", - "description": "This action can be added, and you will get outputs of all of the files that have changed in your repository for you to use.", - "disabled": false, - "downloads_url": "https://api.github.com/repos/trilom-test/file-changes-action/downloads", - "events_url": "https://api.github.com/repos/trilom-test/file-changes-action/events", - "fork": true, - "forks": 0, - "forks_count": 0, - "forks_url": "https://api.github.com/repos/trilom-test/file-changes-action/forks", - "full_name": "trilom-test/file-changes-action", - "git_commits_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/commits{/sha}", - "git_refs_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/refs{/sha}", - "git_tags_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/tags{/sha}", - "git_url": "git://github.com/trilom-test/file-changes-action.git", - "has_downloads": true, - "has_issues": false, - "has_pages": false, - "has_projects": true, - "has_wiki": true, - "homepage": null, - "hooks_url": "https://api.github.com/repos/trilom-test/file-changes-action/hooks", - "html_url": "https://github.com/trilom-test/file-changes-action", - "id": 242909684, - "issue_comment_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/comments{/number}", - "issue_events_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/events{/number}", - "issues_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues{/number}", - "keys_url": "https://api.github.com/repos/trilom-test/file-changes-action/keys{/key_id}", - "labels_url": "https://api.github.com/repos/trilom-test/file-changes-action/labels{/name}", - "language": "JavaScript", - "languages_url": "https://api.github.com/repos/trilom-test/file-changes-action/languages", - "license": { - "key": "mit", - "name": "MIT License", - "node_id": "MDc6TGljZW5zZTEz", - "spdx_id": "MIT", - "url": "https://api.github.com/licenses/mit" - }, - "merges_url": "https://api.github.com/repos/trilom-test/file-changes-action/merges", - "milestones_url": "https://api.github.com/repos/trilom-test/file-changes-action/milestones{/number}", - "mirror_url": null, - "name": "file-changes-action", - "node_id": "MDEwOlJlcG9zaXRvcnkyNDI5MDk2ODQ=", - "notifications_url": "https://api.github.com/repos/trilom-test/file-changes-action/notifications{?since,all,participating}", - "open_issues": 1, - "open_issues_count": 1, - "owner": { - "avatar_url": "https://avatars3.githubusercontent.com/u/61441570?v=4", - "events_url": "https://api.github.com/users/trilom-test/events{/privacy}", - "followers_url": "https://api.github.com/users/trilom-test/followers", - "following_url": "https://api.github.com/users/trilom-test/following{/other_user}", - "gists_url": "https://api.github.com/users/trilom-test/gists{/gist_id}", - "gravatar_id": "", - "html_url": "https://github.com/trilom-test", - "id": 61441570, - "login": "trilom-test", - "node_id": "MDQ6VXNlcjYxNDQxNTcw", - "organizations_url": "https://api.github.com/users/trilom-test/orgs", - "received_events_url": "https://api.github.com/users/trilom-test/received_events", - "repos_url": "https://api.github.com/users/trilom-test/repos", - "site_admin": false, - "starred_url": "https://api.github.com/users/trilom-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/trilom-test/subscriptions", - "type": "User", - "url": "https://api.github.com/users/trilom-test" - }, - "private": false, - "pulls_url": "https://api.github.com/repos/trilom-test/file-changes-action/pulls{/number}", - "pushed_at": "2020-03-02T09:50:55Z", - "releases_url": "https://api.github.com/repos/trilom-test/file-changes-action/releases{/id}", - "size": 29569, - "ssh_url": "git@github.com:trilom-test/file-changes-action.git", - "stargazers_count": 0, - "stargazers_url": "https://api.github.com/repos/trilom-test/file-changes-action/stargazers", - "statuses_url": "https://api.github.com/repos/trilom-test/file-changes-action/statuses/{sha}", - "subscribers_url": "https://api.github.com/repos/trilom-test/file-changes-action/subscribers", - "subscription_url": "https://api.github.com/repos/trilom-test/file-changes-action/subscription", - "svn_url": "https://github.com/trilom-test/file-changes-action", - "tags_url": "https://api.github.com/repos/trilom-test/file-changes-action/tags", - "teams_url": "https://api.github.com/repos/trilom-test/file-changes-action/teams", - "trees_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/trees{/sha}", - "updated_at": "2020-03-02T03:52:45Z", - "url": "https://api.github.com/repos/trilom-test/file-changes-action", - "watchers": 0, - "watchers_count": 0 - }, - "sender": { - "avatar_url": "https://avatars3.githubusercontent.com/u/61441570?v=4", - "events_url": "https://api.github.com/users/trilom-test/events{/privacy}", - "followers_url": "https://api.github.com/users/trilom-test/followers", - "following_url": "https://api.github.com/users/trilom-test/following{/other_user}", - "gists_url": "https://api.github.com/users/trilom-test/gists{/gist_id}", - "gravatar_id": "", - "html_url": "https://github.com/trilom-test", - "id": 61441570, - "login": "trilom-test", - "node_id": "MDQ6VXNlcjYxNDQxNTcw", - "organizations_url": "https://api.github.com/users/trilom-test/orgs", - "received_events_url": "https://api.github.com/users/trilom-test/received_events", - "repos_url": "https://api.github.com/users/trilom-test/repos", - "site_admin": false, - "starred_url": "https://api.github.com/users/trilom-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/trilom-test/subscriptions", - "type": "User", - "url": "https://api.github.com/users/trilom-test" - } -} \ No newline at end of file diff --git a/__tests__/payloads/events/push.json b/__tests__/payloads/events/push.json deleted file mode 100644 index 7e3a3d56..00000000 --- a/__tests__/payloads/events/push.json +++ /dev/null @@ -1,176 +0,0 @@ -{ - "after": "513ca39ff3756e5b510ad752edaba6a0aeb2efac", - "base_ref": null, - "before": "01a956ad7dbd39773299d421b402535cef6ab1f3", - "commits": [ - { - "author": { - "email": "61441570+trilom-test@users.noreply.github.com", - "name": "trilom-test", - "username": "trilom-test" - }, - "committer": { - "email": "noreply@github.com", - "name": "GitHub", - "username": "web-flow" - }, - "distinct": true, - "id": "513ca39ff3756e5b510ad752edaba6a0aeb2efac", - "message": "Update main.yml", - "timestamp": "2020-03-04T20:45:19-05:00", - "tree_id": "738da2abd0c2da5bd034958754b72132d07e9bf6", - "url": "https://github.com/trilom-test/file-changes-action/commit/513ca39ff3756e5b510ad752edaba6a0aeb2efac" - } - ], - "compare": "https://github.com/trilom-test/file-changes-action/compare/01a956ad7dbd...513ca39ff375", - "created": false, - "deleted": false, - "forced": false, - "head_commit": { - "author": { - "email": "61441570+trilom-test@users.noreply.github.com", - "name": "trilom-test", - "username": "trilom-test" - }, - "committer": { - "email": "noreply@github.com", - "name": "GitHub", - "username": "web-flow" - }, - "distinct": true, - "id": "513ca39ff3756e5b510ad752edaba6a0aeb2efac", - "message": "Update main.yml", - "timestamp": "2020-03-04T20:45:19-05:00", - "tree_id": "738da2abd0c2da5bd034958754b72132d07e9bf6", - "url": "https://github.com/trilom-test/file-changes-action/commit/513ca39ff3756e5b510ad752edaba6a0aeb2efac" - }, - "pusher": { - "email": "61441570+trilom-test@users.noreply.github.com", - "name": "trilom-test" - }, - "ref": "refs/heads/releases/v1", - "repository": { - "archive_url": "https://api.github.com/repos/trilom-test/file-changes-action/{archive_format}{/ref}", - "archived": false, - "assignees_url": "https://api.github.com/repos/trilom-test/file-changes-action/assignees{/user}", - "blobs_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/blobs{/sha}", - "branches_url": "https://api.github.com/repos/trilom-test/file-changes-action/branches{/branch}", - "clone_url": "https://github.com/trilom-test/file-changes-action.git", - "collaborators_url": "https://api.github.com/repos/trilom-test/file-changes-action/collaborators{/collaborator}", - "comments_url": "https://api.github.com/repos/trilom-test/file-changes-action/comments{/number}", - "commits_url": "https://api.github.com/repos/trilom-test/file-changes-action/commits{/sha}", - "compare_url": "https://api.github.com/repos/trilom-test/file-changes-action/compare/{base}...{head}", - "contents_url": "https://api.github.com/repos/trilom-test/file-changes-action/contents/{+path}", - "contributors_url": "https://api.github.com/repos/trilom-test/file-changes-action/contributors", - "created_at": 1582604980, - "default_branch": "releases/v1", - "deployments_url": "https://api.github.com/repos/trilom-test/file-changes-action/deployments", - "description": "This action can be added, and you will get outputs of all of the files that have changed in your repository for you to use.", - "disabled": false, - "downloads_url": "https://api.github.com/repos/trilom-test/file-changes-action/downloads", - "events_url": "https://api.github.com/repos/trilom-test/file-changes-action/events", - "fork": true, - "forks": 0, - "forks_count": 0, - "forks_url": "https://api.github.com/repos/trilom-test/file-changes-action/forks", - "full_name": "trilom-test/file-changes-action", - "git_commits_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/commits{/sha}", - "git_refs_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/refs{/sha}", - "git_tags_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/tags{/sha}", - "git_url": "git://github.com/trilom-test/file-changes-action.git", - "has_downloads": true, - "has_issues": false, - "has_pages": false, - "has_projects": true, - "has_wiki": true, - "homepage": null, - "hooks_url": "https://api.github.com/repos/trilom-test/file-changes-action/hooks", - "html_url": "https://github.com/trilom-test/file-changes-action", - "id": 242909684, - "issue_comment_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/comments{/number}", - "issue_events_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/events{/number}", - "issues_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues{/number}", - "keys_url": "https://api.github.com/repos/trilom-test/file-changes-action/keys{/key_id}", - "labels_url": "https://api.github.com/repos/trilom-test/file-changes-action/labels{/name}", - "language": "JavaScript", - "languages_url": "https://api.github.com/repos/trilom-test/file-changes-action/languages", - "license": { - "key": "mit", - "name": "MIT License", - "node_id": "MDc6TGljZW5zZTEz", - "spdx_id": "MIT", - "url": "https://api.github.com/licenses/mit" - }, - "master_branch": "releases/v1", - "merges_url": "https://api.github.com/repos/trilom-test/file-changes-action/merges", - "milestones_url": "https://api.github.com/repos/trilom-test/file-changes-action/milestones{/number}", - "mirror_url": null, - "name": "file-changes-action", - "node_id": "MDEwOlJlcG9zaXRvcnkyNDI5MDk2ODQ=", - "notifications_url": "https://api.github.com/repos/trilom-test/file-changes-action/notifications{?since,all,participating}", - "open_issues": 0, - "open_issues_count": 0, - "owner": { - "avatar_url": "https://avatars3.githubusercontent.com/u/61441570?v=4", - "email": "61441570+trilom-test@users.noreply.github.com", - "events_url": "https://api.github.com/users/trilom-test/events{/privacy}", - "followers_url": "https://api.github.com/users/trilom-test/followers", - "following_url": "https://api.github.com/users/trilom-test/following{/other_user}", - "gists_url": "https://api.github.com/users/trilom-test/gists{/gist_id}", - "gravatar_id": "", - "html_url": "https://github.com/trilom-test", - "id": 61441570, - "login": "trilom-test", - "name": "trilom-test", - "node_id": "MDQ6VXNlcjYxNDQxNTcw", - "organizations_url": "https://api.github.com/users/trilom-test/orgs", - "received_events_url": "https://api.github.com/users/trilom-test/received_events", - "repos_url": "https://api.github.com/users/trilom-test/repos", - "site_admin": false, - "starred_url": "https://api.github.com/users/trilom-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/trilom-test/subscriptions", - "type": "User", - "url": "https://api.github.com/users/trilom-test" - }, - "private": false, - "pulls_url": "https://api.github.com/repos/trilom-test/file-changes-action/pulls{/number}", - "pushed_at": 1583372720, - "releases_url": "https://api.github.com/repos/trilom-test/file-changes-action/releases{/id}", - "size": 29568, - "ssh_url": "git@github.com:trilom-test/file-changes-action.git", - "stargazers": 0, - "stargazers_count": 0, - "stargazers_url": "https://api.github.com/repos/trilom-test/file-changes-action/stargazers", - "statuses_url": "https://api.github.com/repos/trilom-test/file-changes-action/statuses/{sha}", - "subscribers_url": "https://api.github.com/repos/trilom-test/file-changes-action/subscribers", - "subscription_url": "https://api.github.com/repos/trilom-test/file-changes-action/subscription", - "svn_url": "https://github.com/trilom-test/file-changes-action", - "tags_url": "https://api.github.com/repos/trilom-test/file-changes-action/tags", - "teams_url": "https://api.github.com/repos/trilom-test/file-changes-action/teams", - "trees_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/trees{/sha}", - "updated_at": "2020-03-05T01:43:52Z", - "url": "https://github.com/trilom-test/file-changes-action", - "watchers": 0, - "watchers_count": 0 - }, - "sender": { - "avatar_url": "https://avatars3.githubusercontent.com/u/61441570?v=4", - "events_url": "https://api.github.com/users/trilom-test/events{/privacy}", - "followers_url": "https://api.github.com/users/trilom-test/followers", - "following_url": "https://api.github.com/users/trilom-test/following{/other_user}", - "gists_url": "https://api.github.com/users/trilom-test/gists{/gist_id}", - "gravatar_id": "", - "html_url": "https://github.com/trilom-test", - "id": 61441570, - "login": "trilom-test", - "node_id": "MDQ6VXNlcjYxNDQxNTcw", - "organizations_url": "https://api.github.com/users/trilom-test/orgs", - "received_events_url": "https://api.github.com/users/trilom-test/received_events", - "repos_url": "https://api.github.com/users/trilom-test/repos", - "site_admin": false, - "starred_url": "https://api.github.com/users/trilom-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/trilom-test/subscriptions", - "type": "User", - "url": "https://api.github.com/users/trilom-test" - } -} \ No newline at end of file diff --git a/__tests__/payloads/events/push_merge.json b/__tests__/payloads/events/push_merge.json deleted file mode 100644 index 5b4dc0cf..00000000 --- a/__tests__/payloads/events/push_merge.json +++ /dev/null @@ -1,230 +0,0 @@ -{ - "after": "5e877b4c67fdec76cf88c96729e7f788e044c2fd", - "base_ref": null, - "before": "6fa4d89edfa019c534c43bf283c361b770d584fc", - "commits": [ - { - "author": { - "email": "61441570+trilom-test@users.noreply.github.com", - "name": "trilom-test", - "username": "trilom-test" - }, - "committer": { - "email": "noreply@github.com", - "name": "GitHub", - "username": "web-flow" - }, - "distinct": false, - "id": "58b8c6de8e727594c66ea84711826d6a6840917e", - "message": "Update main.yml", - "timestamp": "2020-03-04T20:42:59-05:00", - "tree_id": "62caf4ac23f96a389662af394ec47f8b9331778c", - "url": "https://github.com/trilom-test/file-changes-action/commit/58b8c6de8e727594c66ea84711826d6a6840917e" - }, - { - "author": { - "email": "61441570+trilom-test@users.noreply.github.com", - "name": "trilom-test", - "username": "trilom-test" - }, - "committer": { - "email": "noreply@github.com", - "name": "GitHub", - "username": "web-flow" - }, - "distinct": false, - "id": "01a956ad7dbd39773299d421b402535cef6ab1f3", - "message": "Update main.yml", - "timestamp": "2020-03-04T20:43:49-05:00", - "tree_id": "d15e03406f052d5bcd7850799fc3bbcbf593480d", - "url": "https://github.com/trilom-test/file-changes-action/commit/01a956ad7dbd39773299d421b402535cef6ab1f3" - }, - { - "author": { - "email": "61441570+trilom-test@users.noreply.github.com", - "name": "trilom-test", - "username": "trilom-test" - }, - "committer": { - "email": "noreply@github.com", - "name": "GitHub", - "username": "web-flow" - }, - "distinct": false, - "id": "513ca39ff3756e5b510ad752edaba6a0aeb2efac", - "message": "Update main.yml", - "timestamp": "2020-03-04T20:45:19-05:00", - "tree_id": "738da2abd0c2da5bd034958754b72132d07e9bf6", - "url": "https://github.com/trilom-test/file-changes-action/commit/513ca39ff3756e5b510ad752edaba6a0aeb2efac" - }, - { - "author": { - "email": "61441570+trilom-test@users.noreply.github.com", - "name": "trilom-test", - "username": "trilom-test" - }, - "committer": { - "email": "noreply@github.com", - "name": "GitHub", - "username": "web-flow" - }, - "distinct": true, - "id": "5e877b4c67fdec76cf88c96729e7f788e044c2fd", - "message": "Merge pull request #5 from trilom-test/releases/v1\n\ntest", - "timestamp": "2020-03-04T20:48:32-05:00", - "tree_id": "9b0c64c91d75ceedcba03c22e85b1837f4ba5035", - "url": "https://github.com/trilom-test/file-changes-action/commit/5e877b4c67fdec76cf88c96729e7f788e044c2fd" - } - ], - "compare": "https://github.com/trilom-test/file-changes-action/compare/6fa4d89edfa0...5e877b4c67fd", - "created": false, - "deleted": false, - "forced": false, - "head_commit": { - "author": { - "email": "61441570+trilom-test@users.noreply.github.com", - "name": "trilom-test", - "username": "trilom-test" - }, - "committer": { - "email": "noreply@github.com", - "name": "GitHub", - "username": "web-flow" - }, - "distinct": true, - "id": "5e877b4c67fdec76cf88c96729e7f788e044c2fd", - "message": "Merge pull request #5 from trilom-test/releases/v1\n\ntest", - "timestamp": "2020-03-04T20:48:32-05:00", - "tree_id": "9b0c64c91d75ceedcba03c22e85b1837f4ba5035", - "url": "https://github.com/trilom-test/file-changes-action/commit/5e877b4c67fdec76cf88c96729e7f788e044c2fd" - }, - "pusher": { - "email": "61441570+trilom-test@users.noreply.github.com", - "name": "trilom-test" - }, - "ref": "refs/heads/develop", - "repository": { - "archive_url": "https://api.github.com/repos/trilom-test/file-changes-action/{archive_format}{/ref}", - "archived": false, - "assignees_url": "https://api.github.com/repos/trilom-test/file-changes-action/assignees{/user}", - "blobs_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/blobs{/sha}", - "branches_url": "https://api.github.com/repos/trilom-test/file-changes-action/branches{/branch}", - "clone_url": "https://github.com/trilom-test/file-changes-action.git", - "collaborators_url": "https://api.github.com/repos/trilom-test/file-changes-action/collaborators{/collaborator}", - "comments_url": "https://api.github.com/repos/trilom-test/file-changes-action/comments{/number}", - "commits_url": "https://api.github.com/repos/trilom-test/file-changes-action/commits{/sha}", - "compare_url": "https://api.github.com/repos/trilom-test/file-changes-action/compare/{base}...{head}", - "contents_url": "https://api.github.com/repos/trilom-test/file-changes-action/contents/{+path}", - "contributors_url": "https://api.github.com/repos/trilom-test/file-changes-action/contributors", - "created_at": 1582604980, - "default_branch": "releases/v1", - "deployments_url": "https://api.github.com/repos/trilom-test/file-changes-action/deployments", - "description": "This action can be added, and you will get outputs of all of the files that have changed in your repository for you to use.", - "disabled": false, - "downloads_url": "https://api.github.com/repos/trilom-test/file-changes-action/downloads", - "events_url": "https://api.github.com/repos/trilom-test/file-changes-action/events", - "fork": true, - "forks": 0, - "forks_count": 0, - "forks_url": "https://api.github.com/repos/trilom-test/file-changes-action/forks", - "full_name": "trilom-test/file-changes-action", - "git_commits_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/commits{/sha}", - "git_refs_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/refs{/sha}", - "git_tags_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/tags{/sha}", - "git_url": "git://github.com/trilom-test/file-changes-action.git", - "has_downloads": true, - "has_issues": false, - "has_pages": false, - "has_projects": true, - "has_wiki": true, - "homepage": null, - "hooks_url": "https://api.github.com/repos/trilom-test/file-changes-action/hooks", - "html_url": "https://github.com/trilom-test/file-changes-action", - "id": 242909684, - "issue_comment_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/comments{/number}", - "issue_events_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues/events{/number}", - "issues_url": "https://api.github.com/repos/trilom-test/file-changes-action/issues{/number}", - "keys_url": "https://api.github.com/repos/trilom-test/file-changes-action/keys{/key_id}", - "labels_url": "https://api.github.com/repos/trilom-test/file-changes-action/labels{/name}", - "language": "JavaScript", - "languages_url": "https://api.github.com/repos/trilom-test/file-changes-action/languages", - "license": { - "key": "mit", - "name": "MIT License", - "node_id": "MDc6TGljZW5zZTEz", - "spdx_id": "MIT", - "url": "https://api.github.com/licenses/mit" - }, - "master_branch": "releases/v1", - "merges_url": "https://api.github.com/repos/trilom-test/file-changes-action/merges", - "milestones_url": "https://api.github.com/repos/trilom-test/file-changes-action/milestones{/number}", - "mirror_url": null, - "name": "file-changes-action", - "node_id": "MDEwOlJlcG9zaXRvcnkyNDI5MDk2ODQ=", - "notifications_url": "https://api.github.com/repos/trilom-test/file-changes-action/notifications{?since,all,participating}", - "open_issues": 0, - "open_issues_count": 0, - "owner": { - "avatar_url": "https://avatars3.githubusercontent.com/u/61441570?v=4", - "email": "61441570+trilom-test@users.noreply.github.com", - "events_url": "https://api.github.com/users/trilom-test/events{/privacy}", - "followers_url": "https://api.github.com/users/trilom-test/followers", - "following_url": "https://api.github.com/users/trilom-test/following{/other_user}", - "gists_url": "https://api.github.com/users/trilom-test/gists{/gist_id}", - "gravatar_id": "", - "html_url": "https://github.com/trilom-test", - "id": 61441570, - "login": "trilom-test", - "name": "trilom-test", - "node_id": "MDQ6VXNlcjYxNDQxNTcw", - "organizations_url": "https://api.github.com/users/trilom-test/orgs", - "received_events_url": "https://api.github.com/users/trilom-test/received_events", - "repos_url": "https://api.github.com/users/trilom-test/repos", - "site_admin": false, - "starred_url": "https://api.github.com/users/trilom-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/trilom-test/subscriptions", - "type": "User", - "url": "https://api.github.com/users/trilom-test" - }, - "private": false, - "pulls_url": "https://api.github.com/repos/trilom-test/file-changes-action/pulls{/number}", - "pushed_at": 1583372913, - "releases_url": "https://api.github.com/repos/trilom-test/file-changes-action/releases{/id}", - "size": 29568, - "ssh_url": "git@github.com:trilom-test/file-changes-action.git", - "stargazers": 0, - "stargazers_count": 0, - "stargazers_url": "https://api.github.com/repos/trilom-test/file-changes-action/stargazers", - "statuses_url": "https://api.github.com/repos/trilom-test/file-changes-action/statuses/{sha}", - "subscribers_url": "https://api.github.com/repos/trilom-test/file-changes-action/subscribers", - "subscription_url": "https://api.github.com/repos/trilom-test/file-changes-action/subscription", - "svn_url": "https://github.com/trilom-test/file-changes-action", - "tags_url": "https://api.github.com/repos/trilom-test/file-changes-action/tags", - "teams_url": "https://api.github.com/repos/trilom-test/file-changes-action/teams", - "trees_url": "https://api.github.com/repos/trilom-test/file-changes-action/git/trees{/sha}", - "updated_at": "2020-03-05T01:45:22Z", - "url": "https://github.com/trilom-test/file-changes-action", - "watchers": 0, - "watchers_count": 0 - }, - "sender": { - "avatar_url": "https://avatars3.githubusercontent.com/u/61441570?v=4", - "events_url": "https://api.github.com/users/trilom-test/events{/privacy}", - "followers_url": "https://api.github.com/users/trilom-test/followers", - "following_url": "https://api.github.com/users/trilom-test/following{/other_user}", - "gists_url": "https://api.github.com/users/trilom-test/gists{/gist_id}", - "gravatar_id": "", - "html_url": "https://github.com/trilom-test", - "id": 61441570, - "login": "trilom-test", - "node_id": "MDQ6VXNlcjYxNDQxNTcw", - "organizations_url": "https://api.github.com/users/trilom-test/orgs", - "received_events_url": "https://api.github.com/users/trilom-test/received_events", - "repos_url": "https://api.github.com/users/trilom-test/repos", - "site_admin": false, - "starred_url": "https://api.github.com/users/trilom-test/starred{/owner}{/repo}", - "subscriptions_url": "https://api.github.com/users/trilom-test/subscriptions", - "type": "User", - "url": "https://api.github.com/users/trilom-test" - } -} \ No newline at end of file diff --git a/__tests__/payloads/events/schedule.json b/__tests__/payloads/events/schedule.json deleted file mode 100644 index c457f8b8..00000000 --- a/__tests__/payloads/events/schedule.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "schedule": "*/3 * * * *" -} diff --git a/src/ChangedFiles.ts b/src/ChangedFiles.ts deleted file mode 100644 index 4fee6025..00000000 --- a/src/ChangedFiles.ts +++ /dev/null @@ -1,53 +0,0 @@ -import {File} from './File' - -export class ChangedFiles { - updated: string[] = [] - created: string[] = [] - deleted: string[] = [] - files: string[] = [] - - getOutput(files: string[], format: string): string { - if (format === 'json') { - return JSON.stringify(files) - } else { - return files.join(format) - } - } - - createdOutput(format: string): string { - return this.getOutput(this.created, format) - } - - fileOutput(format: string): string { - return this.getOutput(this.files, format) - } - - updatedOutput(format: string): string { - return this.getOutput(this.updated, format) - } - - deletedOutput(format: string): string { - return this.getOutput(this.deleted, format) - } -} - -export async function sortChangedFiles(files: any): Promise { - return files.reduce((acc: ChangedFiles, f: File) => { - if (f.status === 'added' || f.added) { - acc.created.push(f.filename === undefined ? f.added : f.filename) - acc.files.push(f.filename === undefined ? f.added : f.filename) - } - if (f.status === 'removed' || f.removed) { - acc.deleted.push(f.filename === undefined ? f.removed : f.filename) - } - if (f.status === 'modified' || f.modified) { - acc.updated.push(f.filename === undefined ? f.modified : f.filename) - acc.files.push(f.filename === undefined ? f.modified : f.filename) - } - if (f.status === 'renamed') { - acc.created.push(f.filename) - acc.deleted.push(f.previous_filename) - } - return acc - }, new ChangedFiles()) -} diff --git a/src/File.ts b/src/File.ts deleted file mode 100644 index 4748b92d..00000000 --- a/src/File.ts +++ /dev/null @@ -1,9 +0,0 @@ -export class File { - added: string = '' - modified: string = '' - removed: string = '' - filename: string = '' - status: string = '' - previous_filename: string = '' - distinct: boolean = true -} diff --git a/src/FilesHelper.ts b/src/FilesHelper.ts new file mode 100644 index 00000000..537e580c --- /dev/null +++ b/src/FilesHelper.ts @@ -0,0 +1,104 @@ +import { writeFileSync } from 'fs' +import { setOutput as coreSetOutput, debug as coreDebug } from '@actions/core' +import type { GithubFile } from './GithubHelper' +import {getErrorString} from './UtilsHelper' + +export interface ChangedFiles { + [key: string]: string[] +} + +/** + * @function sortChangedFiles + * @param files pass in array of GithubFile's to be sorted + * @returns ChangedFiles object that has .files, .added, .modified, and .deleted + */ +export function sortChangedFiles(files: GithubFile[]): ChangedFiles { + try { + coreDebug(JSON.stringify(files, null, 2)) + const changedFiles: ChangedFiles = files.reduce((acc: ChangedFiles, f: GithubFile) => { + acc[f.status].push(f.filename || (f.added || f.removed || f.modified)) + acc.files.push(f.filename || (f.added || f.removed || f.modified)) + return acc + }, {} as ChangedFiles) + return changedFiles + } catch (error) { + const eString = `There was an issue sorting files changed files.` + throw new Error(getErrorString(error.name || 'unknown', error.status, sortChangedFiles.name, eString, JSON.stringify(error))) + } +} + +/** + * @function getFormatExt + * @param format output format 'json' = '.json' ',' = '.csv' anything else is '.txt'. + * @returns file extension, '.json', '.csv', or '.txt' + */ +export function getFormatExt(format: string): string { + let ext + switch (format.trim()) { + case 'json': + ext = '.json' + break + case ',': + ext = '.csv' + break + default: + ext = '.txt' + break + } + return ext +} + +/** + * @function formatChangedFiles + * @param format output format 'json' will stringify anything else will files.join('string') + * @param files string list of files to format + * @returns string for output of changedFiles + */ +export function formatChangedFiles(format: string, files: string[]): string { + if (format === 'json') { + return JSON.stringify(files) + } + return files.join(format) + +} + +/** + * @function writeFiles + * @param format output format 'json' will stringify anything else will files.join('string') + * @param key changedFiles type added, modified, deleted, or files + * @param files string list of files to format + * @returns string output to be stored in file + */ +export function writeFiles(format: string, key: string, files: string[]): void { + try { + const ext = getFormatExt(format) + const fileName = ((key === 'files') ? `${key}${ext}` : `files_${key}${ext}`) + coreDebug(`Writing output file ${process.env.HOME}/${fileName}${ext} with ${format} and files ${JSON.stringify(files, null, 2)}`) + writeFileSync( + `${process.env.HOME}/${fileName}`, + formatChangedFiles(format, files), + 'utf-8' + ) + } catch (error) { + const eString = `There was an issue writing output files.` + throw new Error(getErrorString(error.name || 'unknown', error.status, writeFiles.name, eString, JSON.stringify(error))) + } +} + +/** + * @function writeOutput + * @param format output format 'json' will stringify anything else will files.join('string') + * @param key changedFiles type added, modified, deleted, or files + * @param files string list of files to format + * @returns string output to be stored to action output + */ +export function writeOutput(format: string, key: string, files: string[]): void { + try { + const fileName = ((key === 'files') ? key : `files_${key}`) + coreDebug(`Writing output ${fileName} with ${format} and files ${JSON.stringify(files, null, 2)}`) + coreSetOutput(fileName, formatChangedFiles(format, files)) + } catch (error) { + const eString = `There was an issue setting action outputs.` + throw new Error(getErrorString(error.name || 'unknown', error.status, writeOutput.name, eString, JSON.stringify(error))) + } +} diff --git a/src/GithubHelper.ts b/src/GithubHelper.ts new file mode 100644 index 00000000..ef17cc64 --- /dev/null +++ b/src/GithubHelper.ts @@ -0,0 +1,132 @@ +import {GitHub} from '@actions/github' +import type { Inferred } from './InputHelper' +import { getErrorString } from './UtilsHelper' + +export interface GithubFile { + added: string + modified: string + removed: string + filename: string + status: string + previous_filename: string + distinct: boolean +} + +/** + * @function initClient + * @throws {Error} not sure what might trigger this, but it will throw an error. + * @param token github token to add to client + * @returns authenticated github client + */ +export function initClient( + token: string +): GitHub { + try { + return new GitHub(token) + } catch (error) { + const eString = `There was an error creating github client. \ +Please check your token.` + throw new Error(getErrorString(error.name, error.status, initClient.name, eString, error)) + } +} +/** + * @function getChangedPRFiles + * @throws {Error} when a 404 or other is received. 404 can be bad repo, owner, pr, or unauthenticated + * @param client authenticated github client (possibly un-authenticated if public) + * @param repo repo string. file-changes-action + * @param owner owner string. trilom + * @param pullNumber pr number to get changed files for + * @returns Promise of array of changed files + */ +export async function getChangedPRFiles( + client: GitHub, + repo: string, + owner: string, + pullNumber: number +): Promise { + try { + const options = client.pulls.listFiles.endpoint.merge({ + owner, repo, pull_number: pullNumber + }) + const files: GithubFile[] = await client.paginate( + options, + response => response.data + ) + return files + } catch(error) { + const eString = `There was an error getting change files for +repo:${repo} owner:${owner} pr:${pullNumber}` + let ePayload: string + if (error.name === 'HttpError' && +error.status === 404) ePayload = getErrorString(error.name, error.status, getChangedPRFiles.name, eString, error) + else ePayload = getErrorString(`Unknown Error:${error.name || ''}`, error.status, getChangedPRFiles.name, eString, error.message) + throw new Error(ePayload) + } +} +/** + * @function getChangedPushFiles + * @throws {Error} when a 404 or other is received. 404 can be bad repo, owner, sha, or unauthenticated + * @param client authenticated github client (possibly un-authenticated if public) + * @param repo repo string. file-changes-action + * @param owner owner string. trilom + * @param base BASE commit sha to compare + * @param head HEAD commit sha to compare + * @returns Promise of array of changed files + */ +export async function getChangedPushFiles( + client: GitHub, + repo: string, + owner: string, + base: string, + head: string +): Promise { + try { + const options = client.repos.compareCommits.endpoint.merge({ + owner, repo, base, head + }) + const files:GithubFile[] = await client.paginate( + options, + response => response.data.files + ) + return files + } catch (error) { + const eString = `There was an error getting change files for +repo:${repo} owner:${owner} base:${base} head:${head}` + let ePayload: string + if (error.name === 'HttpError' && +error.status === 404) ePayload = getErrorString(error.name, error.status, getChangedPushFiles.name, eString, error) + else ePayload = getErrorString(`Unknown Error:${error.name || ''}`, error.status, getChangedPushFiles.name, eString, error.message) + throw new Error(ePayload) + } +} +/** + * @function getChangedFiles + * @param client client authenticated github client (possibly un-authenticated if public) + * @param repoFull repo owner/repo string. trilom/file-changes-action + * @type {Inferred} pass in iinferred type from inferInput + * @returns Promise of an array of changed PR or push files + */ +export async function getChangedFiles( + client: GitHub, + repoFull: string, + { before, after, pr = NaN }: Inferred +): Promise { + try { + if (repoFull.split('/').length > 2) + throw new Error(getErrorString(`Bad-Repo`, 500, getChangedFiles.name, `Repo input of ${repoFull} has more than 2 length after splitting.`)) + const owner = repoFull.split('/')[0] + const repo = repoFull.split('/')[1] + let files:GithubFile[] = [] + if (Number.isNaN(pr)) + files = await getChangedPushFiles(client, repo, owner, before || '', after || '') + else + files = await getChangedPRFiles(client, repo, owner, pr) + return files + } catch (error) { + const pError = JSON.parse(error.message) + if (pError.from.includes('getChanged')) + throw new Error(JSON.stringify({ ...pError, ...{ from: `${error.status}/${error.name}`} }, null, 2)) + const eString = `There was an error getting change files outputs +pr: ${pr} before: ${before} after: ${after}` + const ePayload: string = getErrorString(`Unknown Error:${error.name || ''}`, error.status, getChangedFiles.name, eString, error.message) + throw new Error(ePayload) + } +} \ No newline at end of file diff --git a/src/InputHelper.ts b/src/InputHelper.ts new file mode 100644 index 00000000..e3aea22e --- /dev/null +++ b/src/InputHelper.ts @@ -0,0 +1,88 @@ +import { + warning as coreWarning, + getInput as coreGetInput } from '@actions/core' +import { context } from '@actions/github' +import { getErrorString } from './UtilsHelper' + +export interface Inferred { + pr?: number + before?: string + after?: string + [key: string]: string|number|undefined; +} + +export interface Inputs { + githubRepo: string + githubToken: string + pushBefore: string + pushAfter: string + prNumber: number + output: string + fileOutput: string + event: string + [key: string]: string|number; +} + +/** + * @function getInputs + * @description reads the inputs to the action with core.getInput and returns object + * @returns {Inputs} object of inputs for the github action + */ +export function getInputs():Inputs { + try { + const token = coreGetInput('githubToken') || process.env.GITHUB_TOKEN || false + if (!token) + throw new Error(getErrorString('getInputs Error', 500, getInputs.name, 'Received no token, a token is a requirement.')) + return { + githubRepo: coreGetInput('githubRepo') || `${context.repo.owner}/${context.repo.repo}`, + githubToken: token, + pushBefore: coreGetInput('pushBefore') || ((context.payload.before === undefined) ? false : context.payload.before), + pushAfter: coreGetInput('pushAfter') || ((context.payload.after === undefined) ? false : context.payload.after), + prNumber: +coreGetInput('prNumber') || ((typeof (context.issue.number) === 'undefined') ? NaN : context.issue.number), + output: coreGetInput('output') || 'json', + fileOutput: coreGetInput('fileOutput') || 'json', + event: context.eventName || 'push' + } as Inputs + } catch (error) { + const eString = `Received an issue getting action inputs.` + const retVars = Object.fromEntries(Object.entries(process.env).filter( key => key[0].includes('GITHUB') || key[0].includes('INPUT_'))) + throw new Error(getErrorString('getInputs Error', 500, getInputs.name, eString, retVars)) + } +} +/** + * @function inferInput + * @param before BASE commit sha to compare + * @param after HEAD commit sha to compare + * @param pr pr number to get changed files for + * @returns {Inferred} object of inferred input for the action + */ +export function inferInput(before: string, after: string, pr: number): Inferred { + const event = context.eventName + const weirdInput = `Received event from ${event}, but also received a before(${before}) or after(${after}) value.\n I am assuming you want to use a Push event but forgot something, so I'm giving you a message.` + const allInput = `Received event from ${event}, but received a before(${before}), after(${after}), and PR(${pr}).\n I am assuming you want to use one or the other but I am giving you Pull Request.` + if (event === 'pull_request') { + if (before && after) return { before, after } // PR(push) - pull_request event with push inputs | PUSH + if (before || after) coreWarning(weirdInput) // PR(push) - pull_request event with single push input | PR* + return { pr } // PR - pull_request event with no push inputs | PR + } + if (event === 'push') { + if (pr) return { pr } // Push(PR) - push event with pr inputs | PR + return { before, after } // Push - push event with no pr inputs | PUSH + } + if (pr) { + if (before && after) { + coreWarning(allInput) // Not PR or Push - all inputs | PUSH* + return { before, after } // Not PR or Push - pr inputs | PR + } + if (before || after) coreWarning(weirdInput) // Not PR or Push - pull_request event with single push input | PR* + return { pr } // Not PR or Push - pr inputs | PR + } if (before || after) { + if (!(before && after)) { + const eString = `Received event from ${event}, but only received a before(${before}) or after(${after}).\n I need both of these if you want to use a Push event.` + throw new Error(getErrorString('inferInput Error', 500, inferInput.name, eString)) + } + return { before, after } // Not PR or Push - push inputs | PUSH + } + const eString = `Received event from ${event}, but received no inputs. {event_name:${event}, pr: ${+pr}, before:${before}, after:${after}}` + throw new Error(getErrorString('inferInput Error', 500, inferInput.name, eString)) +} \ No newline at end of file diff --git a/src/UtilsHelper.ts b/src/UtilsHelper.ts new file mode 100644 index 00000000..65c6133e --- /dev/null +++ b/src/UtilsHelper.ts @@ -0,0 +1,21 @@ +export interface ActionError { + error: string + from: string + message: string + payload: string +} +export function getErrorString( + name: string, + status = 500, + from: string, + message: string, + error: any = '' +): string { + const test = JSON.stringify({ + error: `${status}/${name}`, + from, + message, + payload: error + } as ActionError, null, 2) + return test +} \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index 1aacbc19..2778f01d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,157 +1,57 @@ // External Dependencies -import * as core from '@actions/core' -import * as fs from 'fs' -import * as gh from '@actions/github' -import {ChangedFiles, sortChangedFiles} from './ChangedFiles' +import {error as coreError, setFailed as coreSetFailed} from '@actions/core' +import { writeOutput, writeFiles, sortChangedFiles} from './FilesHelper' +import {getInputs, inferInput} from './InputHelper' +import { getChangedFiles, initClient} from './GithubHelper' -async function getChangedPRFiles( - repo: string, - client: gh.GitHub, - prNumber: number -): Promise { - const options = client.pulls.listFiles.endpoint.merge({ - owner: repo.split('/')[0], - repo: repo.split('/')[1], - pull_number: prNumber - }) - return sortChangedFiles( - await client.paginate(options).then(files => { - return files - }) - ) -} - -async function getChangedPushFiles( - repo: string, - client: gh.GitHub, - base: string, - head: string -): Promise { - const response = await client.repos.compareCommits({ - owner: repo.split('/')[0], - repo: repo.split('/')[1], - base, - head - }) - return sortChangedFiles(response.data.files) -} - -function writeFiles(format: string, changedFiles: ChangedFiles): void { - switch (format.trim()) { - case 'json': - format = '.json' - break - case ',': - format = '.csv' - break - default: - format = '.txt' - break - } - //write files to preserve original functionality - fs.writeFileSync( - `${process.env.HOME}/files${format}`, - changedFiles.fileOutput(format), - 'utf-8' - ) - fs.writeFileSync( - `${process.env.HOME}/files_modified${format}`, - changedFiles.updatedOutput(format), - 'utf-8' - ) - fs.writeFileSync( - `${process.env.HOME}/files_added${format}`, - changedFiles.createdOutput(format), - 'utf-8' - ) - fs.writeFileSync( - `${process.env.HOME}/files_deleted${format}`, - changedFiles.deletedOutput(format), - 'utf-8' - ) -} - -function writeOutput(format: string, changedFiles: ChangedFiles): void { - //also export some outputs - core.setOutput('files', changedFiles.fileOutput(format)) - core.setOutput('files_added', changedFiles.createdOutput(format)) - core.setOutput('files_modified', changedFiles.updatedOutput(format)) - core.setOutput('files_deleted', changedFiles.deletedOutput(format)) -} // figure out if it is a PR or Push -async function run(): Promise { +export async function run(): Promise { try { - const github: any = gh.context - const repo: string = core.getInput('githubRepo') - const token: string = core.getInput('githubToken') - const output: string = core.getInput('output') - const fileOutput: string = core.getInput('fileOutput') - const pushBefore: string = core.getInput('pushBefore') - const pushAfter: string = core.getInput('pushAfter') - const prNumber: string = core.getInput('prNumber') - const isPush = pushBefore !== '' && pushAfter !== '' - const isPR = prNumber !== '' - const client = new gh.GitHub(token) - let changedFiles = new ChangedFiles() - if (isPush && isPR) { - core.setFailed( - `You can't pick PR and Push, I don't know which one to do.` - ) - } else if (isPR) { - // do PR actions - if (prNumber != null) { - try { - core.error(`${prNumber}`) - core.error(`${repo}`) - changedFiles = await getChangedPRFiles( - repo, - client, - parseInt(prNumber) - ) - } catch (error) { - core.error( - `There was an error getting Pull Request change files:${error}` - ) - throw error - } - } else { - core.setFailed( - 'Could not get pull request number from context, exiting' - ) - return - } - } else if (isPush) { - // do push actions - try { - changedFiles = await getChangedPushFiles( - repo, - client, - pushBefore, - pushAfter - ) - } catch (error) { - core.error(`There was an error getting Push change files:${error}`) - throw error - } - } else { - core.setFailed( - `Change not initiated by a PR or Push, it was ${ - github.eventName - } instead. Github:${JSON.stringify(github)}` - ) - return - } - // write file output - writeFiles(fileOutput, changedFiles) - - // write output vars - writeOutput(output, changedFiles) - + // get inputs + const inputs = getInputs() + // parse input + const inferred = inferInput(inputs.pushBefore, inputs.pushAfter, inputs.prNumber) + // prepare client + const client = initClient(inputs.githubToken) + // get changed files + const changedFilesArray = await getChangedFiles(client, inputs.githubRepo, inferred) + // sort changed files + const changedFiles = sortChangedFiles(changedFilesArray) + Object.keys(changedFiles).forEach(key => { + // write file output + writeFiles(inputs.fileOutput, key, changedFiles[key]) + // write output vars + writeOutput(inputs.output, key, changedFiles[key]) + }) + // eslint-disable-next-line unicorn/no-process-exit process.exit(0) } catch (error) { - core.error(error) - core.setFailed(error.message) + const pError = JSON.parse(error.message) + const prettyError = JSON.stringify(error.message, null, 2) + // catch error from getInputs + if (pError.from.includes(getInputs.name)) + coreError(`There was an getting action inputs.\nException: ${prettyError}`) + // catch error from inferInput + if (pError.from.includes(inferInput.name)) + coreError(`There was an issue inferring inputs to the action.\nException: ${prettyError}`) + // catch error from initClient + else if (pError.from.includes(initClient.name)) + coreError(`There was an issue initilizing the github client.\nException: ${prettyError}`) + // catch error from getChangedFiles + else if (pError.from.includes(getChangedFiles.name)) + coreError(`There was an issue getting changed files from Github.\nException: ${prettyError}`) + // catch error from sortChangedFiles + else if (pError.from.includes(sortChangedFiles.name)) + coreError(`There was an issue sorting changed files from Github.\nException: ${prettyError}`) + // catch error from writeFiles + else if (pError.from.includes(writeFiles.name)) + coreError(`There was an issue writing output files.\nException: ${prettyError}`) + // catch error from writeOutput + else if (pError.from.includes(writeOutput.name)) + coreError(`There was an issue writing output variables.\nException: ${prettyError}`) + else coreError(JSON.stringify(pError)) + coreSetFailed(error.message) } }