Skip to content

Commit

Permalink
try out sonar on PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
harrel56 committed Sep 17, 2023
1 parent 2964b51 commit 3c59d2b
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,42 @@ on:
workflows: [tests]
types: [completed]
jobs:
get-info:
runs-on: ubuntu-latest
outputs:
sourceHeadRepo: ${{ steps.workflow-run-info.outputs.sourceHeadRepo }}
sourceHeadBranch: ${{ steps.workflow-run-info.outputs.sourceHeadBranch }}
sourceHeadSha: ${{ steps.workflow-run-info.outputs.sourceHeadSha }}
mergeCommitSha: ${{ steps.workflow-run-info.outputs.mergeCommitSha }}
targetCommitSha: ${{ steps.workflow-run-info.outputs.targetCommitSha }}
pullRequestNumber: ${{ steps.workflow-run-info.outputs.pullRequestNumber }}
pullRequestLabels: ${{ steps.workflow-run-info.outputs.pullRequestLabels }}
targetBranch: ${{ steps.source-run-info.outputs.targetBranch }}
sourceEvent: ${{ steps.workflow-run-info.outputs.sourceEvent }}
steps:
- name: Get information about the source workflow
uses: potiuk/get-workflow-origin@v1
id: workflow-run-info
with:
token: ${{ secrets.GITHUB_TOKEN }}
sourceRunId: ${{ github.event.workflow_run.id }}

sonar-cloud:
needs: get-info
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success'
steps:
- run: >
echo
${{ needs.get-info.outputs.sourceHeadRepo }}
${{ needs.get-info.outputs.sourceHeadBranch }}
${{ needs.get-info.outputs.sourceHeadSha }}
${{ needs.get-info.outputs.mergeCommitSha }}
${{ needs.get-info.outputs.targetCommitSha }}
${{ needs.get-info.outputs.pullRequestNumber }}
${{ needs.get-info.outputs.pullRequestLabels }}
${{ needs.get-info.outputs.targetBranch }}
${{ needs.get-info.outputs.sourceEvent }}
- uses: actions/checkout@v3
with:
repository: ${{ github.event.workflow_run.head_repository.full_name }}
Expand Down

0 comments on commit 3c59d2b

Please sign in to comment.