Run Ide-helper automatically #13
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
on: [ pull_request ] | |
name: CI | |
jobs: | |
refresh-ide-helper: | |
runs-on: ubuntu-latest | |
container: | |
image: kirschbaumdevelopment/laravel-test-runner:8.2 | |
services: | |
mysql: | |
image: mysql:8.3 | |
env: | |
MYSQL_ROOT_PASSWORD: password | |
MYSQL_DATABASE: test | |
ports: | |
- 33306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install composer dependencies | |
run: | | |
composer install --no-scripts | |
- name: Prepare Laravel Application | |
run: | | |
cp .env.ci .env | |
php artisan key:generate | |
- name: Set up database | |
run: | | |
php artisan migrate:fresh | |
- name: Configure Git | |
run: | | |
git config --global user.name 'github-actions' | |
git config --global user.email '[email protected]' | |
git config --global --add safe.directory /__w/mars/mars # Add the original repo name as safe | |
- name: Fetch latest changes from the remote branch | |
run: git fetch https://x-access-token:${GH_PAT}@github.com/${{ github.repository }}.git HEAD:refs/heads/${{ github.head_ref }} | |
- name: Merge changes from the remote branch | |
run: git merge https://x-access-token:${GH_PAT}@github.com/${{ github.repository }}/${{ github.head_ref }} --ff-only | |
- name: Generate ide-helper comments | |
run: php artisan ide-helper:refresh | |
- name: Commit changes | |
run: | | |
git add . | |
git commit -m "Refresh ide-helper automatically" || echo "No changes to commit" | |
- name: Extract branch name | |
id: extract_branch | |
run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV | |
- name: Push changes | |
env: | |
GH_PAT: ${{ secrets.GH_PAT }} | |
run: | | |
git push https://x-access-token:${GH_PAT}@github.com/${{ github.repository }}.git HEAD:refs/heads/${{ github.head_ref }} |