Skip to content

chore(main): [bot] release t8s-cluster:9.3.0 #12337

chore(main): [bot] release t8s-cluster:9.3.0

chore(main): [bot] release t8s-cluster:9.3.0 #12337

name: Validate Pull Request
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
on:
pull_request_target:
types:
- opened
- edited
- reopened
- synchronize
jobs:
getChangedChart:
if: ${{ !startsWith(github.head_ref, 'release-please--') }}
permissions:
pull-requests: read
uses: ./.github/workflows/get-changed-chart.yaml
with:
pr_number: ${{ github.event.pull_request.number }}
validateCommits:
if: ${{ !startsWith(github.head_ref, 'release-please--') }}
name: Validate commits
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- name: Conventional commit check
uses: cocogitto/cocogitto-action@ed62593c499c2d7697bb0177213946f1e2634119 # v3
validateTitle:
if: ${{ !startsWith(github.head_ref, 'release-please--') }}
name: Validate Title
runs-on: ubuntu-latest
needs: getChangedChart
permissions:
pull-requests: read
contents: read
env:
PR_TITLE: ${{ github.event.pull_request.title }}
steps:
- name: Conventional commit check
uses: cocogitto/cocogitto-action@ed62593c499c2d7697bb0177213946f1e2634119 # v3
with:
check: false
- name: Verify that PR title is a conventional commit message
run: |
[[ "$RUNNER_DEBUG" == 1 ]] && set -x
set -e
set -o pipefail
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: |
[[ "$RUNNER_DEBUG" == 1 ]] && set -x
set -e
set -o pipefail
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
- name: Verify title reflects major update
if: ${{ needs.getChangedChart.outputs.found == 'true' }}
env:
GH_TOKEN: ${{ github.token }}
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
run: |
[[ "$RUNNER_DEBUG" == 1 ]] && set -x
set -e
set -o pipefail
hasBreakingChange=false
# shellcheck disable=SC2086 # this needs to be splitted
for commit in $(gh api --paginate "/repos/${GITHUB_REPOSITORY}/pulls/${PULL_REQUEST_NUMBER}/commits" | jq -cr 'map(.sha)[]'); do
if cog verify "$(gh api --paginate "/repos/${GITHUB_REPOSITORY}/commits/${commit}" | jq -cr .commit.message)" 2>&1 | grep -qi 'BREAKING CHANGE'; then
hasBreakingChange=true
break
fi
done
if cog verify "$PR_TITLE" 2>&1 | grep -qi 'BREAKING CHANGE'; then
if [[ "$hasBreakingChange" == false ]]; then
echo "There is no commit with a breaking change, this should be reflected in the pull request title" >&2
exit 1
fi
else
if [[ "$hasBreakingChange" == true ]]; then
echo "You need to reflect the breaking change in the pull request title" >&2
exit 1
fi
fi
- run: pip install yq