From 9374d84d8d43a1f6498dd7e397f20acb08d8bd71 Mon Sep 17 00:00:00 2001 From: Dennis Wendland <72455939+dwendland@users.noreply.github.com> Date: Wed, 20 Mar 2024 11:58:54 +0100 Subject: [PATCH] Add bash action for matching semver label (#54) * Add match-label-action * Rename step id * Now with label * Fix allowed values * Add bash action for matching semver label * Change to new line according to https://github.com/actions-ecosystem/action-get-merged-pull-request?tab=readme-ov-file#outputs --- .github/workflows/release-helm.yaml | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release-helm.yaml b/.github/workflows/release-helm.yaml index 57af897..5dbb2f9 100644 --- a/.github/workflows/release-helm.yaml +++ b/.github/workflows/release-helm.yaml @@ -26,15 +26,24 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} - - id: match-label - uses: zwaldowski/match-label-action@v1 - with: - allowed: major, minor, patch - + - name: Match semver label via bash + id: match-label-bash + run: | + LABELS=${{ steps.pr.outputs.labels }} + IFS='\n' read -ra LABEL <<< "$LABELS" + for i in "${LABEL[@]}"; do + case $i in + # Will just use the first occurence + 'major'|'minor'|'patch') + echo "RELEASE_LABEL=$i" >> $GITHUB_OUTPUT + break + esac + done + - uses: zwaldowski/semver-release-action@v2 with: dry_run: true - bump: ${{ steps.match-label.outputs.match }} + bump: ${{ steps.match-label-bash.outputs.RELEASE_LABEL }} github_token: ${{ secrets.GITHUB_TOKEN }} - name: Set version output