Skip to content

Commit

Permalink
Attempt to automatically configure release notes
Browse files Browse the repository at this point in the history
This commit is an attempt to tackle bytecodealliance#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.

This is unfortunately quite difficult to test, so I haven't actually
tested it. I'm hoping this won't at least halt the release so we can see
how it goes for the next one and fix any issues that arise.
  • Loading branch information
alexcrichton committed Oct 30, 2023
1 parent a50bd07 commit 8865d30
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions .github/actions/github-release/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
Expand Down

0 comments on commit 8865d30

Please sign in to comment.