astro/scripts/notify/index.js

53 lines
1.7 KiB
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/');
const emojis = ['🎉', '🥳', '🚀', '🧑‍🚀', '🎊', '🏆', '✅', '🤩', '🤖', '🙌'];
const descriptors = ['new releases', 'fresh new code', 'shiny updates', 'exciting stuff', 'package updates', 'awesome updates', 'bug fixes and features', 'updates'];
const verbs = [
'just went out!',
'now available!',
'in the wild!',
'now live!',
'hit the registry!',
'to share!',
'for you!',
"for y'all!",
"comin' your way!",
"comin' atcha!",
"comin' in hot!",
', freshly minted on the blockchain! (jk)',
];
function item(items) {
return items[Math.floor(Math.random() * items.length)];
}
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
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() };
})
);
const emoji = item(emojis);
const descriptor = item(descriptors);
const verb = item(verbs);
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
if (packages.length === 1) {
const { name, version, url } = packages[0];
console.log(`${emoji} \`${name}@${version}\` ${verb}\nRead the [release notes →](<${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
} else {
console.log(`${emoji} Some ${descriptor} ${verb}\n`);
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
for (const { name, version, url } of packages) {
console.log(`\`${name}@${version}\` Read the [release notes →](<${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
}
}
}
run();