feat: Include new contributors in the changelog (#49)

* feat: Add mention-new-contributors input

* deps: Add marked version 4.0.14

* feat: Include new contributors in the changelog

* revert: Test workflow changes
This commit is contained in:
Ardalan Amini authored and GitHub committed 2022-04-29 11:18:38 +04:30
1 parent 49a93eccf5
commit a3982c4b9b
11 files changed
+130 -4

No files matched your search

+2 -1
View File
@@ -67,5 +67,6 @@ jobs:
commit-types: |
feat: Feature
default-commit-type: Default Type
include-compare-link: false
mention-new-contributors: false
include-compare: false
semver: false
+13
View File
@@ -12,6 +12,7 @@ Automatic Changelog generator
- [Commit Types](#commit-types)
- [Default Commit Type](#default-commit-type)
- [Release Name](#release-name)
- [Mention New Contributors](#mention-new-contributors)
- [Include GitHub Compare](#include-compare)
- [SemVer Compatibility](#semver)
- [Outputs](#outputs)
@@ -108,6 +109,18 @@ _Default:_
${{ github.ref_name }}
```
#### `mention-new-contributors`
**(Optional)**
Mention new contributors at the bottom of the changelog (New Contributors).
_Default:_
```yaml
true
```
#### `include-compare`
**(Optional)**
+5
View File
@@ -44,6 +44,11 @@ inputs:
required: true
default: ${{ github.ref_name }}
mention-new-contributors:
description: Mention new contributors at the bottom of the changelog (New Contributors)
required: true
default: 'true'
include-compare:
description: Include GitHub compare at the bottom of the changelog (Full Changelog)
required: true
+2 -2
View File
@@ -1,8 +1,8 @@
require('./sourcemap-register.js');(()=>{var __webpack_modules__={7412:(e,t,s)=>{"use strict";Object.defineProperty(t,"__esModule",{value:true});t.generate=void 0;const a=s(1912);async function generate(e){const{octokit:t,owner:s,repo:r,sha:i,tagRef:n,inputs:o}=e;const{commitTypes:p,defaultCommitType:l}=o;const d=`https://github.com/${s}/${r}`;const c={};e:for await(const{data:e}of t.paginate.iterator(t.rest.repos.listCommits,{per_page:100,owner:s,repo:r,sha:i})){for(const{sha:t,...s}of e){if(t===n)break e;const e=s.commit.message.split("\n")[0];let{type:r,category:i,title:o,flag:m}=a.COMMIT_REGEX.exec(e)?.groups??{};if(!o)continue;m=trim(m);if(m==="ignore")continue;r=trim(r);r=p[r]??l;i=i?trim(i):"";o=trim(o).replace(a.PR_REGEX,((e,t)=>`[${e}](${d}/pull/${t})`));c[r]=c[r]??{};c[r][i]=c[r][i]??[];const u=c[r][i].findIndex((e=>e.title===o));if(u===-1)c[r][i].push({title:o,commits:[t]});else c[r][i][u].commits.push(t)}}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 a=Object.keys(s).sort();for(const t of a){const a=s[t];const r=t.length===0;if(!r)e.push(`* **${t}:**`);const i=r?"":" ";for(const{title:t,commits:s}of a){e.push(`${i}* ${t} (${s.map((e=>`[${e.slice(0,8)}](${d}/commit/${e})`)).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.PR_REGEX=t.COMMIT_REGEX=void 0;t.COMMIT_REGEX=/^(?<type>[^)]*)(?:\((?<category>[^)]*?)\)|):(?<title>.*?)(?:\[(?<flag>[^\]]+?)\]|)\s*$/;t.PR_REGEX=/#([1-9]\d*)/g},7331:function(e,t,s){"use strict";var a=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 r=s(2186);const i=a(s(918));const n=a(s(4083));function getToken(){return(0,r.getInput)("github-token",{required:true})}t.getToken=getToken;async function getInputs(){const e=n.default.parse((0,r.getInput)("commit-types",{required:true}));const t=(0,r.getInput)("default-commit-type",{required:true});const s=(0,r.getInput)("release-name",{required:true});const a=(0,r.getBooleanInput)("include-compare",{required:true});const o=(0,r.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(),includeCompare:i.default.boolean().required(),semver:i.default.boolean().required()}).validateAsync({commitTypes:e,defaultCommitType:t,releaseName:s,includeCompare:a,semver:o})}t.getInputs=getInputs},9283:function(e,t,s){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});const r=s(2186);const i=s(5438);const n=a(s(1383));const o=s(9297);const p=s(7412);const l=s(7331);async function run(){const e=await(0,l.getInputs)();const t=(0,i.getOctokit)((0,l.getToken)());const{repo:{owner:s,repo:a},sha:d}=i.context;let c=null;if(e.semver){c=n.default.parse(e.releaseName,{includePrerelease:true});if(c==null)return(0,r.setFailed)(`Expected a semver compatible releaseName, got "${e.releaseName}" instead.`)}let m=false;if(c!=null)m=c.prerelease.length>0;const{sha:u,name:h}=await(0,o.getTagSha)({octokit:t,owner:s,repo:a,sha:d,semver:c,prerelease:m});let g=await(0,p.generate)({octokit:t,owner:s,repo:a,sha:d,tagRef:u,inputs:e});if(e.includeCompare&&h!=null){g+=`\n\n**Full Changelog**: https://github.com/${s}/${a}/compare/${h}...${e.releaseName}`}(0,r.info)(`-> prerelease: ${m}`);(0,r.setOutput)("prerelease",m);(0,r.info)(`-> changelog: "${g}"`);(0,r.setOutput)("changelog",g)}run().catch(r.setFailed)},9297:function(e,t,s){"use strict";var a=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:true});t.getTagSha=void 0;const r=a(s(1383));async function getTagSha(e){const{octokit:t,owner:s,repo:a,sha:i,semver:n,prerelease:o}=e;for await(const{data:e}of t.paginate.iterator(t.rest.repos.listTags,{per_page:100,owner:s,repo:a})){for(const{name:t,commit:{sha:s}}of e){if(i===s)continue;if(n==null)return{sha:s,name:t};const e=r.default.parse(t,{includePrerelease:true});if(e==null||n.compare(e)<=0)continue;if(e.prerelease.length>0&&!o)continue;return{sha:s,name:t}}}return{}}t.getTagSha=getTagSha},7351:function(e,t,s){"use strict";var a=this&&this.__createBinding||(Object.create?function(e,t,s,a){if(a===undefined)a=s;Object.defineProperty(e,a,{enumerable:true,get:function(){return t[s]}})}:function(e,t,s,a){if(a===undefined)a=s;e[a]=t[s]});var r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:true,value:t})}:function(e,t){e["default"]=t});var i=this&&this.__impLine 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);async function generate(e){const{octokit:t,owner:s,repo:a,sha:i,tagRef:n,inputs:o}=e;const{commitTypes:p,defaultCommitType:l}=o;const d=`https://github.com/${s}/${a}`;const u={};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{sha:t,...s}of e){if(t===n)break e;const e=s.commit.message.split("\n")[0];let{type:a,category:i,title:o,flag:c}=r.COMMIT_REGEX.exec(e)?.groups??{};if(!o)continue;c=trim(c);if(c==="ignore")continue;a=trim(a);a=p[a]??l;i=i?trim(i):"";o=trim(o).replace(r.PR_REGEX,((e,t)=>`[${e}](${d}/pull/${t})`));u[a]=u[a]??{};u[a][i]=u[a][i]??[];const m=u[a][i].findIndex((e=>e.title===o));if(m===-1)u[a][i].push({title:o,commits:[t]});else u[a][i][m].commits.push(t)}}const c=unique([...Object.values(p),l]);return c.reduce(((e,t)=>{const s=u[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,commits:s}of r){e.push(`${i}* ${t} (${s.map((e=>`[${e.slice(0,8)}](${d}/commit/${e})`)).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.PR_REGEX=t.COMMIT_REGEX=void 0;t.COMMIT_REGEX=/^(?<type>[^)]*)(?:\((?<category>[^)]*?)\)|):(?<title>.*?)(?:\[(?<flag>[^\]]+?)\]|)\s*$/;t.PR_REGEX=/#([1-9]\d*)/g},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-new-contributors",{required:true});const o=(0,a.getBooleanInput)("include-compare",{required:true});const p=(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(),mentionNewContributors:i.default.boolean().required(),includeCompare:i.default.boolean().required(),semver:i.default.boolean().required()}).validateAsync({commitTypes:e,defaultCommitType:t,releaseName:s,mentionNewContributors:r,includeCompare:o,semver:p})}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_page:100,owner:s,repo:r})){for(const{name:t,commit:{sha:s}}of e){if(i===s)continue;if(n==null)return{sha:s,name:t};const e=a.default.parse(t,{includePrerelease:true});if(e==null||n.compare(e)<=0)continue;if(e.prerelease.length>0&&!Line truncated
/*!
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/function isObject(e){return Object.prototype.toString.call(e)==="[object Object]"}function isPlainObject(e){var t,s;if(isObject(e)===false)return false;t=e.constructor;if(t===undefined)return true;s=t.prototype;if(isObject(s)===false)return false;if(s.hasOwnProperty("isPrototypeOf")===false){return false}return true}t.isPlainObject=isPlainObject},6014:(e,t,s)=>{"use strict";const a=s(5578);const r=s(2448);const i={annotations:Symbol("annotations")};t.error=function(e){if(!this._original||typeof this._original!=="object"){return this.details[0].message}const t=e?"":"";const s=e?"":"";const n=e?"":"";const o=a(this._original);for(let e=this.details.length-1;e>=0;--e){const t=e+1;const s=this.details[e];const a=s.path;let n=o;for(let e=0;;++e){const o=a[e];if(r.isSchema(n)){n=n.clone()}if(e+1<a.length&&typeof n[o]!=="string"){n=n[o]}else{const e=n[i.annotations]||{errors:{},missing:{}};n[i.annotations]=e;const a=o||s.context.key;if(n[o]!==undefined){e.errors[a]=e.errors[a]||[];e.errors[a].push(t)}else{e.missing[a]=t}break}}}const p={key:/_\$key\$_([, \d]+)_\$end\$_"/g,missing:/"_\$miss\$_([^|]+)\|(\d+)_\$end\$_": "__missing__"/g,arrayIndex:/\s*"_\$idx\$_([, \d]+)_\$end\$_",?\n(.*)/g,specials:/"\[(NaN|Symbol.*|-?Infinity|function.*|\(.*)]"/g};let l=i.safeStringify(o,2).replace(p.key,((e,s)=>`" ${t}[${s}]${n}`)).replace(p.missing,((e,a,r)=>`${s}"${a}"${n}${t} [${r}]: -- missing --${n}`)).replace(p.arrayIndex,((e,s,a)=>`\n${a} ${t}[${s}]${n}`)).replace(p.specials,((e,t)=>t));l=`${l}\n${t}`;for(let e=0;e<this.details.length;++e){const t=e+1;l=`${l}\n[${t}] ${this.details[e].message}`}l=l+n;return l};i.safeStringify=function(e,t){return JSON.stringify(e,i.serializer(),t)};i.serializer=function(){const e=[];const t=[];const cycleReplacer=(s,a)=>{if(t[0]===a){return"[Circular ~]"}return"[Circular ~."+e.slice(0,t.indexOf(a)).join(".")+"]"};return function(s,a){if(t.length>0){const r=t.indexOf(this);if(~r){t.length=r+1;e.length=r+1;e[r]=s}else{t.push(this);e.push(s)}if(~t.indexOf(a)){a=cycleReplacer.call(this,s,a)}}else{t.push(a)}if(a){const e=a[i.annotations];if(e){if(Array.isArray(a)){const t=[];for(let s=0;s<a.length;++s){if(e.errors[s]){t.push(`_$idx$_${e.errors[s].sort().join(", ")}_$end$_`)}t.push(a[s])}a=t}else{for(const t in e.errors){a[`${t}_$key$_${e.errors[t].sort().join(", ")}_$end$_`]=a[t];a[t]=undefined}for(const t in e.missing){a[`_$miss$_${t}|${e.missing[t]}_$end$_`]="__missing__"}}return a}}if(a===Infinity||a===-Infinity||Number.isNaN(a)||typeof a==="function"||typeof a==="symbol"){return"["+a.toString()+"]"}return a}}},5184:(e,t,s)=>{"use strict";const a=s(2718);const r=s(5578);const i=s(5801);const n=s(445);const o=s(3355);const p=s(2448);const l=s(3038);const d=s(9490);const c=s(6680);const m=s(7997);const u=s(6103);const h=s(1290);const g=s(3838);const v=s(3171);const y=s(1804);const w=s(1944);const b={};b.Base=class{constructor(e){this.type=e;this.$_root=null;this._definition={};this._reset()}_reset(){this._ids=new h.Ids;this._preferences=null;this._refs=new g.Manager;this._cache=null;this._valids=null;this._invalids=null;this._flags={};this._rules=[];this._singleRules=new Map;this.$_terms={};this.$_temp={ruleset:null,whens:{}}}describe(){a(typeof m.describe==="function","Manifest functionality disabled");return m.describe(this)}allow(...e){p.verifyFlat(e,"allow");return this._values(e,"_valids")}alter(e){a(e&&typeof e==="object"&&!Array.isArray(e),"Invalid targets argument");a(!this._inRuleset(),"Cannot set alterations inside a ruleset");const t=this.clone();t.$_terms.alterations=t.$_terms.alterations||[];for(const s in e){const r=e[s];a(typeof r==="function","Alteration adjuster for",s,"must be a function");t.$_terms.alterations.push({target:s,adjuster:r})}t.$_temp.ruleset=false;return t}artifact(e){a(e!==undefined,"Artifact cannot be undefined");a(!this._cache,"Cannot set an artifact with a rule cache");return this.$_setFlag("artifact",e)}cast(e){a(e===false||typeof e==="string","Invalid to value");a(e===false||this._definition.cast[e],"Type",this.type,"does not support casting to",e);return this.$_setFlag("cast",e===false?undefined:e)}default(e,t){return this._default("default",e,t)}description(e){a(e&&typeof e==="string","Description must be a non-empty string");return this.$_setFlag("description",e)}empty(e){const t=this.clone();if(e!==undefined){e=t.$_compile(e,{override:false})}return t.$_setFlag("empty",e,{clone:false})}error(e){a(e,"Missing error");a(e instanceof Error||typeof e==="function","Must provide a valid Error object or a function");return this.$_setFlag("error",e)}example(e,t={}){a(e!==undefined,"Missing example");p.assertOptions(t,["override"]);return this._inner("examples",e,{single:true,override:t.override})}external(e,t){if(typeof e==="object"){a(!t,"Cannot combine options with description");t=e.description;e=e.method}a(typeof e==="function","Method must be a function");a(t===undefined||t&&typeof t==="string","Description must be a non-empty string");returLine truncated
*/function isObject(e){return Object.prototype.toString.call(e)==="[object Object]"}function isPlainObject(e){var t,s;if(isObject(e)===false)return false;t=e.constructor;if(t===undefined)return true;s=t.prototype;if(isObject(s)===false)return false;if(s.hasOwnProperty("isPrototypeOf")===false){return false}return true}t.isPlainObject=isPlainObject},6014:(e,t,s)=>{"use strict";const r=s(5578);const a=s(2448);const i={annotations:Symbol("annotations")};t.error=function(e){if(!this._original||typeof this._original!=="object"){return this.details[0].message}const t=e?"":"";const s=e?"":"";const n=e?"":"";const o=r(this._original);for(let e=this.details.length-1;e>=0;--e){const t=e+1;const s=this.details[e];const r=s.path;let n=o;for(let e=0;;++e){const o=r[e];if(a.isSchema(n)){n=n.clone()}if(e+1<r.length&&typeof n[o]!=="string"){n=n[o]}else{const e=n[i.annotations]||{errors:{},missing:{}};n[i.annotations]=e;const r=o||s.context.key;if(n[o]!==undefined){e.errors[r]=e.errors[r]||[];e.errors[r].push(t)}else{e.missing[r]=t}break}}}const p={key:/_\$key\$_([, \d]+)_\$end\$_"/g,missing:/"_\$miss\$_([^|]+)\|(\d+)_\$end\$_": "__missing__"/g,arrayIndex:/\s*"_\$idx\$_([, \d]+)_\$end\$_",?\n(.*)/g,specials:/"\[(NaN|Symbol.*|-?Infinity|function.*|\(.*)]"/g};let l=i.safeStringify(o,2).replace(p.key,((e,s)=>`" ${t}[${s}]${n}`)).replace(p.missing,((e,r,a)=>`${s}"${r}"${n}${t} [${a}]: -- missing --${n}`)).replace(p.arrayIndex,((e,s,r)=>`\n${r} ${t}[${s}]${n}`)).replace(p.specials,((e,t)=>t));l=`${l}\n${t}`;for(let e=0;e<this.details.length;++e){const t=e+1;l=`${l}\n[${t}] ${this.details[e].message}`}l=l+n;return l};i.safeStringify=function(e,t){return JSON.stringify(e,i.serializer(),t)};i.serializer=function(){const e=[];const t=[];const cycleReplacer=(s,r)=>{if(t[0]===r){return"[Circular ~]"}return"[Circular ~."+e.slice(0,t.indexOf(r)).join(".")+"]"};return function(s,r){if(t.length>0){const a=t.indexOf(this);if(~a){t.length=a+1;e.length=a+1;e[a]=s}else{t.push(this);e.push(s)}if(~t.indexOf(r)){r=cycleReplacer.call(this,s,r)}}else{t.push(r)}if(r){const e=r[i.annotations];if(e){if(Array.isArray(r)){const t=[];for(let s=0;s<r.length;++s){if(e.errors[s]){t.push(`_$idx$_${e.errors[s].sort().join(", ")}_$end$_`)}t.push(r[s])}r=t}else{for(const t in e.errors){r[`${t}_$key$_${e.errors[t].sort().join(", ")}_$end$_`]=r[t];r[t]=undefined}for(const t in e.missing){r[`_$miss$_${t}|${e.missing[t]}_$end$_`]="__missing__"}}return r}}if(r===Infinity||r===-Infinity||Number.isNaN(r)||typeof r==="function"||typeof r==="symbol"){return"["+r.toString()+"]"}return r}}},5184:(e,t,s)=>{"use strict";const r=s(2718);const a=s(5578);const i=s(5801);const n=s(445);const o=s(3355);const p=s(2448);const l=s(3038);const d=s(9490);const u=s(6680);const c=s(7997);const m=s(6103);const h=s(1290);const g=s(3838);const v=s(3171);const y=s(1804);const w=s(1944);const b={};b.Base=class{constructor(e){this.type=e;this.$_root=null;this._definition={};this._reset()}_reset(){this._ids=new h.Ids;this._preferences=null;this._refs=new g.Manager;this._cache=null;this._valids=null;this._invalids=null;this._flags={};this._rules=[];this._singleRules=new Map;this.$_terms={};this.$_temp={ruleset:null,whens:{}}}describe(){r(typeof c.describe==="function","Manifest functionality disabled");return c.describe(this)}allow(...e){p.verifyFlat(e,"allow");return this._values(e,"_valids")}alter(e){r(e&&typeof e==="object"&&!Array.isArray(e),"Invalid targets argument");r(!this._inRuleset(),"Cannot set alterations inside a ruleset");const t=this.clone();t.$_terms.alterations=t.$_terms.alterations||[];for(const s in e){const a=e[s];r(typeof a==="function","Alteration adjuster for",s,"must be a function");t.$_terms.alterations.push({target:s,adjuster:a})}t.$_temp.ruleset=false;return t}artifact(e){r(e!==undefined,"Artifact cannot be undefined");r(!this._cache,"Cannot set an artifact with a rule cache");return this.$_setFlag("artifact",e)}cast(e){r(e===false||typeof e==="string","Invalid to value");r(e===false||this._definition.cast[e],"Type",this.type,"does not support casting to",e);return this.$_setFlag("cast",e===false?undefined:e)}default(e,t){return this._default("default",e,t)}description(e){r(e&&typeof e==="string","Description must be a non-empty string");return this.$_setFlag("description",e)}empty(e){const t=this.clone();if(e!==undefined){e=t.$_compile(e,{override:false})}return t.$_setFlag("empty",e,{clone:false})}error(e){r(e,"Missing error");r(e instanceof Error||typeof e==="function","Must provide a valid Error object or a function");return this.$_setFlag("error",e)}example(e,t={}){r(e!==undefined,"Missing example");p.assertOptions(t,["override"]);return this._inner("examples",e,{single:true,override:t.override})}external(e,t){if(typeof e==="object"){r(!t,"Cannot combine options with description");t=e.description;e=e.method}r(typeof e==="function","Method must be a function");r(t===undefined||t&&typeof t==="string","Description must be a non-empty string");returLine truncated
//# sourceMappingURL=index.js.map
+1 -1
View File
@@ -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/markdown-summary.js","../webpack:/auto-changelog/node_modules/@actions/core/lib/oidc-utils.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/auth.js","../webpack:/auto-changelog/node_modules/@actions/http-client/index.js","../webpack:/auto-changelog/node_modules/@actions/http-client/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/markdown-summary.js","../webpack:/auto-changelog/node_modules/@actions/core/lib/oidc-utils.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/auth.js","../webpack:/auto-changelog/node_modules/@actions/http-client/index.js","../webpack:/auto-changelog/node_modules/@actions/http-client/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
+48
View File
@@ -581,6 +581,54 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
marked
MIT
# License information
## Contribution License Agreement
If you contribute code to this project, you are implicitly allowing your code
to be distributed under the MIT license. You are also implicitly verifying that
all code is your original work. `</legalese>`
## Marked
Copyright (c) 2018+, MarkedJS (https://github.com/markedjs/)
Copyright (c) 2011-2018, Christopher Jeffrey (https://github.com/chjj/)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
## Markdown
Copyright © 2004, John Gruber
http://daringfireball.net/
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name “Markdown” nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
This software is provided by the copyright holders and contributors “as is” and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.
node-fetch
MIT
The MIT License (MIT)
+30
View File
@@ -12,10 +12,12 @@
"@actions/core": "^1.7.0",
"@actions/github": "^5.0.1",
"joi": "^17.6.0",
"marked": "^4.0.14",
"semver": "^7.3.7",
"yaml": "^2.0.1"
},
"devDependencies": {
"@types/marked": "^4.0.3",
"@types/semver": "^7.3.9",
"@typescript-eslint/eslint-plugin": "^5.21.0",
"@typescript-eslint/parser": "^5.21.0",
@@ -265,6 +267,12 @@
"integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==",
"dev": true
},
"node_modules/@types/marked": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/@types/marked/-/marked-4.0.3.tgz",
"integrity": "sha512-HnMWQkLJEf/PnxZIfbm0yGJRRZYYMhb++O9M36UCTA9z53uPvVoSlAwJr3XOpDEryb7Hwl1qAx/MV6YIW1RXxg==",
"dev": true
},
"node_modules/@types/semver": {
"version": "7.3.9",
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.9.tgz",
@@ -1243,6 +1251,17 @@
"node": ">=10"
}
},
"node_modules/marked": {
"version": "4.0.14",
"resolved": "https://registry.npmjs.org/marked/-/marked-4.0.14.tgz",
"integrity": "sha512-HL5sSPE/LP6U9qKgngIIPTthuxC0jrfxpYMZ3LdGDD3vTnLs59m2Z7r6+LNDR3ToqEQdkKd6YaaEfJhodJmijQ==",
"bin": {
"marked": "bin/marked.js"
},
"engines": {
"node": ">= 12"
}
},
"node_modules/merge2": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
@@ -1972,6 +1991,12 @@
"integrity": "sha512-wOuvG1SN4Us4rez+tylwwwCV1psiNVOkJeM3AUWUNWg/jDQY2+HE/444y5gc+jBmRqASOm2Oeh5c1axHobwRKQ==",
"dev": true
},
"@types/marked": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/@types/marked/-/marked-4.0.3.tgz",
"integrity": "sha512-HnMWQkLJEf/PnxZIfbm0yGJRRZYYMhb++O9M36UCTA9z53uPvVoSlAwJr3XOpDEryb7Hwl1qAx/MV6YIW1RXxg==",
"dev": true
},
"@types/semver": {
"version": "7.3.9",
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.9.tgz",
@@ -2680,6 +2705,11 @@
"yallist": "^4.0.0"
}
},
"marked": {
"version": "4.0.14",
"resolved": "https://registry.npmjs.org/marked/-/marked-4.0.14.tgz",
"integrity": "sha512-HL5sSPE/LP6U9qKgngIIPTthuxC0jrfxpYMZ3LdGDD3vTnLs59m2Z7r6+LNDR3ToqEQdkKd6YaaEfJhodJmijQ=="
},
"merge2": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
+2
View File
@@ -36,10 +36,12 @@
"@actions/core": "^1.7.0",
"@actions/github": "^5.0.1",
"joi": "^17.6.0",
"marked": "^4.0.14",
"semver": "^7.3.7",
"yaml": "^2.0.1"
},
"devDependencies": {
"@types/marked": "^4.0.3",
"@types/semver": "^7.3.9",
"@typescript-eslint/eslint-plugin": "^5.21.0",
"@typescript-eslint/parser": "^5.21.0",
+1
View File
@@ -47,6 +47,7 @@ export interface ActionInputsI {
commitTypes: TypesI;
defaultCommitType: string;
releaseName: string;
mentionNewContributors: boolean;
includeCompare: boolean;
semver: boolean;
}
+5
View File
@@ -11,6 +11,9 @@ export async function getInputs(): Promise<ActionInputsI> {
const commitTypes = YAML.parse(getInput("commit-types", { required: true }));
const defaultCommitType = getInput("default-commit-type", { required: true });
const releaseName = getInput("release-name", { required: true });
const mentionNewContributors = getBooleanInput("mention-new-contributors", {
required: true,
});
const includeCompare = getBooleanInput("include-compare", { required: true });
const semver = getBooleanInput("semver", { required: true });
@@ -21,6 +24,7 @@ export async function getInputs(): Promise<ActionInputsI> {
.required(),
defaultCommitType: Joi.string().required(),
releaseName: Joi.string().required(),
mentionNewContributors: Joi.boolean().required(),
includeCompare: Joi.boolean().required(),
semver: Joi.boolean().required(),
})
@@ -28,6 +32,7 @@ export async function getInputs(): Promise<ActionInputsI> {
commitTypes,
defaultCommitType,
releaseName,
mentionNewContributors,
includeCompare,
semver,
});
+21
View File
@@ -1,5 +1,6 @@
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";
@@ -48,6 +49,26 @@ async function run() {
inputs,
});
if (inputs.mentionNewContributors) {
const { data } = await octokit.rest.repos.generateReleaseNotes({
owner,
repo,
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 token = tokens[index + 1];
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}`;
}