Skip to content

Commit

Permalink
Merge pull request #490 from PHPCSStandards/feature/ghactions-use-git…
Browse files Browse the repository at this point in the history
…hub-token

GH Actions: special case Dependabot PRs for Coveralls
  • Loading branch information
jrfnl committed Jul 15, 2023
2 parents aa23fbf + 5c56087 commit f009108
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -363,23 +363,45 @@ jobs:
if: ${{ success() }}
run: composer global require php-coveralls/php-coveralls:"^2.5.3" --no-interaction

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

# Dependabot does not have access to secrets, other than the GH token.
# Ref: https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions
# Ref: https://github.com/lemurheavy/coveralls-public/issues/1721
- name: Upload coverage results to Coveralls (Dependabot)
if: ${{ success() && github.actor == 'dependabot[bot]' }}
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: php-${{ matrix.php }}-phpcs-${{ matrix.phpcs_version }}
run: php-coveralls -v -x build/logs/clover.xml

coveralls-finish:
needs: coverage
if: always() && needs.coverage.result == 'success'

runs-on: ubuntu-latest

steps:
- name: Coveralls Finished
- name: Coveralls Finished (normal)
if: ${{ github.actor != 'dependabot[bot]' }}
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.COVERALLS_TOKEN }}
parallel-finished: true

# Dependabot does not have access to secrets, other than the GH token.
# Ref: https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions
# Ref: https://github.com/lemurheavy/coveralls-public/issues/1721
- name: Coveralls Finished (Dependabot)
if: ${{ github.actor == 'dependabot[bot]' }}
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true

0 comments on commit f009108

Please sign in to comment.