Skip to content

Commit

Permalink
Parse renovate log output
Browse files Browse the repository at this point in the history
  • Loading branch information
mraerino committed Jul 23, 2023
1 parent 658489b commit aa24b1a
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion .github/workflows/renovate-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,47 @@ jobs:
uses: renovatebot/github-action@v39.0.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
env-regex: "^(?:RENOVATE_\\w+|LOG_LEVEL|LOG_FORMAT)$"
env:
RENOVATE_DRY_RUN: lookup
RENOVATE_USERNAME: renovate-bot
RENOVATE_GIT_AUTHOR: renovate bot <renovate@example.org>
RENOVATE_REPOSITORIES: ${{ github.repository }}
RENOVATE_BASE_BRANCHES: ${{ github.ref_name }}
RENOVATE_USE_BASE_BRANCH_CONFIG: merge
LOG_LEVEL: "debug"
LOG_LEVEL: debug
LOG_FORMAT: json
RENOVATE_LOG_FILE: /tmp/renovate.log
- name: Show pending updates
uses: actions/github-script@v6
with:
script: |
const fs = require("fs/promises");
const logFile = await fs.readFile("/tmp/renovate.log", { encoding: "utf-8" });
const lines = logFile.split("\n");
for (const line of lines) {
/** @type {{ msg: string, config: Record<string, any> }} */
const log = JSON.parse(line);
if (log.msg === "packageFiles with updates") {
for (const [manager, files] of Object.entries(log.config)) {
console.log(`\n--- MANAGER ${manager}`);
for (const file of files) {
console.log(`In ${file.packageFile}:`);
if (file.deps.some((d) => d.updates.length > 0)) {
for (const dep of file.deps) {
for (const update of dep.updates) {
console.log(
` - "${dep.depName}" from ${dep.currentValue} to ${update.newVersion}`
);
}
}
} else {
console.log(" No updates");
}
}
}
return;
}
}
console.log("No updates");

0 comments on commit aa24b1a

Please sign in to comment.