workflows,scripts: migrate to use GITHUB_OUTPUT
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -28,6 +28,7 @@ const { execFile: execFileCb } = require('child_process');
|
||||
const { resolve: resolvePath } = require('path');
|
||||
const { promises: fs } = require('fs');
|
||||
const { promisify } = require('util');
|
||||
const { EOL } = require('os');
|
||||
|
||||
const parentRef = process.env.COMMIT_SHA_BEFORE || 'HEAD^';
|
||||
|
||||
@@ -53,6 +54,10 @@ async function runPlain(cmd, ...args) {
|
||||
async function main() {
|
||||
process.cwd(resolvePath(__dirname, '..'));
|
||||
|
||||
if (!process.env.GITHUB_OUTPUT) {
|
||||
throw new Error('GITHUB_OUTPUT environment variable not set');
|
||||
}
|
||||
|
||||
const diff = await runPlain(
|
||||
'git',
|
||||
'diff',
|
||||
@@ -103,7 +108,7 @@ async function main() {
|
||||
|
||||
if (newVersions.length === 0) {
|
||||
console.log('No package version bumps detected, no release needed');
|
||||
console.log(`::set-output name=needs_release::false`);
|
||||
await fs.appendFile(process.env.GITHUB_OUTPUT, `needs_release=false${EOL}`);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -114,7 +119,7 @@ async function main() {
|
||||
` ${name.padEnd(maxLength, ' ')} ${oldVersion} to ${newVersion}`,
|
||||
);
|
||||
}
|
||||
console.log(`::set-output name=needs_release::true`);
|
||||
await fs.appendFile(process.env.GITHUB_OUTPUT, `needs_release=true${EOL}`);
|
||||
}
|
||||
|
||||
main().catch(error => {
|
||||
|
||||
Reference in New Issue
Block a user