Skip to content

ci(github-action): Update action actions/labeler ( v6.2.0 ➔ v7.0.0 ) - autoclosed #4064

ci(github-action): Update action actions/labeler ( v6.2.0 ➔ v7.0.0 ) - autoclosed

ci(github-action): Update action actions/labeler ( v6.2.0 ➔ v7.0.0 ) - autoclosed #4064

Workflow file for this run

---
# yaml-language-server: $schema=https://www.schemastore.org/github-workflow.json
name: Flate
on:
pull_request:
branches: ["main"]
push:
branches: ['renovate/**']
concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
cancel-in-progress: true
permissions:
contents: read
packages: read
jobs:
filter:
name: Flate - Filter
runs-on: ubuntu-latest
outputs:
changed-files: ${{ steps.changed-files.outputs.changed_files }}
steps:
- name: Get Changed Files
id: changed-files
uses: bjw-s-labs/action-changed-files@a9a36fb08ce06db9b02fbd8026cc2c0945eb9841 # v0.6.0
with:
patterns: kubernetes/**/*
flate:
if: ${{ needs.filter.outputs.changed-files != '[]' }}
needs: filter
name: Flate
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
kind:
- helmrelease
- kustomization
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- uses: home-operations/flate/action@main
with:
cache: true
- name: Login to GHCR
uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4.4.0
env:
DOCKER_CONFIG: ${{ runner.temp }}/docker-config
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Run flate diff
env:
FLATE_ALLOW_MISSING_SECRETS: "true"
FLATE_CONCURRENCY: "4"
FLATE_PATH: ./kubernetes/cluster
FLATE_REGISTRY_CONFIG: ${{ runner.temp }}/docker-config/config.json
KIND: ${{ matrix.kind }}
run: |
flate diff "$KIND" > "$KIND.diff"
[ -s "$KIND.diff" ] || rm "$KIND.diff"
- if: ${{ hashFiles(format('{0}.diff', matrix.kind)) != '' }}
name: Upload diff
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: flate-diff-${{ matrix.kind }}
path: ${{ matrix.kind }}.diff
retention-days: 1
comment:
if: ${{ !cancelled() && needs.flate.result != 'skipped' && github.event_name == 'pull_request' }}
needs: flate
name: Flate - Comment
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Download diffs
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
pattern: flate-diff-*
merge-multiple: true
- if: ${{ hashFiles('helmrelease.diff', 'kustomization.diff') != '' }}
name: Add or Update Comment
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
const fs = require('fs');
const read = (path) => { try { return fs.readFileSync(path, 'utf8'); } catch { return ''; } };
const { owner, repo } = context.repo;
const issue_number = context.issue.number;
const marker = `<!-- flate -->`;
const runUrl = `${context.serverUrl}/${owner}/${repo}/actions/runs/${context.runId}`;
const diffs = {
Kustomization: read("kustomization.diff"),
HelmRelease: read("helmrelease.diff"),
};
const LIMIT = 65000; // GitHub caps comment bodies at 65,536; leave headroom
const inlineSection = (label, diff) => [
`<details open><summary>${label} diff</summary>`,
``,
"```diff",
diff,
"```",
``,
`</details>`,
];
const linkedSection = (label, diff) => [
`<details><summary>${label} diff (${diff.length.toLocaleString()} chars — too large to post)</summary>`,
``,
`Diff exceeds GitHub's comment size limit. Download the artifact from the [workflow run](${runUrl}).`,
``,
`</details>`,
];
// Inline every diff, then evict the largest to a link until the whole
// comment fits — so a small diff never bumps a big one off inline.
const present = Object.entries(diffs).filter(([, diff]) => diff.trim());
const linked = new Set();
const render = () => [
marker,
...present.flatMap(([label, diff]) =>
linked.has(label) ? linkedSection(label, diff) : inlineSection(label, diff)),
``,
`<sub>Diff created by [flate](https://github.com/home-operations/flate) — [Workflow run](${runUrl})</sub>`,
].join("\n");
for (const [label] of [...present].sort((a, b) => b[1].length - a[1].length)) {
if (render().length <= LIMIT) break;
linked.add(label);
}
const body = render();
const comments = await github.paginate(github.rest.issues.listComments, {
owner, repo, issue_number, per_page: 100,
});
const existing = comments.find(c => c.body?.includes(marker));
if (existing) {
await github.rest.issues.updateComment({ owner, repo, comment_id: existing.id, body });
} else {
await github.rest.issues.createComment({ owner, repo, issue_number, body });
}
success:
if: ${{ !cancelled() }}
needs:
- flate
name: Flate - Success
runs-on: ubuntu-latest
steps:
- name: Any jobs failed?
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1
- name: All jobs passed or skipped?
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: echo "All jobs passed or skipped" && echo "${{ toJSON(needs.*.result) }}"