-
Notifications
You must be signed in to change notification settings - Fork 0
48 lines (40 loc) · 1.67 KB
/
validate-feature-branches.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
name: Validate Feature Branches
on:
push:
branches:
- 'feature/*'
pull_request:
branches:
- 'feature/*'
jobs:
validate_feature_branches:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
- name: Install Composer dependencies
uses: php-actions/composer@v6
with:
php_version: "8.3"
version: "2"
args: "--ignore-platform-reqs --optimize-autoloader"
- name: Run on feature branches
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/feature/')
run: |
# Run all commands and capture their exit statuses
vendor/bin/robo validate:branch-name || status1=$? || status1=0
vendor/bin/robo validate:composer-lock || status3=$? || status3=0
vendor/bin/robo validate:coding-standards || status2=$? || status2=0
# Exit with a non-zero status if any command failed
if [ "$status1" -ne 0 ] || [ "$status2" -ne 0 ] || [ "$status3" -ne 0 ]; then
exit 1
fi
- name: Run on pull requests
if: github.event_name == 'pull_request' && startsWith(github.head_ref, 'feature/')
run: |
vendor/bin/robo validate:commit-messages