-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #599 from thornbill/fix-sonar-job
Use pull_request_target trigger to run tests with secrets
- Loading branch information
Showing
2 changed files
with
58 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Test | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request_target: | ||
branches: [ master ] | ||
|
||
jobs: | ||
jest: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0 | ||
with: | ||
node-version: 16 | ||
check-latest: true | ||
cache: npm | ||
|
||
- name: Install Node.js dependencies | ||
run: npm ci --no-audit | ||
|
||
- name: Run jest | ||
run: npx jest --coverage --group=unit | ||
|
||
- name: SonarCloud scan | ||
if: ${{ github.repository == 'jellyfin/jellyfin-sdk-typescript' }} | ||
uses: SonarSource/sonarcloud-github-action@c25d2e7e3def96d0d1781000d3c429da22cd6252 # v2.0.2 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.JF_BOT_TOKEN }} | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
with: | ||
args: > | ||
-Dsonar.pullrequest.provider=github | ||
-Dsonar.pullrequest.github.repository=${{ github.repository }} | ||
-Dsonar.pullrequest.github.token.secured=${{ secrets.GITHUB_TOKEN }} | ||
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }} | ||
-Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }} | ||
-Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }} | ||
- name: Upload coverage | ||
if: ${{ github.repository == 'jellyfin/jellyfin-sdk-typescript' }} | ||
uses: codecov/codecov-action@eaaf4bedf32dbdc6b720b63067d99c4d77d6047d # v3.1.4 |