diff --git a/.github/workflows/l5-swagger-generate.yml b/.github/workflows/l5-swagger-generate.yml index 8c7d7fa1..074c1658 100644 --- a/.github/workflows/l5-swagger-generate.yml +++ b/.github/workflows/l5-swagger-generate.yml @@ -57,7 +57,9 @@ jobs: - name: Install dependencies uses: "ramsey/composer-install@v3" env: - COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.PAT }}"} }' + # Every locked package comes from a public repository, so the job token is enough + # to authenticate the downloads. Dependabot runs receive no repository secrets. + COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ github.token }}"} }' - name: Generate OpenAPI docs run: php artisan l5-swagger:generate @@ -99,7 +101,14 @@ jobs: pages-preview: name: Publish Swagger UI to GitHub Pages needs: openapi-generate - if: github.event_name == 'pull_request' + # Only for pull requests that a person opened from a branch of this repository. + # On a Dependabot pull request the permissions below still raise the job token, so + # the preview would publish output generated while unreviewed dependency code ran. + # Bot accounts, Dependabot included, have the type "Bot". + if: >- + github.event_name == 'pull_request' && + github.event.pull_request.user.type == 'User' && + github.event.pull_request.head.repo.full_name == github.repository runs-on: ubuntu-latest permissions: diff --git a/.github/workflows/nightly_unit_tests.yml b/.github/workflows/nightly_unit_tests.yml index c9b7d6d6..9f8fd50b 100644 --- a/.github/workflows/nightly_unit_tests.yml +++ b/.github/workflows/nightly_unit_tests.yml @@ -58,7 +58,9 @@ jobs: - name: Install dependencies uses: "ramsey/composer-install@v3" env: - COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.PAT }}"} }' + # Every locked package comes from a public repository, so the job token is enough + # to authenticate the downloads. Dependabot runs receive no repository secrets. + COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ github.token }}"} }' - name: 'Run Tests' run: | ./update_doctrine.sh diff --git a/.github/workflows/pull_request_unit_tests.yml b/.github/workflows/pull_request_unit_tests.yml index f150ee00..706c58a1 100644 --- a/.github/workflows/pull_request_unit_tests.yml +++ b/.github/workflows/pull_request_unit_tests.yml @@ -63,7 +63,9 @@ jobs: - name: Install dependencies uses: "ramsey/composer-install@v3" env: - COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.PAT }}"} }' + # Every locked package comes from a public repository, so the job token is enough + # to authenticate the downloads. Dependabot runs receive no repository secrets. + COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ github.token }}"} }' - name: 'Run Tests' env: TEST_USER_EMAIL: ${{ secrets.TEST_USER_EMAIL }} diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 88d4189a..34400038 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -59,7 +59,9 @@ jobs: - name: Install dependencies uses: "ramsey/composer-install@v3" env: - COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.PAT }}"} }' + # Every locked package comes from a public repository, so the job token is enough + # to authenticate the downloads. Dependabot runs receive no repository secrets. + COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ github.token }}"} }' - name: 'Run Tests' env: TEST_USER_EMAIL: ${{ secrets.TEST_USER_EMAIL }}