mirror of
https://github.com/renovatebot/github-action.git
synced 2025-12-16 08:52:35 +00:00
feat: show Renovate CLI version more prominently in logs (#983)
As noted in #969, it would be useful to have a more prominent output in the logs to indicate the version of the Renovate CLI being used. This would help with both personal debugging (for administrators of the GitHub Action) and for raising issues upstream. To do this, we can call the `--version` on the CLI, capture the output and report it back to the user. By using a Notice annotation, we can then make it more visible at the job- and step-level. We can then also wrap it in a `group`, so it's hidden in its own expandable group (with timing information). Closes #969.
This commit is contained in:
parent
47283fac74
commit
fde0305037
2 changed files with 18 additions and 2 deletions
|
|
@ -1,12 +1,17 @@
|
||||||
|
import { group, notice, setFailed } from '@actions/core';
|
||||||
import { Input } from './input';
|
import { Input } from './input';
|
||||||
import { Renovate } from './renovate';
|
import { Renovate } from './renovate';
|
||||||
import { setFailed } from '@actions/core';
|
|
||||||
|
|
||||||
async function run(): Promise<void> {
|
async function run(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const input = new Input();
|
const input = new Input();
|
||||||
const renovate = new Renovate(input);
|
const renovate = new Renovate(input);
|
||||||
|
|
||||||
|
await group('Check Renovate version', async () => {
|
||||||
|
const version = await renovate.runDockerContainerForVersion();
|
||||||
|
notice(version, { title: 'Renovate CLI version' });
|
||||||
|
});
|
||||||
|
|
||||||
await renovate.runDockerContainer();
|
await renovate.runDockerContainer();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
|
import { exec, getExecOutput } from '@actions/exec';
|
||||||
import { Docker } from './docker';
|
import { Docker } from './docker';
|
||||||
import { Input } from './input';
|
import { Input } from './input';
|
||||||
import { exec } from '@actions/exec';
|
|
||||||
import fs from 'node:fs/promises';
|
import fs from 'node:fs/promises';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
|
|
||||||
|
|
@ -14,6 +14,17 @@ export class Renovate {
|
||||||
this.docker = new Docker(input);
|
this.docker = new Docker(input);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async runDockerContainerForVersion(): Promise<string> {
|
||||||
|
const command = `docker run -t --rm ${this.docker.image()} --version`;
|
||||||
|
|
||||||
|
const { exitCode, stdout } = await getExecOutput(command);
|
||||||
|
if (exitCode !== 0) {
|
||||||
|
new Error(`'docker run' failed with exit code ${exitCode}.`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return stdout.trim();
|
||||||
|
}
|
||||||
|
|
||||||
async runDockerContainer(): Promise<void> {
|
async runDockerContainer(): Promise<void> {
|
||||||
await this.validateArguments();
|
await this.validateArguments();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue