mirror of
https://github.com/auricom/home-cluster.git
synced 2025-10-03 01:00:54 +02:00
👷 flux diff
This commit is contained in:
49
.github/workflows/flux-diff.yaml
vendored
Normal file
49
.github/workflows/flux-diff.yaml
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
---
|
||||
name: "Flux Diff"
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: ["main"]
|
||||
paths: ["kubernetes/**.yaml"]
|
||||
|
||||
jobs:
|
||||
flux-diff:
|
||||
name: Flux Diff
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: write
|
||||
strategy:
|
||||
matrix:
|
||||
path: ["kubernetes"]
|
||||
resource: ["helmrelease", "kustomization"]
|
||||
steps:
|
||||
- name: Generate Token
|
||||
uses: actions/create-github-app-token@e995b4e40ace2eb5bf13137d9abe242c98f3aab6 # v1.6.0
|
||||
id: app-token
|
||||
with:
|
||||
app-id: "${{ secrets.BOT_APP_ID }}"
|
||||
private-key: "${{ secrets.BOT_APP_PRIVATE_KEY }}"
|
||||
|
||||
- name: Setup Flux
|
||||
uses: fluxcd/flux2/action@a18d4f345021182d6516bf3e8e00210567f46ab5 # v2.1.2
|
||||
|
||||
- name: Diff Resources
|
||||
# uses: allenporter/flux-local/action/diff@19bfc6920e8964a479363bc230e6c329120ead02 # 3.2.0
|
||||
uses: allenporter/flux-local/action/diff@flux-build
|
||||
id: diff
|
||||
with:
|
||||
sources: home-ops-kubernetes
|
||||
path: "${{ matrix.path }}"
|
||||
resource: "${{ matrix.resource }}"
|
||||
|
||||
- if: ${{ steps.diff.outputs.diff != '' }}
|
||||
name: Add comment
|
||||
uses: mshick/add-pr-comment@7c0890544fb33b0bdd2e59467fbacb62e028a096 # v2.8.1
|
||||
with:
|
||||
repo-token: "${{ steps.app-token.outputs.token }}"
|
||||
message-id: "${{ github.event.pull_request.number }}/${{ matrix.path }}/${{ matrix.resource }}"
|
||||
message-failure: Diff was not successful
|
||||
message: |
|
||||
```diff
|
||||
${{ steps.diff.outputs.diff }}
|
||||
```
|
45
.github/workflows/flux-differ.yaml
vendored
45
.github/workflows/flux-differ.yaml
vendored
@@ -1,45 +0,0 @@
|
||||
---
|
||||
name: Flux differ
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches: ['*']
|
||||
paths: ['kubernetes/**.yaml']
|
||||
|
||||
jobs:
|
||||
flux-differ:
|
||||
name: Flux differ
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: write
|
||||
strategy:
|
||||
matrix:
|
||||
path: ["kubernetes"]
|
||||
resource: ["helmrelease", "kustomization"]
|
||||
steps:
|
||||
- name: Generate token
|
||||
uses: tibdex/github-app-token@v2
|
||||
id: generate-token
|
||||
with:
|
||||
app_id: "${{ secrets.BOT_APP_ID }}"
|
||||
private_key: "${{ secrets.BOT_APP_PRIVATE_KEY }}"
|
||||
|
||||
- name: Diff resources
|
||||
uses: allenporter/flux-local/action/diff@3.2.0
|
||||
id: diff
|
||||
with:
|
||||
live-branch: main
|
||||
path: "${{ matrix.path }}"
|
||||
resource: "${{ matrix.resource }}"
|
||||
|
||||
- if: ${{ steps.diff.outputs.diff != '' }}
|
||||
name: Add comment
|
||||
uses: mshick/add-pr-comment@v2.8.1
|
||||
with:
|
||||
repo-token: "${{ steps.generate-token.outputs.token }}"
|
||||
message-id: "${{ github.event.pull_request.number }}/${{ matrix.path }}/${{ matrix.resource }}"
|
||||
message-failure: Diff was not successful
|
||||
message: |
|
||||
```diff
|
||||
${{ steps.diff.outputs.diff }}
|
||||
```
|
Reference in New Issue
Block a user