Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@technote-space/github-action-version-helper",
"version": "0.5.4",
"version": "0.5.5",
"description": "Version helper for GitHub Actions.",
"keywords": [
"github",
Expand Down Expand Up @@ -35,26 +35,27 @@
},
"dependencies": {
"@actions/github": "^4.0.0",
"@technote-space/github-action-helper": "^4.2.6",
"@technote-space/github-action-log-helper": "^0.1.7"
"@octokit/openapi-types": "^2.0.0",
"@technote-space/github-action-helper": "^4.4.2",
"@technote-space/github-action-log-helper": "^0.1.9"
},
"devDependencies": {
"@commitlint/cli": "^11.0.0",
"@commitlint/config-conventional": "^11.0.0",
"@octokit/types": "^5.5.0",
"@technote-space/github-action-test-helper": "^0.6.3",
"@types/jest": "^26.0.15",
"@types/node": "^14.14.7",
"@typescript-eslint/eslint-plugin": "^4.7.0",
"@typescript-eslint/parser": "^4.7.0",
"eslint": "^7.13.0",
"husky": "^4.3.0",
"@octokit/types": "^6.1.1",
"@technote-space/github-action-test-helper": "^0.6.5",
"@types/jest": "^26.0.16",
"@types/node": "^14.14.10",
"@typescript-eslint/eslint-plugin": "^4.9.0",
"@typescript-eslint/parser": "^4.9.0",
"eslint": "^7.15.0",
"husky": "^4.3.4",
"jest": "^26.6.3",
"jest-circus": "^26.6.3",
"lint-staged": "^10.5.1",
"lint-staged": "^10.5.3",
"nock": "^13.0.5",
"ts-jest": "^26.4.4",
"typescript": "^4.0.5"
"typescript": "^4.1.2"
},
"publishConfig": {
"access": "public"
Expand Down
16 changes: 11 additions & 5 deletions src/utils/commit.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
import { Context } from '@actions/github/lib/context';
import { Octokit } from '@technote-space/github-action-helper/dist/types';
import { PullsListCommitsResponseData } from '@octokit/types/dist-types/generated/Endpoints';
import { ensureNotNull } from '@technote-space/github-action-helper/dist/utils';
import { PaginateInterface } from '@octokit/plugin-paginate-rest';
import { RestEndpointMethods } from '@octokit/plugin-rest-endpoint-methods/dist-types/generated/method-types';
import { components } from '@octokit/openapi-types';
import { parseCommitMessage } from './misc';
import { Commit, ParentCommitMessage } from '../types';
import { MERGE_MESSAGE_PATTERN } from '../constant';

const listCommits = async(octokit: Octokit, context: Context): Promise<PullsListCommitsResponseData> => octokit.paginate(
octokit.pulls.listCommits.endpoint.merge({
type PullsListCommitsResponseData = components['schemas']['commit'];

const listCommits = async(octokit: Octokit, context: Context): Promise<Array<PullsListCommitsResponseData>> => (octokit.paginate as PaginateInterface)(
(octokit as RestEndpointMethods).pulls.listCommits,
{
...context.repo,
'pull_number': context.payload.number,
}),
},
);

export const getCommits = async(types: Array<string>, excludeMessages: Array<string>, breakingChangeNotes: Array<string>, octokit: Octokit, context: Context): Promise<Array<Commit>> =>
Expand All @@ -18,7 +24,7 @@ export const getCommits = async(types: Array<string>, excludeMessages: Array<str
.map(commit => ({commit, message: parseCommitMessage(commit.commit.message, types, excludeMessages, breakingChangeNotes)}))
.filter(item => item.message)
.map(item => ({
sha: item.commit.sha,
sha: ensureNotNull(item.commit.sha),
...(item.message as ParentCommitMessage),
}));

2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
"target": "es6",
"target": "ES2019",
/* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
"module": "commonjs",
/* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
Expand Down
Loading