chore(deps): update dependency kubernetes-sigs/external-dns to v0.15.0 #5897
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: k8s-diff | |
on: [pull_request] | |
jobs: | |
base: | |
name: Base | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.base.sha }} | |
- uses: bazelbuild/setup-bazelisk@v2 | |
- name: Mount bazel cache | |
uses: actions/cache@v3 | |
with: | |
path: "~/.cache/bazel" | |
key: bazel | |
- name: Build | |
run: | | |
bazel build \ | |
--config=ci \ | |
--remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_ORG_API_KEY }} \ | |
//k8s/unwind:list | |
- name: Get output path | |
id: get-output-path | |
run: echo "PATH=$(bazel cquery --output=files //k8s/unwind:list 2> /dev/null)" >> "$GITHUB_OUTPUT" | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: base | |
path: "${{ steps.get-output-path.outputs.PATH }}" | |
head: | |
name: Head | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: bazelbuild/setup-bazelisk@v2 | |
- name: Mount bazel cache | |
uses: actions/cache@v3 | |
with: | |
path: "~/.cache/bazel" | |
key: bazel | |
- name: Build | |
run: | | |
bazel build \ | |
--config=ci \ | |
--remote_header=x-buildbuddy-api-key=${{ secrets.BUILDBUDDY_ORG_API_KEY }} \ | |
//k8s/unwind:list | |
- name: Get output path | |
id: get-output-path | |
run: echo "PATH=$(bazel cquery --output=files //k8s/unwind:list 2> /dev/null)" >> "$GITHUB_OUTPUT" | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: head | |
path: "${{ steps.get-output-path.outputs.PATH }}" | |
compare: | |
name: Compare | |
needs: [base, head] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- run: npm install json-diff | |
- name: Comment diff on PR | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const { diffString } = require("json-diff") | |
const reduce = o => o.items.reduce((acc, v) => ({ [`**${v.metadata.namespace}/${v.metadata.name}** ${v.kind} (${v.apiVersion})`]: v, ...acc, }), {}) | |
const baseList = require("./base/list.json") | |
const headList = require("./head/list.json") | |
const base = reduce(baseList) | |
const head = reduce(headList) | |
const sort = o => Object.fromEntries(Object.entries(o).sort()) | |
const results = [] | |
for (const name of new Set([...Object.keys(base), ...Object.keys(head)])) { | |
const result = diffString(sort(base[name]), sort(head[name]), { | |
outputKeys: ["apiVersion", "kind", "name", "namespace"] | |
}) | |
if (result) { | |
results.push({ | |
name, | |
result | |
}) | |
} | |
} | |
if (!results.length) { | |
core.warning("no results") | |
return | |
} | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: results.map(v => { | |
const added = v.result.split("\n").filter(line => line.startsWith("+")).length | |
const deleted = v.result.split("\n").filter(line => line.startsWith("-")).length | |
return `${v.name} \${\\color{green}+${added}}\$ \${\\color{red}-${deleted}}\$ | |
\`\`\`diff | |
${v.result} | |
\`\`\`` | |
}).join("\n") | |
}) |