Skip to content

Commit

Permalink
fix: upgrade deps and fix typing issues (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisBrunner authored Oct 17, 2022
1 parent 07b20f5 commit 87e7256
Show file tree
Hide file tree
Showing 7 changed files with 4,719 additions and 11,138 deletions.
8 changes: 7 additions & 1 deletion dist/index.js

Large diffs are not rendered by default.

15,771 changes: 4,675 additions & 11,096 deletions package-lock.json

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,24 @@
"author": "Louis Brunner",
"license": "MIT",
"dependencies": {
"@actions/core": "^1.2.6",
"@actions/github": "^4.0.0",
"@octokit/rest": "^18.0.5"
"@actions/core": "^1.10.0",
"@actions/github": "^5.1.1",
"@octokit/rest": "^19.0.5"
},
"devDependencies": {
"@types/jest": "^26.0.13",
"@types/node": "^14.6.4",
"@typescript-eslint/eslint-plugin": "^4.0.1",
"@typescript-eslint/parser": "^4.0.1",
"@vercel/ncc": "^0.24.0",
"eslint": "^7.8.1",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-jest": "^24.0.0",
"eslint-plugin-prettier": "^3.1.4",
"jest": "^26.4.2",
"jest-circus": "^26.4.2",
"prettier": "^2.1.1",
"ts-jest": "^26.3.0",
"typescript": "^4.0.2"
"@types/jest": "^29.1.2",
"@types/node": "^18.11.0",
"@typescript-eslint/eslint-plugin": "^5.40.0",
"@typescript-eslint/parser": "^5.40.0",
"@vercel/ncc": "^0.34.0",
"eslint": "^8.25.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-jest": "^27.1.2",
"eslint-plugin-prettier": "^4.2.1",
"jest": "^29.2.0",
"jest-circus": "^29.2.0",
"prettier": "^2.7.1",
"ts-jest": "^29.0.3",
"typescript": "^4.8.4"
}
}
6 changes: 3 additions & 3 deletions src/checks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const createRun = async (
ownership: Ownership,
inputs: Inputs.Args,
): Promise<number> => {
const {data} = await octokit.checks.create({
const {data} = await octokit.rest.checks.create({
...ownership,
head_sha: sha,
name: name,
Expand All @@ -78,11 +78,11 @@ export const updateRun = async (
ownership: Ownership,
inputs: Inputs.Args,
): Promise<void> => {
const previous = await octokit.checks.get({
const previous = await octokit.rest.checks.get({
...ownership,
check_run_id: id,
});
await octokit.checks.update({
await octokit.rest.checks.update({
...ownership,
check_run_id: id,
...unpackInputs(previous.data.name, inputs),
Expand Down
7 changes: 4 additions & 3 deletions src/inputs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {InputOptions} from '@actions/core';
import * as GitHub from './namespaces/GitHub';
import * as Inputs from './namespaces/Inputs';
import fs from 'fs';

Expand Down Expand Up @@ -68,9 +69,9 @@ export const parseInputs = (getInput: GetInput): Inputs.Args => {
}

const output = parseJSON<Inputs.Output>(getInput, 'output');
const annotations = parseJSON<Inputs.Annotations>(getInput, 'annotations');
const images = parseJSON<Inputs.Images>(getInput, 'images');
const actions = parseJSON<Inputs.Actions>(getInput, 'actions');
const annotations = parseJSON<GitHub.Annotations>(getInput, 'annotations');
const images = parseJSON<GitHub.Images>(getInput, 'images');
const actions = parseJSON<GitHub.Actions>(getInput, 'actions');

if (!actionURL && (conclusion === Inputs.Conclusion.ActionRequired || actions)) {
throw new Error(`missing value for 'action_url'`);
Expand Down
14 changes: 12 additions & 2 deletions src/namespaces/GitHub.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
import {RestEndpointMethodTypes} from '@octokit/rest';
import {RestEndpointMethodTypes} from '@octokit/plugin-rest-endpoint-methods';
import {operations} from '@octokit/openapi-types';

// @octokit/rest > Endpoints.d.ts > PullsGetResponseData
export type PullRequest = RestEndpointMethodTypes['pulls']['get']['response']['data'];

type ChecksCreate = operations['checks/create']['requestBody']['content']['application/json'];

type Output = NonNullable<ChecksCreate['output']>;

export type Annotations = NonNullable<Output['annotations']>;

export type Images = NonNullable<Output['images']>;

export type Actions = NonNullable<ChecksCreate['actions']>;
17 changes: 1 addition & 16 deletions src/namespaces/Inputs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {RestEndpointMethodTypes} from '@octokit/rest';
import {Actions, Annotations, Images} from './GitHub';

interface ArgsBase {
repo?: string;
Expand Down Expand Up @@ -26,21 +26,6 @@ export interface ArgsUpdate extends ArgsBase {

export type Args = ArgsCreate | ArgsUpdate;

// @octokit/rest > Endpoints.d.ts > ChecksCreateParamsOutputAnnotations[]
export type Annotations = NonNullable<
NonNullable<RestEndpointMethodTypes['checks']['create']['parameters']['output']>['annotations']
>;

// @octokit/rest > Endpoints.d.ts > ChecksCreateParamsOutputImages[]
export type Images = NonNullable<
NonNullable<RestEndpointMethodTypes['checks']['create']['parameters']['output']>['images']
>;

// @octokit/rest > Endpoints.d.ts > ChecksCreateParamsActions[]
export type Actions = NonNullable<
RestEndpointMethodTypes['checks']['create']['parameters']['actions']
>;

export type Output = {
summary: string;
text_description?: string;
Expand Down

0 comments on commit 87e7256

Please sign in to comment.