advanced-commit-linter
Advanced tools
Comparing version 2.0.1 to 2.1.0
@@ -0,3 +1,4 @@ | ||
import { debug, getInput } from '@actions/core'; | ||
import { context } from '@actions/github'; | ||
import { configSchema } from './schema/config'; | ||
import { context } from '@actions/github'; | ||
export class Config { | ||
@@ -20,3 +21,5 @@ constructor(config) { | ||
static async getConfig(octokit) { | ||
const retrievedConfig = await octokit.config.get(Object.assign(Object.assign({}, context.repo), { path: 'advanced-commit-linter.yml' })); | ||
const path = getInput('config-path', { required: true }); | ||
const retrievedConfig = (await octokit.config.get(Object.assign(Object.assign({}, context.repo), { path }))).config; | ||
debug(`Configuration '${path}': ${JSON.stringify(retrievedConfig)}`); | ||
if (Config.isConfigEmpty(retrievedConfig)) { | ||
@@ -23,0 +26,0 @@ throw new Error(`Missing configuration. Please setup 'Advanced Commit Linter' Action using 'advanced-commit-linter.yml' file.`); |
@@ -61,3 +61,3 @@ import { TrackerValidator } from './tracker-validator'; | ||
generalTracker(commitsMetadata) { | ||
var _a, _b; | ||
var _a, _b, _c, _d; | ||
if (this.config.isTrackerPolicyEmpty()) | ||
@@ -104,3 +104,9 @@ return undefined; | ||
} | ||
return Object.assign(Object.assign({}, tracker), { id: (_a = prUniqueTracker[0].data) === null || _a === void 0 ? void 0 : _a.id, url: (_b = prUniqueTracker[0].data) === null || _b === void 0 ? void 0 : _b.url, message: 'Tracker found', exception: prUniqueTracker[0].exception }); | ||
return { | ||
id: (_a = prUniqueTracker[0].data) === null || _a === void 0 ? void 0 : _a.id, | ||
type: (_c = (_b = prUniqueTracker[0].data) === null || _b === void 0 ? void 0 : _b.type) !== null && _c !== void 0 ? _c : 'unknown', | ||
url: (_d = prUniqueTracker[0].data) === null || _d === void 0 ? void 0 : _d.url, | ||
message: 'Tracker found', | ||
exception: prUniqueTracker[0].exception, | ||
}; | ||
} | ||
@@ -107,0 +113,0 @@ overallMessage(tracker, commitsMetadata) { |
{ | ||
"name": "advanced-commit-linter", | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"description": "Lint commit messages based on policy", | ||
@@ -32,2 +32,3 @@ "main": "src/main.ts", | ||
"@actions/github": "^5.1.1", | ||
"@octokit/core": "^4.2.1", | ||
"@probot/octokit-plugin-config": "^1.1.6", | ||
@@ -38,3 +39,3 @@ "issue-metadata": "^0.1.6", | ||
"devDependencies": { | ||
"@octokit/types": "^9.3.1", | ||
"@octokit/types": "^10.0.0", | ||
"@total-typescript/ts-reset": "^0.4.0", | ||
@@ -52,4 +53,4 @@ "@types/node": "18.16.18", | ||
"typescript": "^5.0.0", | ||
"vitest": "0.32.0" | ||
"vitest": "0.32.2" | ||
} | ||
} |
@@ -180,2 +180,3 @@ <!-- markdownlint-disable MD033 MD041 --> | ||
pr-metadata: <pr-metadata.json> | ||
config-path: <path to config file> | ||
token: <GitHub token or PAT> | ||
@@ -195,2 +196,9 @@ | ||
### config-path | ||
Path to configuration file. Configuration file format is described in: [Policy section](#policy). | ||
* default value: `.github/advanced-commit-linter.yml` | ||
* requirements: `optional` | ||
### token | ||
@@ -197,0 +205,0 @@ |
@@ -0,4 +1,6 @@ | ||
import { debug, getInput } from '@actions/core'; | ||
import { context } from '@actions/github'; | ||
import { CustomOctokit } from './octokit'; | ||
import { configSchema, ConfigPolicy } from './schema/config'; | ||
import { context } from '@actions/github'; | ||
@@ -29,7 +31,10 @@ export class Config { | ||
static async getConfig(octokit: CustomOctokit): Promise<Config> { | ||
const retrievedConfig = await octokit.config.get({ | ||
...context.repo, | ||
path: 'advanced-commit-linter.yml', | ||
}); | ||
const path = getInput('config-path', { required: true }); | ||
const retrievedConfig = ( | ||
await octokit.config.get({ ...context.repo, path }) | ||
).config; | ||
debug(`Configuration '${path}': ${JSON.stringify(retrievedConfig)}`); | ||
if (Config.isConfigEmpty(retrievedConfig)) { | ||
@@ -36,0 +41,0 @@ throw new Error( |
@@ -172,4 +172,4 @@ import { | ||
return { | ||
...tracker, | ||
id: prUniqueTracker[0].data?.id, | ||
type: prUniqueTracker[0].data?.type ?? 'unknown', | ||
url: prUniqueTracker[0].data?.url, | ||
@@ -176,0 +176,0 @@ message: 'Tracker found', |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
3216958
27714
318
6
+ Added@octokit/core@^4.2.1
+ Added@octokit/auth-token@3.0.4(transitive)
+ Added@octokit/core@4.2.4(transitive)
+ Added@octokit/endpoint@7.0.6(transitive)
+ Added@octokit/graphql@5.0.6(transitive)
+ Added@octokit/openapi-types@18.1.1(transitive)
+ Added@octokit/request@6.2.8(transitive)
+ Added@octokit/request-error@3.0.3(transitive)
+ Added@octokit/types@9.3.2(transitive)