ci(base-cluster/artifacthub-images): Update ArtifactHUB images #16322
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@c7a74f5406bab86da17da0f0e460a69f8219a68c # 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@c7a74f5406bab86da17da0f0e460a69f8219a68c # v3 | |
with: | |
check: false | |
- name: Verify PR title is the first line of the first commit | |
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 | |
if [[ "$PR_TITLE" != "$(gh api --paginate "/repos/${GITHUB_REPOSITORY}/pulls/${PULL_REQUEST_NUMBER}/commits" | jq -cr 'first | .commit.message | split("\n") | first')" ]]; then | |
echo "Don't change the PR title, leave it as the first line of the first commit's message" >&2 | |
exit 1 | |
fi | |
if gh api --paginate "/repos/${GITHUB_REPOSITORY}/pulls/${PULL_REQUEST_NUMBER}" | jq -cr .body | grep -q '…'; then | |
echo "The PR body shouldn't contain ellipses (…), did you remove the trailing stuff from the first line of the commit message?" >&2 | |
exit 1 | |
fi | |
- 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 |