From 8e0c90e72d2030bb62e49c58f17a6b6381cf897f Mon Sep 17 00:00:00 2001 From: Anton Medvedev Date: Sun, 13 Oct 2024 22:55:34 +0200 Subject: [PATCH] Update docs.yml --- .github/workflows/docs.yml | 36 +++++++++++++++++++++++++++++++++--- .github/workflows/sync.yml | 33 --------------------------------- 2 files changed, 33 insertions(+), 36 deletions(-) delete mode 100644 .github/workflows/sync.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index f3d2b2ffe..6303936d8 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -6,6 +6,9 @@ on: pull_request: branches: [ master ] +permissions: + contents: write + jobs: docgen: runs-on: ubuntu-latest @@ -17,9 +20,6 @@ jobs: with: php-version: '8.2' - - name: Validate composer.json and composer.lock - run: composer validate - - name: Get Composer Cache Directory id: composer-cache run: | @@ -47,3 +47,33 @@ jobs: echo $status; exit 1; } + + fix: + if: github.ref == 'refs/heads/master' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.2' + + - name: Get Composer Cache Directory + id: composer-cache + run: | + echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - uses: actions/cache@v4 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-composer- + + - name: Install dependencies + if: steps.composer-cache.outputs.cache-hit != 'true' + run: composer install --prefer-dist --no-progress + + - name: Run docgen + run: php bin/docgen diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml deleted file mode 100644 index 4642dcd01..000000000 --- a/.github/workflows/sync.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: sync - -on: - push: - branches: [ master ] - -permissions: - contents: write - -jobs: - docs: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '8.2' - - - name: Install dependencies - run: composer install --prefer-dist --no-progress - - - name: Run docgen - run: php bin/docgen - - - name: Add & Commit - uses: EndBug/add-and-commit@v9 - with: - default_author: github_actions - add: 'docs' - message: '[automatic] Update docs with bin/docgen' -