Skip to content

Commit

Permalink
feat(ci): split check by chart found and always
Browse files Browse the repository at this point in the history
  • Loading branch information
cwrau committed Aug 6, 2024
1 parent 445a6e1 commit 3554b17
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions .github/workflows/validate-pullrequest.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Validate and label Pull Request
name: Validate Pull Request

on:
pull_request_target:
Expand Down Expand Up @@ -26,35 +26,36 @@ jobs:

- name: Conventional commit check
uses: cocogitto/cocogitto-action@5ae166018d8265bb2df85c1eb521e86a17b61085 # v3
validateAndLabelPR:
validateTitle:
if: ${{ !startsWith(github.head_ref, 'release-please--') }}
name: Validate and label PR
name: Validate Title
runs-on: ubuntu-latest
needs: getChangedChart
env:
PR_TITLE: ${{ github.event.pull_request.title }}
steps:
- name: Conventional commit check
uses: cocogitto/cocogitto-action@5ae166018d8265bb2df85c1eb521e86a17b61085 # v3
with:
check: false
- run: |
set -u
- name: Verify that PR title is a conventional commit message
run: |
set -e
set -o pipefail
: "${PR_TITLE:?Environment variable must be set}"
changed="${CHANGED_CHART?Environment variable must be set}"
if ! cog verify "$PR_TITLE"; then
echo "PR title must be a conventional commit message" >&2
exit 1
fi
- name: Verify correct scope of PR title
if: ${{ needs.getChangedChart.outputs.found == 'true' }}
env:
CHANGED_CHART: ${{ needs.getChangedChart.outputs.chart }}
run: |
set -e
set -o pipefail
if [[ -n "$changed" ]] && ! cog verify "$PR_TITLE" 2>&1 | grep -Eq "^\s+Scope: $changed(/.+|)\$"; then
echo "PR title must have scope '$changed/\$subscope'" >&2
if ! cog verify "$PR_TITLE" 2>&1 | grep -Eq "^\s+Scope: $CHANGED_CHART(/.+|)\$"; then
echo "PR title must have scope '$CHANGED_CHART/\$subscope'" >&2
exit 1
fi
env:
PR_TITLE: ${{ github.event.pull_request.title }}
GITHUB_TOKEN: ${{ github.token }}
ISSUE_NUMBER: ${{ github.event.number }}
CHANGED_CHART: ${{ needs.getChangedChart.outputs.chart }}

0 comments on commit 3554b17

Please sign in to comment.