Procházet zdrojové kódy

chore: commit log in beta release notes

tophf před 4 roky
rodič
revize
20abadc552
2 změnil soubory, kde provedl 18 přidání a 2 odebrání
  1. 1 0
      .github/workflows/release.yml
  2. 17 2
      scripts/action-helper.js

+ 1 - 0
.github/workflows/release.yml

@@ -11,6 +11,7 @@ jobs:
     steps:
       - uses: actions/checkout@v2
         with:
+          fetch-depth: 100 # for `action-helper`
           persist-credentials: false
       - uses: actions/setup-node@v2
         with:

+ 17 - 2
scripts/action-helper.js

@@ -1,3 +1,4 @@
+const childProcess = require('child_process');
 const core = require('@actions/core');
 const { getVersion, isBeta } = require('./version-helper');
 
@@ -22,9 +23,11 @@ const envs = {
 envs.ASSET_ZIP = `${envs.RELEASE_PREFIX}-webext-v${envs.VERSION}.zip`;
 envs.ASSET_SELF_HOSTED_ZIP = `${envs.RELEASE_PREFIX}-webext-ffself-v${envs.VERSION}.zip`;
 
-// TODO generate release notes by conventional commit messages and add installation instructions
 envs.RELEASE_NOTE = beta ? `\
-**This is a beta release of Violentmonkey, use it at your own risk.**
+**This is a beta release of Violentmonkey, use it at your own risk.**<br>\
+If you already use Violentmonkey, click \`Export to zip\` in settings before installing the beta.
+
+${listCommits()}
 ` : `\
 See <https://violentmonkey.github.io/> for more details.
 `;
@@ -32,3 +35,15 @@ See <https://violentmonkey.github.io/> for more details.
 Object.entries(envs).forEach(([key, value]) => {
   core.exportVariable(key, value);
 });
+
+function listCommits() {
+  const exec = cmd => childProcess.execSync(cmd, {encoding: 'utf8'}).trim();
+  const thisTag = exec('git describe --abbrev=0');
+  const prevTag = exec(`git describe --abbrev=0 --tags "${thisTag}^"`);
+  return exec(`git log --oneline --skip=1 --reverse "${prevTag}...${thisTag}"`)
+  .split('\n')
+  .map((str, i) => `${str.split(/\s/, 2)[1]}${10000 + i}\n${str}`)
+  .sort()
+  .map(str => str.split('\n')[1])
+  .join('\n');
+}