mirror of
https://github.com/darksaid98/auto-changelog.git
synced 2026-12-01 14:38:47 +00:00
deps(Dev): Add eslint-config-noir version 1.1.1 (#79)
* chore: Update ESLint config * deps(Dev): Add eslint-config-noir version 1.1.1 * chore: Update action directory
This commit is contained in:
1 parent
1699a856bb
commit
07ba2b1a32
12 files changed
+134
-122
No files matched your search
@@ -1,32 +0,0 @@
|
||||
{
|
||||
"env": {
|
||||
"es2020": true,
|
||||
"node": true
|
||||
},
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/recommended"
|
||||
],
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 11,
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": [
|
||||
"@typescript-eslint"
|
||||
],
|
||||
"rules": {
|
||||
"indent": [
|
||||
"error",
|
||||
2
|
||||
],
|
||||
"quotes": [
|
||||
"error",
|
||||
"double"
|
||||
],
|
||||
"semi": [
|
||||
"error",
|
||||
"always"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
env:
|
||||
es2021: true
|
||||
node: true
|
||||
extends:
|
||||
- eslint:recommended
|
||||
- noir
|
||||
- plugin:@typescript-eslint/recommended
|
||||
- noir/typescript
|
||||
parser: '@typescript-eslint/parser'
|
||||
parserOptions:
|
||||
project: ./tsconfig.json
|
||||
ecmaVersion: latest
|
||||
sourceType: module
|
||||
plugins:
|
||||
- '@typescript-eslint'
|
||||
rules: {}
|
||||
@@ -0,0 +1,2 @@
|
||||
*.ts text eol=lf
|
||||
*.js text eol=lf
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
require('./sourcemap-register.js');(()=>{var __webpack_modules__={7412:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.generate=void 0;const r=s(1912);async function generate(e){const{octokit:t,owner:s,repo:a,sha:i,tagRef:n,inputs:o}=e;const{commitTypes:p,defaultCommitType:l,mentionAuthors:d}=o;const u=`https://github.com/${s}/${a}`;const c={};e:for await(const{data:e}of t.paginate.iterator(t.rest.repos.listCommits,{per_page:100,owner:s,repo:a,sha:i})){for(const t of e){if(t.sha===n)break e;const e=t.commit.message.split("\n")[0];let{type:s,category:a,title:i,pr:o,flag:u}=r.COMMIT_REGEX.exec(e)?.groups??{};if(!i)continue;u=trim(u);if(u==="ignore")continue;s=p[trim(s)]??l;a=a?trim(a):"";i=trim(i);if(c[s]==null)c[s]={};if(c[s][a]==null)c[s][a]=[];const m=c[s][a];const h=m.find((e=>e.title===i));const g={author:d?t.author?.login:undefined,commit:t.sha,pr:o};if(h==null)m.push({title:i,references:[g]});else h.references.push(g)}}const m=unique([...Object.values(p),l]);return m.reduce(((e,t)=>{const s=c[t];if(s==null)return e;e.push(`## ${t}`);const r=Object.keys(s).sort();for(const t of r){const r=s[t];const a=t.length===0;if(!a)e.push(`* **${t}:**`);const i=a?"":" ";for(const{title:t,references:s}of r){e.push(`${i}* ${t} (${s.map((e=>`${e.pr==null?"":`${u}/pull/${e.pr} `}${u}/commit/${e.commit}${e.author==null?"":` by @${e.author}`}`)).join(", ")})`)}}e.push("");return e}),[]).join("\n")}t.generate=generate;function trim(e){if(e==null)return e;return e.trim().replace(/ {2,}/g," ")}function unique(e){return[...new Set(e)]}},1912:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.COMMIT_REGEX=void 0;t.COMMIT_REGEX=/^(?<type>[^:()]*)(?:\((?<category>[^()]*?)\)|): *(?<title>.+?) *(?:\(#(?<pr>[1-9]\d*?)\)|) *(?:\[(?<flag>[^[\]]*?)]|)\s*$/},7331:function(e,t,s){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.getInputs=t.getToken=void 0;const a=s(2186);const i=r(s(918));const n=r(s(4083));function getToken(){return(0,a.getInput)("github-token",{required:true})}t.getToken=getToken;async function getInputs(){const e=n.default.parse((0,a.getInput)("commit-types",{required:true}));const t=(0,a.getInput)("default-commit-type",{required:true});const s=(0,a.getInput)("release-name",{required:true});const r=(0,a.getBooleanInput)("mention-authors",{required:true});const o=(0,a.getBooleanInput)("mention-new-contributors",{required:true});const p=(0,a.getBooleanInput)("include-compare",{required:true});const l=(0,a.getBooleanInput)("semver",{required:true});return i.default.object().keys({commitTypes:i.default.object().pattern(i.default.string(),i.default.string()).required(),defaultCommitType:i.default.string().required(),releaseName:i.default.string().required(),mentionAuthors:i.default.boolean().required(),mentionNewContributors:i.default.boolean().required(),includeCompare:i.default.boolean().required(),semver:i.default.boolean().required()}).validateAsync({commitTypes:e,defaultCommitType:t,releaseName:s,mentionAuthors:r,mentionNewContributors:o,includeCompare:p,semver:l})}t.getInputs=getInputs},9283:function(e,t,s){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const a=s(2186);const i=s(5438);const n=s(5741);const o=r(s(1383));const p=s(9297);const l=s(7412);const d=s(7331);async function run(){const e=await(0,d.getInputs)();const t=(0,i.getOctokit)((0,d.getToken)());const{repo:{owner:s,repo:r},sha:u}=i.context;let c=null;if(e.semver){c=o.default.parse(e.releaseName,{includePrerelease:true});if(c==null)return(0,a.setFailed)(`Expected a semver compatible releaseName, got "${e.releaseName}" instead.`)}let m=false;if(c!=null)m=c.prerelease.length>0;const{sha:h,name:g}=await(0,p.getTagSha)({octokit:t,owner:s,repo:r,sha:u,semver:c,prerelease:m});let v=await(0,l.generate)({octokit:t,owner:s,repo:r,sha:u,tagRef:h,inputs:e});if(e.mentionNewContributors){const{data:a}=await t.rest.repos.generateReleaseNotes({owner:s,repo:r,tag_name:e.releaseName,previous_tag_name:g});const i=n.marked.lexer(a.body);const o=i.findIndex((e=>e.type==="heading"&&e.text==="New Contributors"));const p=i[o+1];if(p.type==="list")v+=`\n\n## New Contributors\n${p.raw}\n`}if(e.includeCompare&&g!=null){v+=`\n\n**Full Changelog**: https://github.com/${s}/${r}/compare/${g}...${e.releaseName}`}(0,a.info)(`-> prerelease: ${m}`);(0,a.setOutput)("prerelease",m);(0,a.info)(`-> changelog: "${v}"`);(0,a.setOutput)("changelog",v)}run().catch(a.setFailed)},9297:function(e,t,s){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.getTagSha=void 0;const a=r(s(1383));async function getTagSha(e){const{octokit:t,owner:s,repo:r,sha:i,semver:n,prerelease:o}=e;for await(const{data:e}of t.paginate.iterator(t.rest.repos.listTags,{per_paLine truncated
|
||||
require('./sourcemap-register.js');(()=>{var __webpack_modules__={7412:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.generate=void 0;const r=s(1912);function trim(e){if(e==null)return e;return e.trim().replace(/ {2,}/g," ")}function unique(e){return[...new Set(e)]}async function generate(e){const{octokit:t,owner:s,repo:a,sha:i,tagRef:n,inputs:o}=e;const{commitTypes:p,defaultCommitType:l,mentionAuthors:d}=o;const u=`https://github.com/${s}/${a}`;const c={};e:for await(const{data:e}of t.paginate.iterator(t.rest.repos.listCommits,{per_page:100,owner:s,repo:a,sha:i})){for(const t of e){if(t.sha===n)break e;const e=t.commit.message.split("\n")[0];let{type:s,category:a,title:i,pr:o,flag:u}=r.COMMIT_REGEX.exec(e)?.groups??{};if(!i)continue;u=trim(u);if(u==="ignore")continue;s=p[trim(s)]??l;a=a?trim(a):"";i=trim(i);let m=c[s];if(m==null)m=c[s]={};let h=m[a];if(h==null)h=m[a]=[];const g=h.find((e=>e.title===i));const v={author:d?t.author?.login:null,commit:t.sha,pr:o};if(g==null){h.push({title:i,references:[v]})}else{g.references.push(v)}}}const m=unique([...Object.values(p),l]);return m.reduce(((e,t)=>{const s=c[t];if(s==null)return e;e.push(`## ${t}`);const r=Object.keys(s).sort();for(const t of r){const r=s[t];const a=t.length===0;if(!a)e.push(`* **${t}:**`);const i=a?"":" ";for(const{title:t,references:s}of r){e.push(`${i}* ${t} (${s.map((e=>`${e.pr==null?"":`${u}/pull/${e.pr} `}${u}/commit/${e.commit}${e.author==null?"":` by @${e.author}`}`)).join(", ")})`)}}e.push("");return e}),[]).join("\n")}t.generate=generate},1912:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.COMMIT_REGEX=void 0;t.COMMIT_REGEX=/^(?<type>[^:()]*)(?:\((?<category>[^()]*?)\)|): *(?<title>.+?) *(?:\(#(?<pr>[1-9]\d*?)\)|) *(?:\[(?<flag>[^[\]]*?)]|)\s*$/},7331:function(e,t,s){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.getInputs=t.getToken=void 0;const a=r(s(918));const i=r(s(4083));const n=s(2186);function getToken(){return(0,n.getInput)("github-token",{required:true})}t.getToken=getToken;async function getInputs(){const e=i.default.parse((0,n.getInput)("commit-types",{required:true}));const t=(0,n.getInput)("default-commit-type",{required:true});const s=(0,n.getInput)("release-name",{required:true});const r=(0,n.getBooleanInput)("mention-authors",{required:true});const o=(0,n.getBooleanInput)("mention-new-contributors",{required:true});const p=(0,n.getBooleanInput)("include-compare",{required:true});const l=(0,n.getBooleanInput)("semver",{required:true});return a.default.object().keys({commitTypes:a.default.object().pattern(a.default.string(),a.default.string()).required(),defaultCommitType:a.default.string().required(),releaseName:a.default.string().required(),mentionAuthors:a.default.boolean().required(),mentionNewContributors:a.default.boolean().required(),includeCompare:a.default.boolean().required(),semver:a.default.boolean().required()}).validateAsync({commitTypes:e,defaultCommitType:t,releaseName:s,mentionAuthors:r,mentionNewContributors:o,includeCompare:p,semver:l})}t.getInputs=getInputs},9283:function(e,t,s){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const a=r(s(1383));const i=s(7412);const n=s(9297);const o=s(5741);const p=s(5438);const l=s(7331);const d=s(2186);async function run(){const e=await(0,l.getInputs)();const t=(0,p.getOctokit)((0,l.getToken)());const{repo:{owner:s,repo:r},sha:u}=p.context;let c=null;if(e.semver){c=a.default.parse(e.releaseName,{includePrerelease:true});if(c==null){(0,d.setFailed)(`Expected a semver compatible releaseName, got "${e.releaseName}" instead.`);return}}let m=false;if(c!=null)m=c.prerelease.length>0;const{sha:h,name:g}=await(0,n.getTagSha)({octokit:t,owner:s,repo:r,sha:u,semver:c,prerelease:m});let v=await(0,i.generate)({octokit:t,owner:s,repo:r,sha:u,tagRef:h,inputs:e});if(e.mentionNewContributors){const{data:a}=await t.rest.repos.generateReleaseNotes({owner:s,repo:r,tag_name:e.releaseName,previous_tag_name:g});const i=o.marked.lexer(a.body);const n=i.findIndex((e=>e.type==="heading"&&e.text==="New Contributors"));const p=i[n+1];if(p.type==="list")v+=`\n\n## New Contributors\n${p.raw}\n`}if(e.includeCompare&&g!=null)v+=`\n\n**Full Changelog**: https://github.com/${s}/${r}/compare/${g}...${e.releaseName}`;(0,d.info)(`-> prerelease: ${m}`);(0,d.setOutput)("prerelease",m);(0,d.info)(`-> changelog: "${v}"`);(0,d.setOutput)("changelog",v)}run().catch(d.setFailed)},9297:function(e,t,s){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.getTagSha=void 0;const a=r(s(1383));async function getTagSha(e){const{octokit:t,owner:s,repo:r,sha:i,semver:n,prerelease:o}=e;for await(const{data:e}of t.paginate.iterator(t.rest.repos.listTags,{per_page:1Line truncated
|
||||
/*!
|
||||
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
||||
*
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../webpack:/auto-changelog/dist/changelog.js","../webpack:/auto-changelog/dist/constants.js","../webpack:/auto-changelog/dist/context.js","../webpack:/auto-changelog/dist/index.js","../webpack:/auto-changelog/dist/tag.js","../webpack:/auto-changelog/node_modules/@actions/core/lib/command.js","../webpack:/auto-changelog/node_modules/@actions/core/lib/core.js","../webpack:/auto-changelog/node_modules/@actions/core/lib/file-command.js","../webpack:/auto-changelog/node_modules/@actions/core/lib/oidc-utils.js","../webpack:/auto-changelog/node_modules/@actions/core/lib/summary.js","../webpack:/auto-changelog/node_modules/@actions/core/lib/utils.js","../webpack:/auto-changelog/node_modules/@actions/github/lib/context.js","../webpack:/auto-changelog/node_modules/@actions/github/lib/github.js","../webpack:/auto-changelog/node_modules/@actions/github/lib/internal/utils.js","../webpack:/auto-changelog/node_modules/@actions/github/lib/utils.js","../webpack:/auto-changelog/node_modules/@actions/http-client/lib/auth.js","../webpack:/auto-changelog/node_modules/@actions/http-client/lib/index.js","../webpack:/auto-changelog/node_modules/@actions/http-client/lib/proxy.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/applyToDefaults.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/assert.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/clone.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/deepEqual.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/error.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/escapeHtml.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/escapeRegex.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/ignore.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/merge.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/reach.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/stringify.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/types.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/utils.js","../webpack:/auto-changelog/node_modules/@hapi/topo/lib/index.js","../webpack:/auto-changelog/node_modules/@octokit/auth-token/dist-node/index.js","../webpack:/auto-changelog/node_modules/@octokit/core/dist-node/index.js","../webpack:/auto-changelog/node_modules/@octokit/endpoint/dist-node/index.js","../webpack:/auto-changelog/node_modules/@octokit/graphql/dist-node/index.js","../webpack:/auto-changelog/node_modules/@octokit/plugin-paginate-rest/dist-node/index.js","../webpack:/auto-changelog/node_modules/@octokit/plugin-rest-endpoint-methods/dist-node/index.js","../webpack:/auto-changelog/node_modules/@octokit/request-error/dist-node/index.js","../webpack:/auto-changelog/node_modules/@octokit/request/dist-node/index.js","../webpack:/auto-changelog/node_modules/@sideway/address/lib/domain.js","../webpack:/auto-changelog/node_modules/@sideway/address/lib/email.js","../webpack:/auto-changelog/node_modules/@sideway/address/lib/errors.js","../webpack:/auto-changelog/node_modules/@sideway/address/lib/ip.js","../webpack:/auto-changelog/node_modules/@sideway/address/lib/tlds.js","../webpack:/auto-changelog/node_modules/@sideway/address/lib/uri.js","../webpack:/auto-changelog/node_modules/@sideway/formula/lib/index.js","../webpack:/auto-changelog/node_modules/@sideway/pinpoint/lib/index.js","../webpack:/auto-changelog/node_modules/before-after-hook/index.js","../webpack:/auto-changelog/node_modules/before-after-hook/lib/add.js","../webpack:/auto-changelog/node_modules/before-after-hook/lib/register.js","../webpack:/auto-changelog/node_modules/before-after-hook/lib/remove.js","../webpack:/auto-changelog/node_modules/deprecation/dist-node/index.js","../webpack:/auto-changelog/node_modules/is-plain-object/dist/is-plain-object.js","../webpack:/auto-changelog/node_modules/joi/lib/annotate.js","../webpack:/auto-changelog/node_modules/joi/lib/base.js","../webpack:/auto-changelog/node_modules/joi/lib/cache.js","../webpack:/auto-changelog/node_modules/joi/lib/common.js","../webpack:/auto-changelog/node_modules/joi/lib/compile.js","../webpack:/auto-changelog/node_modules/joi/lib/errors.js","../webpack:/auto-changelog/node_modules/joi/lib/extend.js","../webpack:/auto-changelog/node_modules/joi/lib/index.js","../webpack:/auto-changelog/node_modules/joi/lib/manifest.js","../webpack:/auto-changelog/node_modules/joi/lib/messages.js","../webpack:/auto-changelog/node_modules/joi/lib/modify.js","../webpack:/auto-changelog/node_modules/joi/lib/ref.js","../webpack:/auto-changelog/node_modules/joi/lib/schemas.js","../webpack:/auto-changelog/node_modules/joi/lib/state.js","../webpack:/auto-changelog/node_modules/joi/lib/template.js","../webpack:/auto-changelog/node_modules/joi/lib/trace.js","../webpack:/auto-changelog/node_modules/joi/lib/types/alternatives.js","../webpack:/auto-changelog/node_modules/joi/lib/types/any.js","../webpack:/auto-changelog/node_modules/joi/lib/types/array.js","Line truncated
|
||||
{"version":3,"sources":["../webpack:/auto-changelog/dist/changelog.js","../webpack:/auto-changelog/dist/constants.js","../webpack:/auto-changelog/dist/context.js","../webpack:/auto-changelog/dist/index.js","../webpack:/auto-changelog/dist/tag.js","../webpack:/auto-changelog/node_modules/@actions/core/lib/command.js","../webpack:/auto-changelog/node_modules/@actions/core/lib/core.js","../webpack:/auto-changelog/node_modules/@actions/core/lib/file-command.js","../webpack:/auto-changelog/node_modules/@actions/core/lib/oidc-utils.js","../webpack:/auto-changelog/node_modules/@actions/core/lib/summary.js","../webpack:/auto-changelog/node_modules/@actions/core/lib/utils.js","../webpack:/auto-changelog/node_modules/@actions/github/lib/context.js","../webpack:/auto-changelog/node_modules/@actions/github/lib/github.js","../webpack:/auto-changelog/node_modules/@actions/github/lib/internal/utils.js","../webpack:/auto-changelog/node_modules/@actions/github/lib/utils.js","../webpack:/auto-changelog/node_modules/@actions/http-client/lib/auth.js","../webpack:/auto-changelog/node_modules/@actions/http-client/lib/index.js","../webpack:/auto-changelog/node_modules/@actions/http-client/lib/proxy.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/applyToDefaults.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/assert.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/clone.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/deepEqual.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/error.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/escapeHtml.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/escapeRegex.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/ignore.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/merge.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/reach.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/stringify.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/types.js","../webpack:/auto-changelog/node_modules/@hapi/hoek/lib/utils.js","../webpack:/auto-changelog/node_modules/@hapi/topo/lib/index.js","../webpack:/auto-changelog/node_modules/@octokit/auth-token/dist-node/index.js","../webpack:/auto-changelog/node_modules/@octokit/core/dist-node/index.js","../webpack:/auto-changelog/node_modules/@octokit/endpoint/dist-node/index.js","../webpack:/auto-changelog/node_modules/@octokit/graphql/dist-node/index.js","../webpack:/auto-changelog/node_modules/@octokit/plugin-paginate-rest/dist-node/index.js","../webpack:/auto-changelog/node_modules/@octokit/plugin-rest-endpoint-methods/dist-node/index.js","../webpack:/auto-changelog/node_modules/@octokit/request-error/dist-node/index.js","../webpack:/auto-changelog/node_modules/@octokit/request/dist-node/index.js","../webpack:/auto-changelog/node_modules/@sideway/address/lib/domain.js","../webpack:/auto-changelog/node_modules/@sideway/address/lib/email.js","../webpack:/auto-changelog/node_modules/@sideway/address/lib/errors.js","../webpack:/auto-changelog/node_modules/@sideway/address/lib/ip.js","../webpack:/auto-changelog/node_modules/@sideway/address/lib/tlds.js","../webpack:/auto-changelog/node_modules/@sideway/address/lib/uri.js","../webpack:/auto-changelog/node_modules/@sideway/formula/lib/index.js","../webpack:/auto-changelog/node_modules/@sideway/pinpoint/lib/index.js","../webpack:/auto-changelog/node_modules/before-after-hook/index.js","../webpack:/auto-changelog/node_modules/before-after-hook/lib/add.js","../webpack:/auto-changelog/node_modules/before-after-hook/lib/register.js","../webpack:/auto-changelog/node_modules/before-after-hook/lib/remove.js","../webpack:/auto-changelog/node_modules/deprecation/dist-node/index.js","../webpack:/auto-changelog/node_modules/is-plain-object/dist/is-plain-object.js","../webpack:/auto-changelog/node_modules/joi/lib/annotate.js","../webpack:/auto-changelog/node_modules/joi/lib/base.js","../webpack:/auto-changelog/node_modules/joi/lib/cache.js","../webpack:/auto-changelog/node_modules/joi/lib/common.js","../webpack:/auto-changelog/node_modules/joi/lib/compile.js","../webpack:/auto-changelog/node_modules/joi/lib/errors.js","../webpack:/auto-changelog/node_modules/joi/lib/extend.js","../webpack:/auto-changelog/node_modules/joi/lib/index.js","../webpack:/auto-changelog/node_modules/joi/lib/manifest.js","../webpack:/auto-changelog/node_modules/joi/lib/messages.js","../webpack:/auto-changelog/node_modules/joi/lib/modify.js","../webpack:/auto-changelog/node_modules/joi/lib/ref.js","../webpack:/auto-changelog/node_modules/joi/lib/schemas.js","../webpack:/auto-changelog/node_modules/joi/lib/state.js","../webpack:/auto-changelog/node_modules/joi/lib/template.js","../webpack:/auto-changelog/node_modules/joi/lib/trace.js","../webpack:/auto-changelog/node_modules/joi/lib/types/alternatives.js","../webpack:/auto-changelog/node_modules/joi/lib/types/any.js","../webpack:/auto-changelog/node_modules/joi/lib/types/array.js","Line truncated
|
||||
Generated
+23
@@ -23,6 +23,7 @@
|
||||
"@typescript-eslint/parser": "^5.27.1",
|
||||
"@vercel/ncc": "^0.34.0",
|
||||
"eslint": "^8.17.0",
|
||||
"eslint-config-noir": "^1.1.1",
|
||||
"prettier": "^2.6.2",
|
||||
"typescript": "^4.7.3"
|
||||
}
|
||||
@@ -760,6 +761,21 @@
|
||||
"url": "https://opencollective.com/eslint"
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-config-noir": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-config-noir/-/eslint-config-noir-1.1.1.tgz",
|
||||
"integrity": "sha512-/y23eiTc4RYpSXVhYoX67Bm15z66NxYmNGmXXe2LrP8CeQJ/xaAZzVQwv+Hln39mkIUHlMgECljokAUh/mlaCw==",
|
||||
"dev": true,
|
||||
"peerDependencies": {
|
||||
"@typescript-eslint/eslint-plugin": ">=5.27.1",
|
||||
"eslint": ">=8.17.0"
|
||||
},
|
||||
"peerDependenciesMeta": {
|
||||
"@typescript-eslint/eslint-plugin": {
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/eslint-scope": {
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",
|
||||
@@ -2339,6 +2355,13 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"eslint-config-noir": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-config-noir/-/eslint-config-noir-1.1.1.tgz",
|
||||
"integrity": "sha512-/y23eiTc4RYpSXVhYoX67Bm15z66NxYmNGmXXe2LrP8CeQJ/xaAZzVQwv+Hln39mkIUHlMgECljokAUh/mlaCw==",
|
||||
"dev": true,
|
||||
"requires": {}
|
||||
},
|
||||
"eslint-scope": {
|
||||
"version": "5.1.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz",
|
||||
|
||||
+2
-1
@@ -29,7 +29,7 @@
|
||||
"build": "tsc",
|
||||
"build:watch": "npm run build -- --watch",
|
||||
"package": "ncc build --out action --minify --source-map --license licenses.txt",
|
||||
"all": "npm run lint:format && npm run lint:fix && npm run build && npm run package",
|
||||
"all": "npm run lint:fix && npm run build && npm run package",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"dependencies": {
|
||||
@@ -47,6 +47,7 @@
|
||||
"@typescript-eslint/parser": "^5.27.1",
|
||||
"@vercel/ncc": "^0.34.0",
|
||||
"eslint": "^8.17.0",
|
||||
"eslint-config-noir": "^1.1.1",
|
||||
"prettier": "^2.6.2",
|
||||
"typescript": "^4.7.3"
|
||||
}
|
||||
|
||||
+41
-37
@@ -1,10 +1,21 @@
|
||||
import { ChangelogInputI, COMMIT_REGEX, LogsI, ReferenceI } from "./constants";
|
||||
import { COMMIT_REGEX, ChangelogInputI, LogsI, ReferenceI } from "./constants";
|
||||
|
||||
function trim(value: string): string {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
if (value == null) return value;
|
||||
|
||||
return value.trim().replace(/ {2,}/g, " ");
|
||||
}
|
||||
|
||||
function unique(value: string[]): string[] {
|
||||
return [...new Set(value)];
|
||||
}
|
||||
|
||||
export async function generate(input: ChangelogInputI): Promise<string> {
|
||||
const { octokit, owner, repo, sha, tagRef, inputs } = input;
|
||||
const { commitTypes, defaultCommitType, mentionAuthors } = inputs;
|
||||
|
||||
const repoUrl = `https://github.com/${owner}/${repo}`;
|
||||
const repoUrl = `https://github.com/${ owner }/${ repo }`;
|
||||
const commits: LogsI = {};
|
||||
|
||||
paginator: for await (const { data } of octokit.paginate.iterator(
|
||||
@@ -21,9 +32,7 @@ export async function generate(input: ChangelogInputI): Promise<string> {
|
||||
|
||||
const message = commit.commit.message.split("\n")[0];
|
||||
|
||||
// eslint-disable-next-line prefer-const
|
||||
let { type, category, title, pr, flag } =
|
||||
COMMIT_REGEX.exec(message)?.groups ?? {};
|
||||
let { type, category, title, pr, flag } = COMMIT_REGEX.exec(message)?.groups ?? {};
|
||||
|
||||
if (!title) continue;
|
||||
|
||||
@@ -31,28 +40,37 @@ export async function generate(input: ChangelogInputI): Promise<string> {
|
||||
|
||||
if (flag === "ignore") continue;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
type = commitTypes[trim(type)] ?? defaultCommitType;
|
||||
|
||||
category = category ? trim(category) : "";
|
||||
|
||||
title = trim(title);
|
||||
|
||||
if (commits[type] == null) commits[type] = {};
|
||||
let types = commits[type];
|
||||
|
||||
if (commits[type][category] == null) commits[type][category] = [];
|
||||
if (types == null) types = commits[type] = {};
|
||||
|
||||
const logs = commits[type][category];
|
||||
let logs = types[category];
|
||||
|
||||
const existingCommit = logs.find((commit) => commit.title === title);
|
||||
if (logs == null) logs = types[category] = [];
|
||||
|
||||
const existingCommit = logs.find(log => log.title === title);
|
||||
|
||||
const reference: ReferenceI = {
|
||||
author: mentionAuthors ? commit.author?.login : undefined,
|
||||
author: mentionAuthors ? commit.author?.login : null,
|
||||
commit: commit.sha,
|
||||
pr,
|
||||
};
|
||||
|
||||
if (existingCommit == null) logs.push({ title, references: [reference] });
|
||||
else existingCommit.references.push(reference);
|
||||
if (existingCommit == null) {
|
||||
logs.push({
|
||||
title,
|
||||
references: [reference],
|
||||
});
|
||||
} else {
|
||||
existingCommit.references.push(reference);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,31 +81,27 @@ export async function generate(input: ChangelogInputI): Promise<string> {
|
||||
|
||||
if (typeGroup == null) return changelog;
|
||||
|
||||
changelog.push(`## ${type}`);
|
||||
changelog.push(`## ${ type }`);
|
||||
|
||||
const categories = Object.keys(typeGroup).sort();
|
||||
|
||||
for (const category of categories) {
|
||||
const categoryGroup = typeGroup[category];
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
const categoryGroup = typeGroup[category]!;
|
||||
const defaultCategory = category.length === 0;
|
||||
|
||||
if (!defaultCategory) changelog.push(`* **${category}:**`);
|
||||
if (!defaultCategory) changelog.push(`* **${ category }:**`);
|
||||
|
||||
const baseLine = defaultCategory ? "" : " ";
|
||||
|
||||
for (const { title, references } of categoryGroup) {
|
||||
changelog.push(
|
||||
`${baseLine}* ${title} (${references
|
||||
.map(
|
||||
(reference) =>
|
||||
`${
|
||||
reference.pr == null ? "" : `${repoUrl}/pull/${reference.pr} `
|
||||
}${repoUrl}/commit/${reference.commit}${
|
||||
reference.author == null ? "" : ` by @${reference.author}`
|
||||
}`,
|
||||
)
|
||||
.join(", ")})`,
|
||||
);
|
||||
changelog.push(`${ baseLine }* ${ title } (${ references
|
||||
.map(reference => `${
|
||||
reference.pr == null ? "" : `${ repoUrl }/pull/${ reference.pr } `
|
||||
}${ repoUrl }/commit/${ reference.commit }${
|
||||
reference.author == null ? "" : ` by @${ reference.author }`
|
||||
}`)
|
||||
.join(", ") })`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,13 +110,3 @@ export async function generate(input: ChangelogInputI): Promise<string> {
|
||||
return changelog;
|
||||
}, []).join("\n");
|
||||
}
|
||||
|
||||
function trim(value: string): string {
|
||||
if (value == null) return value;
|
||||
|
||||
return value.trim().replace(/ {2,}/g, " ");
|
||||
}
|
||||
|
||||
function unique(value: string[]): string[] {
|
||||
return [...new Set(value)];
|
||||
}
|
||||
+15
-21
@@ -1,26 +1,20 @@
|
||||
import type { GitHub } from "@actions/github/lib/utils";
|
||||
import type { SemVer } from "semver";
|
||||
import { GitHub } from "@actions/github/lib/utils";
|
||||
import { SemVer } from "semver";
|
||||
|
||||
export const COMMIT_REGEX =
|
||||
/^(?<type>[^:()]*)(?:\((?<category>[^()]*?)\)|): *(?<title>.+?) *(?:\(#(?<pr>[1-9]\d*?)\)|) *(?:\[(?<flag>[^[\]]*?)]|)\s*$/;
|
||||
export const COMMIT_REGEX
|
||||
= /^(?<type>[^:()]*)(?:\((?<category>[^()]*?)\)|): *(?<title>.+?) *(?:\(#(?<pr>[1-9]\d*?)\)|) *(?:\[(?<flag>[^[\]]*?)]|)\s*$/;
|
||||
|
||||
export interface TypesI {
|
||||
[type: string]: string;
|
||||
}
|
||||
export type TypesI = Record<string, string>;
|
||||
|
||||
export interface LogsI {
|
||||
[type: string]: {
|
||||
[category: string]: LogI[];
|
||||
};
|
||||
}
|
||||
export type LogsI = Record<string, Record<string, LogI[] | undefined> | undefined>;
|
||||
|
||||
export interface LogI {
|
||||
title: string;
|
||||
references: ReferenceI[];
|
||||
title: string;
|
||||
}
|
||||
|
||||
export interface ReferenceI {
|
||||
author?: string;
|
||||
author?: string | null;
|
||||
commit: string;
|
||||
pr?: string;
|
||||
}
|
||||
@@ -28,32 +22,32 @@ export interface ReferenceI {
|
||||
export interface TagInputI {
|
||||
octokit: InstanceType<typeof GitHub>;
|
||||
owner: string;
|
||||
repo: string;
|
||||
sha: string;
|
||||
semver: SemVer | null;
|
||||
prerelease: boolean;
|
||||
repo: string;
|
||||
semver: SemVer | null;
|
||||
sha: string;
|
||||
}
|
||||
|
||||
export interface TagResultI {
|
||||
sha?: string;
|
||||
name?: string;
|
||||
sha?: string;
|
||||
}
|
||||
|
||||
export interface ChangelogInputI {
|
||||
inputs: ActionInputsI;
|
||||
octokit: InstanceType<typeof GitHub>;
|
||||
owner: string;
|
||||
repo: string;
|
||||
sha: string;
|
||||
tagRef?: string;
|
||||
inputs: ActionInputsI;
|
||||
}
|
||||
|
||||
export interface ActionInputsI {
|
||||
commitTypes: TypesI;
|
||||
defaultCommitType: string;
|
||||
releaseName: string;
|
||||
includeCompare: boolean;
|
||||
mentionAuthors: boolean;
|
||||
mentionNewContributors: boolean;
|
||||
includeCompare: boolean;
|
||||
releaseName: string;
|
||||
semver: boolean;
|
||||
}
|
||||
+6
-6
@@ -1,7 +1,7 @@
|
||||
import { getInput, getBooleanInput } from "@actions/core";
|
||||
import Joi from "joi";
|
||||
import YAML from "yaml";
|
||||
import { ActionInputsI, TypesI } from "./constants";
|
||||
import { getBooleanInput, getInput } from "@actions/core";
|
||||
|
||||
export function getToken(): string {
|
||||
return getInput("github-token", { required: true });
|
||||
@@ -23,12 +23,12 @@ export async function getInputs(): Promise<ActionInputsI> {
|
||||
commitTypes: Joi.object<TypesI>()
|
||||
.pattern(Joi.string(), Joi.string())
|
||||
.required(),
|
||||
defaultCommitType: Joi.string().required(),
|
||||
releaseName: Joi.string().required(),
|
||||
mentionAuthors: Joi.boolean().required(),
|
||||
defaultCommitType : Joi.string().required(),
|
||||
releaseName : Joi.string().required(),
|
||||
mentionAuthors : Joi.boolean().required(),
|
||||
mentionNewContributors: Joi.boolean().required(),
|
||||
includeCompare: Joi.boolean().required(),
|
||||
semver: Joi.boolean().required(),
|
||||
includeCompare : Joi.boolean().required(),
|
||||
semver : Joi.boolean().required(),
|
||||
})
|
||||
.validateAsync({
|
||||
commitTypes,
|
||||
|
||||
+16
-20
@@ -1,12 +1,12 @@
|
||||
import { info, setFailed, setOutput } from "@actions/core";
|
||||
import { context, getOctokit } from "@actions/github";
|
||||
import { marked } from "marked";
|
||||
import SemVer from "semver";
|
||||
import { getTagSha } from "./tag.js";
|
||||
import { generate } from "./changelog.js";
|
||||
import { getTagSha } from "./tag.js";
|
||||
import { marked } from "marked";
|
||||
import { context, getOctokit } from "@actions/github";
|
||||
import { getInputs, getToken } from "./context.js";
|
||||
import { info, setFailed, setOutput } from "@actions/core";
|
||||
|
||||
async function run() {
|
||||
async function run(): Promise<void> {
|
||||
const inputs = await getInputs();
|
||||
|
||||
const octokit = getOctokit(getToken());
|
||||
@@ -21,10 +21,11 @@ async function run() {
|
||||
if (inputs.semver) {
|
||||
semver = SemVer.parse(inputs.releaseName, { includePrerelease: true });
|
||||
|
||||
if (semver == null)
|
||||
return setFailed(
|
||||
`Expected a semver compatible releaseName, got "${inputs.releaseName}" instead.`,
|
||||
);
|
||||
if (semver == null) {
|
||||
setFailed(`Expected a semver compatible releaseName, got "${ inputs.releaseName }" instead.`);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
let prerelease = false;
|
||||
@@ -53,31 +54,26 @@ async function run() {
|
||||
const { data } = await octokit.rest.repos.generateReleaseNotes({
|
||||
owner,
|
||||
repo,
|
||||
tag_name: inputs.releaseName,
|
||||
tag_name : inputs.releaseName,
|
||||
previous_tag_name: tagName,
|
||||
});
|
||||
|
||||
const tokens = marked.lexer(data.body);
|
||||
|
||||
const index = tokens.findIndex(
|
||||
(token) => token.type === "heading" && token.text === "New Contributors",
|
||||
);
|
||||
const index = tokens.findIndex(token => token.type === "heading" && token.text === "New Contributors");
|
||||
|
||||
const token = tokens[index + 1];
|
||||
|
||||
if (token.type === "list")
|
||||
changelog += `\n\n## New Contributors\n${token.raw}\n`;
|
||||
if (token.type === "list") changelog += `\n\n## New Contributors\n${ token.raw }\n`;
|
||||
}
|
||||
|
||||
if (inputs.includeCompare && tagName != null) {
|
||||
changelog += `\n\n**Full Changelog**: https://github.com/${owner}/${repo}/compare/${tagName}...${inputs.releaseName}`;
|
||||
}
|
||||
if (inputs.includeCompare && tagName != null) changelog += `\n\n**Full Changelog**: https://github.com/${ owner }/${ repo }/compare/${ tagName }...${ inputs.releaseName }`;
|
||||
|
||||
info(`-> prerelease: ${prerelease}`);
|
||||
info(`-> prerelease: ${ prerelease }`);
|
||||
|
||||
setOutput("prerelease", prerelease);
|
||||
|
||||
info(`-> changelog: "${changelog}"`);
|
||||
info(`-> changelog: "${ changelog }"`);
|
||||
|
||||
setOutput("changelog", changelog);
|
||||
}
|
||||
|
||||
+11
-3
@@ -1,5 +1,5 @@
|
||||
import SemVer from "semver";
|
||||
import type { TagInputI, TagResultI } from "./constants.js";
|
||||
import { TagInputI, TagResultI } from "./constants.js";
|
||||
|
||||
export async function getTagSha(input: TagInputI): Promise<TagResultI> {
|
||||
const { octokit, owner, repo, sha, semver, prerelease } = input;
|
||||
@@ -18,7 +18,12 @@ export async function getTagSha(input: TagInputI): Promise<TagResultI> {
|
||||
} of data) {
|
||||
if (sha === tagSha) continue;
|
||||
|
||||
if (semver == null) return { sha: tagSha, name };
|
||||
if (semver == null) {
|
||||
return {
|
||||
sha: tagSha,
|
||||
name,
|
||||
};
|
||||
}
|
||||
|
||||
const tagSemver = SemVer.parse(name, { includePrerelease: true });
|
||||
|
||||
@@ -26,7 +31,10 @@ export async function getTagSha(input: TagInputI): Promise<TagResultI> {
|
||||
|
||||
if (tagSemver.prerelease.length > 0 && !prerelease) continue;
|
||||
|
||||
return { sha: tagSha, name };
|
||||
return {
|
||||
sha: tagSha,
|
||||
name,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user