fixes #13: Action cache v3 is deprecated. #4
This file contains 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 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 |