Skip to content

Commit

Permalink
Merge branch 'main' into renovate/main-gha-runner-scale-set-controlle…
Browse files Browse the repository at this point in the history
…r-0.x
  • Loading branch information
onedr0p authored Dec 21, 2023
2 parents ba1088b + 66cf692 commit bcd2cca
Showing 1 changed file with 43 additions and 6 deletions.
49 changes: 43 additions & 6 deletions .github/workflows/flux-diff.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,51 @@ env:
AQUA_GLOBAL_CONFIG: .github/aqua.yaml

jobs:
changed-files:
name: Get Changed Files
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.changed-files.outputs.all_changed_and_modified_files }}
steps:
- name: Generate Token
uses: actions/create-github-app-token@2986852ad836768dfea7781f31828eb3e17990fa # v1.6.2
id: app-token
with:
app-id: "${{ secrets.BOT_APP_ID }}"
private-key: "${{ secrets.BOT_APP_PRIVATE_KEY }}"

- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
token: "${{ steps.app-token.outputs.token }}"
fetch-depth: 0

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@56284d80811fb5963a972b438f2870f175e5b7c8 # v40.2.3
with:
files: kubernetes/**
dir_names: true
dir_names_max_depth: 2
json: true
quotepath: false
escape_json: false

- name: List all changed files
run: echo "${{ steps.changed-files.outputs.all_changed_and_modified_files }}"

flux-diff:
name: Flux Diff
runs-on: ubuntu-latest
needs: ["changed-files"]
permissions:
pull-requests: write
strategy:
matrix:
path: ["kubernetes/main", "kubernetes/storage"]
resource: ["helmrelease", "kustomization"]
paths: ${{ fromJSON(needs.changed-files.outputs.matrix) }}
resources: ["helmrelease", "kustomization"]
max-parallel: 4
fail-fast: false
steps:
- name: Generate Token
uses: actions/create-github-app-token@2986852ad836768dfea7781f31828eb3e17990fa # v1.6.2
Expand All @@ -32,6 +68,7 @@ jobs:
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
token: "${{ steps.app-token.outputs.token }}"
fetch-depth: 0

- name: Install System Tools
shell: bash
Expand All @@ -48,7 +85,7 @@ jobs:
uses: aquaproj/aqua-installer@928a2ee4243a9ee8312d80dc8cbaca88fb602a91 # v2.2.0
with:
aqua_version: v2.21.3
aqua_opts: -a
aqua_opts: ""
env:
GITHUB_TOKEN: "${{ steps.app-token.outputs.token }}"

Expand All @@ -57,15 +94,15 @@ jobs:
id: diff
with:
sources: home-kubernetes
path: "${{ matrix.path }}"
resource: "${{ matrix.resource }}"
path: "${{ matrix.paths }}"
resource: "${{ matrix.resources }}"

- 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-id: "${{ github.event.pull_request.number }}/${{ matrix.paths }}/${{ matrix.resources }}"
message-failure: Diff was not successful
message: |
```diff
Expand Down

0 comments on commit bcd2cca

Please sign in to comment.