Skip to content

fix: GitHub Actions with cz. #1

fix: GitHub Actions with cz.

fix: GitHub Actions with cz. #1

Workflow file for this run

name: Release Branch Test
on:
push:
branches:
- module-release
jobs:
find-modules:
runs-on: ubuntu-latest
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Find all terraform modules
id: find
uses: bendrucker/find-terraform-modules@v1
- name: Show all matching modules
shell: bash
run: |
mods=(${{ join(fromJSON(steps.find.outputs.modules), ' ') }})
printf "%s\n" "${mods[@]}"
- name: Find all changed files
id: diff
uses: technote-space/get-diff-action@v6
with:
FORMAT: json
- name: Show changed files
run: |
echo "${{ steps.diff.outputs.diff }}"
- name: Get the modified modules
id: modified
uses: actions/github-script@v7
with:
script: |
const modules = ${{ steps.find.outputs.modules }}
const diff = ${{ steps.diff.outputs.diff }}
const modifiedModules = modules.filter(
(module) => {
return !!diff.find(file => new RegExp(`^${module}/.+`).test(file))
}
)
core.setOutput('modules', modifiedModules)
- name: Show modified modules
run: |
echo "${{ steps.modified.outputs.modules }}"
outputs:
modules: ${{ steps.modified.outputs.modules }}
release:
runs-on: ubuntu-latest
needs: find-modules
strategy:
matrix:
module: ${{fromJson(needs.find-modules.outputs.modules)}}
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Bump version and create changelog
uses: commitizen-tools/commitizen-action@0.21
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
dry_run: true
changelog_increment_filename: release.md