GRM-48: refactor: consolidate CI workflows to eliminate redundant runs
This commit is contained in:
+2
-64
@@ -3,8 +3,6 @@ name: CI
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize]
|
||||
push:
|
||||
branches: [master]
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
@@ -68,13 +66,8 @@ jobs:
|
||||
- name: Detect changed paths
|
||||
id: detect
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" = "pull_request" ]; then
|
||||
BASE="origin/master"
|
||||
HEAD="${{ github.event.pull_request.head.sha }}"
|
||||
else
|
||||
BASE="HEAD~1"
|
||||
HEAD="HEAD"
|
||||
fi
|
||||
BASE="origin/master"
|
||||
HEAD="${{ github.event.pull_request.head.sha }}"
|
||||
# Check if any Ansible-related files changed
|
||||
ANSIBLE_CHANGED=$(git diff --name-only "$BASE" "$HEAD" -- ansible/ .ansible-lint 2>/dev/null | head -1)
|
||||
if [ -n "$ANSIBLE_CHANGED" ]; then
|
||||
@@ -94,33 +87,6 @@ jobs:
|
||||
echo "No user-facing files changed — skipping release dry-run."
|
||||
fi
|
||||
|
||||
validate-merge:
|
||||
if: github.event_name == 'push'
|
||||
runs-on: docker
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 2
|
||||
- name: Validate commit message format
|
||||
run: |
|
||||
set -euo pipefail
|
||||
MSG=$(git log -1 --pretty=%s)
|
||||
echo "Commit message: $MSG"
|
||||
# Allowed formats:
|
||||
# GRM-N <type>: <description> (squash-merge)
|
||||
# release: vX.Y.Z (release commits)
|
||||
# GRM-N <type>: <description> (#M) (squash-merge with PR ref)
|
||||
if echo "$MSG" | grep -qE '^GRM-[0-9]+ [a-z]+: .+'; then
|
||||
echo "OK: GRM-N <conventional> format"
|
||||
elif echo "$MSG" | grep -qE '^release: v[0-9]+\.[0-9]+\.[0-9]+'; then
|
||||
echo "OK: release commit format"
|
||||
else
|
||||
echo "FAIL: commit message does not follow naming convention"
|
||||
echo "Expected: GRM-N <type>: <description> or release: vX.Y.Z"
|
||||
echo "Got: $MSG"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
discover-runners:
|
||||
needs: [detect-changes]
|
||||
if: needs.detect-changes.outputs.ansible-changed == 'true'
|
||||
@@ -178,34 +144,6 @@ jobs:
|
||||
MATRIX_INDEX: ${{ matrix.runner-index }}
|
||||
GITEA_REPOSITORY: ${{ github.repository }}
|
||||
|
||||
badges:
|
||||
needs: [quality]
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||||
runs-on: docker
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.REPO_TOKEN }}
|
||||
- name: Set up environment
|
||||
run: make setup
|
||||
- name: Generate badge JSON files
|
||||
run: |
|
||||
. .venv/bin/activate
|
||||
python3 scripts/generate_badges.py --output-dir .badges/
|
||||
- name: Push badges to badges branch
|
||||
env:
|
||||
PRE_COMMIT_ALLOW_NO_CONFIG: "1"
|
||||
run: |
|
||||
git config user.name "gitea-actions-bot"
|
||||
git config user.email "actions@oblachno.fyi"
|
||||
git checkout --orphan badges
|
||||
git rm -rf .
|
||||
cp -r .badges/* .
|
||||
git add *.svg
|
||||
git commit --no-verify -m "Update badges [skip ci]"
|
||||
git push origin badges --force
|
||||
|
||||
pr-review:
|
||||
if: github.event_name == 'pull_request'
|
||||
runs-on: docker
|
||||
|
||||
Reference in New Issue
Block a user