Skip to content

Commit

Permalink
chore: customize generate-chart-matrix action
Browse files Browse the repository at this point in the history
Signed-off-by: Ahmed AbouZaid <[email protected]>
  • Loading branch information
aabouzaid committed Jun 12, 2024
1 parent 87f68f5 commit f1f5ce0
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
18 changes: 16 additions & 2 deletions .github/actions/generate-chart-matrix/action.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,42 @@
name: Generate chart matrix
description: Find changed charts and generate matrix for changed ones only.
inputs:
charts-path:
description: Charts path to match.
default: "charts/camunda-platform*"
diff-since-last-commit:
description: Either find changes since last commit or compare last successful commit of the base branch (main).
default: "true"
outputs:
matrix:
description: JSON matrix of changed charts which will be used as and input for GHA workflow matrix.
value: ${{ steps.set-chart-versions.outputs.matrix }}
runs:
using: composite
steps:
- name: Checkout branch
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- name: Get changed dirs
id: changed-files
uses: tj-actions/changed-files@d6babd6899969df1a11d14c368283ea4436bca78 # v44
with:
dir_names: "true"
since_last_remote_commit: "${{ inputs.diff-since-last-commit }}"
- name: Generate matrix
shell: bash
id: set-chart-versions
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
echo "Setting matrix based on changed files"
echo "Changed files: ${ALL_CHANGED_FILES}"
echo "Changed files:"
printf "%s\n" ${ALL_CHANGED_FILES}
touch matrix_versions.txt
ls -d charts/camunda-platform-8* | while read chart_dir; do
ls -d ${{ inputs.charts-path }} | while read chart_dir; do
if [[ $(echo ${ALL_CHANGED_FILES} | grep "${chart_dir}") ]]; then
camunda_version="$(echo ${chart_dir} | cut -d '-' -f 3)";
echo "Camunda version: ${camunda_version}"
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/test-regression.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: "Test - Regression"
on:
pull_request:
paths:
- 'charts/camunda-platform-*/**'
- 'charts/camunda-platform-8*/**'
workflow_dispatch: { }

concurrency:
Expand Down Expand Up @@ -32,6 +32,8 @@ jobs:
- name: Generate chart versions
id: generate-chart-versions
uses: ./.github/actions/generate-chart-matrix
with:
charts-path: "charts/camunda-platform-8*"

validation:
if: ${{ needs.init.outputs.matrix != '' }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ on:
branches:
- main
paths:
- '.github/**'
- '.github/*unit*'
- '.tool-versions'
- 'charts/camunda-platform*/**'
- 'go.*'
pull_request:
paths:
- '.github/**'
- '.github/*unit*'
- '.tool-versions'
- 'charts/camunda-platform*/**'
- 'go.*'
Expand Down

0 comments on commit f1f5ce0

Please sign in to comment.