ci: Extend skip logic in commits-validation workflow to include specific PR titles for improved commitlint execution
This commit is contained in:
1 file changed
+14
-2
@@ -11,18 +11,21 @@ concurrency:
|
|||||||
env:
|
env:
|
||||||
BUN_VERSION: 1.4.5
|
BUN_VERSION: 1.4.5
|
||||||
SKIP_AUTHORS: renovate renovatebot
|
SKIP_AUTHORS: renovate renovatebot
|
||||||
|
SKIP_PR_TITLES: Develop Master Main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint-commits-and-pr:
|
lint-commits-and-pr:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Skip bot authors
|
- name: Skip bots and reverse merges
|
||||||
id: author
|
id: author
|
||||||
env:
|
env:
|
||||||
AUTHOR: ${{ github.event.pull_request.user.login }}
|
AUTHOR: ${{ github.event.pull_request.user.login }}
|
||||||
|
PR_TITLE: ${{ github.event.pull_request.title }}
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
author=$(printf '%s' "$AUTHOR" | tr '[:upper:]' '[:lower:]')
|
author=$(printf '%s' "$AUTHOR" | tr '[:upper:]' '[:lower:]')
|
||||||
|
title=$(printf '%s' "$PR_TITLE" | tr '[:upper:]' '[:lower:]')
|
||||||
skip=false
|
skip=false
|
||||||
for name in $SKIP_AUTHORS; do
|
for name in $SKIP_AUTHORS; do
|
||||||
name=$(printf '%s' "$name" | tr '[:upper:]' '[:lower:]')
|
name=$(printf '%s' "$name" | tr '[:upper:]' '[:lower:]')
|
||||||
@@ -31,9 +34,18 @@ jobs:
|
|||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
if [[ "$skip" == false ]]; then
|
||||||
|
for name in $SKIP_PR_TITLES; do
|
||||||
|
name=$(printf '%s' "$name" | tr '[:upper:]' '[:lower:]')
|
||||||
|
if [[ "$title" == "$name" ]]; then
|
||||||
|
skip=true
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
if [[ "$skip" == true || "$author" == *bot || "$author" == *'[bot]' ]]; then
|
if [[ "$skip" == true || "$author" == *bot || "$author" == *'[bot]' ]]; then
|
||||||
echo "skip=true" >> "$GITHUB_OUTPUT"
|
echo "skip=true" >> "$GITHUB_OUTPUT"
|
||||||
echo "Skipping commitlint for ${AUTHOR}"
|
echo "Skipping commitlint for ${AUTHOR}: ${PR_TITLE}"
|
||||||
else
|
else
|
||||||
echo "skip=false" >> "$GITHUB_OUTPUT"
|
echo "skip=false" >> "$GITHUB_OUTPUT"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in new issue
Block a user