astro/scripts/notify/index.js

28 lines
1,002 B
JavaScript
Raw Normal View History

2021-12-01 16:40:55 +00:00
import path from 'path';
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
Improve GitHub Actions (#2041) * chore(actions): test new CI action * chore(actions): switch action order * chore(actions): update registry * chore(actions): remove debug * chore(actions): target all packages * chore(actions): test artifacts * chore(actions): try moving artifacts * chore(actions): test moving * chore(actions): test tar approach * chore(actions): test tar approach * chore(actions): use artifacts/packages before tar * chore(actions): test mv -vn * chore(actions): mkdir first * chore(actions): how does tar work? * chore(actions): so good at bash * chore(actions): test matrix * chore(actions): fix test matrix * chore(actions): fix windows? * chore(actions): fix windows? * chore(actions): fix windows! * chore(actions): fix windows! * chore(actions): add lint * chore(actions): add back old actions * chore(actions): test notification action * chore(actions): test notification action again * chore(actions): fix extract action * chore(actions): fix action? * chore(actions): fix action? * chore(actions): fix newlines * chore(actions): test --production flag * chore(actions): test --production flag for test * chore(actions): add execa to production deps * chore(actions): add cheerio to production deps * chore(actions): add production deps for tested examples * chore(actions): fix changelog action * chore(actions): attempt to use --prefer-offline * chore(actions): revert dependencies/devDependencies change * chore(actions): update all actions * chore(actions): add smoke test * chore(actions): update changelog deps * chore(actions): move notify script * chore(actions): consolidate main scripts * chore(actions): update changelog name * chore(actions): update congratsbot * chore(actions): update ci * chore(actions): change lint/format strategy * chore(actions): expose GITHUB_TOKEN to linter * chore(actions): update lint * chore(actions): enable autofix * chore(actions): fetch-depth 0 * chore(actions): fix eslint extensions * chore(actions): debug lint * chore(actions): fix eslint args * chore(actions): fix eslint? * [ci] ESLint fix * [ci] Prettier fix * chore(actions): fix lint! * chore(actions): cleanup comments * chore(actions): fix lint * chore(actions): lint astro only * chore(actions): ignore pattern * chore(actions): no_verify * chore(actions): disable no verify * chore(actions): debug status * chore(actions): add concurrency * chore(actions): add comment about concurrency * chore(actions): make release dependent on lint * chore(actions): move lint first * chore(actions): run CI on PR or `main` only * chore(actions): remove GPR publish step * chore: add back old actions * chore: revert package.json * chore: improve changelog with GitHub info * chore(actions): try pull_request_target * debug lint * debug lint * debug lint * try pull_request_target * update pull_request_target perms * update pull_request_target * fix perms * fix run? * fix run? * fix run? (part 3) * fix run? (part 4) * fix run? (part 5) * fix run! * fix run!! * fix run!!! * fix run!!!! * fix run!!!!! * fix run!!!!!! * add comment about forks Co-authored-by: GitHub Actions <actions-user@github.com>
2021-11-29 21:11:15 +00:00
const baseUrl = new URL('https://github.com/withastro/astro/blob/main/');
async function run() {
const releases = process.argv.slice(2)[0];
const data = JSON.parse(releases);
const packages = await Promise.all(
data.map(({ name, version }) => {
const p = path.relative('./', path.dirname(require.resolve(name))).replace(path.sep, '/');
return { name, version, url: new URL(`${p}/CHANGELOG.md#${version.replace(/\./g, '')}`, baseUrl).toString() };
})
);
if (packages.length === 1) {
const { name, version, url } = packages[0];
console.log(`\`${name}@${version}\` was just released! Read the [release notes →](<${url}>)`);
} else {
console.log(`**Some new releases just went out!**\n`);
for (const { name, version, url } of packages) {
console.log(`\`${name}@${version}\` ([Release Notes →](<${url}>))`);
}
}
}
run();