name: Auto Update Icons on: push: schedule: - cron: '0 12 * * 1' jobs: generate: runs-on: ubuntu-latest strategy: fail-fast: true matrix: php: [8.2] laravel: [^8.2] name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} steps: - name: Checkout code uses: actions/checkout@v4 with: ref: ${{ github.head_ref }} - name: Read DotEnv File uses: c-py/action-dotenv-to-setenv@v2 with: env-file: .env - name: Checkout dependent repo uses: actions/checkout@v4 with: repository: ${{ env.REPOSITORY }} ref: ${{ env.BRANCH }} path: ./dist - id: latest-commit name: Get the latest commit run: | echo 'LATEST_COMMIT<> $GITHUB_ENV cd ./dist && git log --format="%H" -n 1 >> $GITHUB_ENV echo 'EOF' >> $GITHUB_ENV - id: current-commit name: Get current commit uses: juliangruber/read-file-action@v1 with: path: ./.commit - name: Add versions to environment run: | echo "CURRENT_COMMIT=${{ steps.current-commit.outputs.content }}" >> $GITHUB_ENV - name: Output versions run: | echo "Current commit: ${{ env.CURRENT_COMMIT }}" echo "Latest commit: ${{ env.LATEST_COMMIT }}" - name: Install dependencies run: composer update --no-interaction --no-progress --dev - name: Compile icons to resources directory if: env.CURRENT_COMMIT != env.LATEST_COMMIT run: ./vendor/bin/blade-icons-generate - name: Update commit hash in ".commit" if: env.CURRENT_COMMIT != env.LATEST_COMMIT run: echo ${{ env.LATEST_COMMIT }}>./.commit - name: Create PR for latest version if: env.CURRENT_COMMIT != env.LATEST_COMMIT uses: peter-evans/create-pull-request@v3 with: commit-message: "auto-update: update icons with the latest commit ${{ env.LATEST_COMMIT }}" committer: GitHub Action author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> title: "chore: update icons with the latest commit v${{ env.LATEST_COMMIT }}" body: | This updates from [${{ env.CURRENT_COMMIT }}](https://github.com/${{ env.REPOSITORY }}/commit/${{ env.CURRENT_COMMIT }}) to [${{ env.LATEST_COMMIT }}](https://github.com/${{ env.REPOSITORY }}/commit/${{ env.LATEST_COMMIT }}). Check out the differences: [`${{ env.CURRENT_COMMIT }}` ... `${{ env.LATEST_COMMIT }}`](https://github.com/${{ env.REPOSITORY }}/compare/${{ env.CURRENT_COMMIT }}...${{ env.LATEST_COMMIT }}) branch: feature/update-${{ env.LATEST_COMMIT }}