Skip to content

Commit f009108

Browse files
authored
Merge pull request #490 from PHPCSStandards/feature/ghactions-use-github-token
GH Actions: special case Dependabot PRs for Coveralls
2 parents aa23fbf + 5c56087 commit f009108

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

.github/workflows/test.yml

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -363,23 +363,45 @@ jobs:
363363
if: ${{ success() }}
364364
run: composer global require php-coveralls/php-coveralls:"^2.5.3" --no-interaction
365365

366-
- name: Upload coverage results to Coveralls
367-
if: ${{ success() }}
366+
- name: Upload coverage results to Coveralls (normal)
367+
if: ${{ success() && github.actor != 'dependabot[bot]' }}
368368
env:
369369
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
370370
COVERALLS_PARALLEL: true
371371
COVERALLS_FLAG_NAME: php-${{ matrix.php }}-phpcs-${{ matrix.phpcs_version }}
372372
run: php-coveralls -v -x build/logs/clover.xml
373373

374+
# Dependabot does not have access to secrets, other than the GH token.
375+
# Ref: https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions
376+
# Ref: https://github.com/lemurheavy/coveralls-public/issues/1721
377+
- name: Upload coverage results to Coveralls (Dependabot)
378+
if: ${{ success() && github.actor == 'dependabot[bot]' }}
379+
env:
380+
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
381+
COVERALLS_PARALLEL: true
382+
COVERALLS_FLAG_NAME: php-${{ matrix.php }}-phpcs-${{ matrix.phpcs_version }}
383+
run: php-coveralls -v -x build/logs/clover.xml
384+
374385
coveralls-finish:
375386
needs: coverage
376387
if: always() && needs.coverage.result == 'success'
377388

378389
runs-on: ubuntu-latest
379390

380391
steps:
381-
- name: Coveralls Finished
392+
- name: Coveralls Finished (normal)
393+
if: ${{ github.actor != 'dependabot[bot]' }}
382394
uses: coverallsapp/github-action@v2
383395
with:
384396
github-token: ${{ secrets.COVERALLS_TOKEN }}
385397
parallel-finished: true
398+
399+
# Dependabot does not have access to secrets, other than the GH token.
400+
# Ref: https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions
401+
# Ref: https://github.com/lemurheavy/coveralls-public/issues/1721
402+
- name: Coveralls Finished (Dependabot)
403+
if: ${{ github.actor == 'dependabot[bot]' }}
404+
uses: coverallsapp/github-action@v2
405+
with:
406+
github-token: ${{ secrets.GITHUB_TOKEN }}
407+
parallel-finished: true

0 commit comments

Comments
 (0)