Browse Source

Attempt to automatically configure release notes (#7405)

* Attempt to automatically configure release notes

This commit is an attempt to tackle #7068 by configuring the release
notes in Github Releases with the handwritten release notes from
`RELEASES.md`. The basic idea here is to split the markdown file on
`-----` delimiters and then find the one which matches the version being
released. Once one is found the `body` field of the API call to create
the release is configured.

* Update .github/actions/github-release/main.js

Co-authored-by: Andrew Brown <andrew.brown@intel.com>

---------

Co-authored-by: Andrew Brown <andrew.brown@intel.com>
pull/7410/head
Alex Crichton 1 year ago
committed by GitHub
parent
commit
3079a64cd3
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 24
      .github/actions/github-release/main.js

24
.github/actions/github-release/main.js

@ -91,13 +91,25 @@ async function runOnce() {
} catch (e) {
console.log("ERROR: ", JSON.stringify(e, null, 2));
core.info(`creating a release`);
const releaseNotes = fs.readFileSync('RELEASES.md').toString();
let notes = null;
const opts = {
owner,
repo,
tag_name: name,
prerelease: name === 'dev',
};
if (name !== 'dev') {
for (let x of releaseNotes.split(/^---+$/m)) {
if (x.indexOf(name.substring(1)) == -1)
continue;
opts.body = x;
break;
}
}
try {
release = await octokit.rest.repos.createRelease({
owner,
repo,
tag_name: name,
prerelease: name === 'dev',
});
release = await octokit.rest.repos.createRelease(opts);
} catch(e) {
console.log("ERROR: ", JSON.stringify(e, null, 2));
core.info(`fetching one more time`);

Loading…
Cancel
Save