Skip to content

Commit

Permalink
chore: Added minimum HA version to release notes
Browse files Browse the repository at this point in the history
  • Loading branch information
BottlecapDave committed Jun 2, 2024
1 parent 42a0f65 commit efa8d98
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion .build/createGithubRelease.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
import { readFileSync } from 'fs';
import { join } from 'path';

const bodySuffix = "---\nEnjoying the integration? Why not make a one time or monthly [GitHub sponsorship](https://github.com/sponsors/bottlecapdave) or use my [Octopus Energy referral link](https://share.octopus.energy/gray-jade-372)?"

function getMinimumHomeAssistantVersion() {
const hacsFilePath = join(__dirname, 'hacs.json');
const buffer = readFileSync(hacsFilePath);
const content = JSON.parse(buffer.toString());
return content.homeassistant
}

async function createGithubRelease(githubToken: string, githubOwnerRepo: string, tag: string, notes: string) {
if (!githubToken) {
throw new Error('Github token not specified');
Expand Down Expand Up @@ -45,9 +55,10 @@ async function createGithubRelease(githubToken: string, githubOwnerRepo: string,
}
}

const minimumHAVersionNote = `\\n**Minimum HA Version**: ${getMinimumHomeAssistantVersion()}\n\n`;
createGithubRelease(
process.env.GITHUB_TOKEN,
process.env.GITHUB_REPOSITORY,
process.argv[2],
`${process.argv[3]}\n${bodySuffix}`
`${process.argv[3]}\n${minimumHAVersionNote}${bodySuffix}`
).then(() => console.log('Success'));

0 comments on commit efa8d98

Please sign in to comment.