Skip to content

Commit

Permalink
Update permissions and add badge generation for Stryker mutation score
Browse files Browse the repository at this point in the history
  • Loading branch information
stenjo committed Oct 10, 2024
1 parent 6978dc9 commit 8208ba6
Showing 1 changed file with 28 additions and 12 deletions.
40 changes: 28 additions & 12 deletions .github/workflows/stryker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ on:
- main

permissions:
contents: read
contents: write
issues: write
pull-requests: write
pages: write

jobs:
stryker-js:
Expand All @@ -35,30 +36,23 @@ jobs:
- name: Install dependencies
run: npm install

- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.GIST_APP_ID }}
private-key: ${{ secrets.GIST_APP_KEY }}
owner: ${{ github.repository_owner }}

- name: Run StrykerJS
continue-on-error: true
id: stryker
run: |
npm run stryker > out
- name: Print output
continue-on-error: true
run: cat out

- name: Save stryker JS log
if: failure()
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: stryker.log
path: stryker.log

- name: Print output
continue-on-error: true
run: cat out

- name: Extract stryker score
id: extract-stryker-score
Expand All @@ -68,6 +62,13 @@ jobs:
awk '{split($0,a,"."); print a[1]}' fullscore > score
echo "stryker-score=$(tr -s '\n' < score)" >> "$GITHUB_ENV"
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.GIST_APP_ID }}
private-key: ${{ secrets.GIST_APP_KEY }}
owner: ${{ github.repository_owner }}

- name: Create the Badge for Deploy Rate
continue-on-error: true
uses: Schneegans/[email protected]
Expand All @@ -76,6 +77,21 @@ jobs:
gistID: 9ce1ad7d8e9db99796e782b244eefa4a
filename: dora-stryker.json
label: Mutation Score
namedLogo: stryker
message: ${{ steps.extract-stryker-score.outputs.stryker-score }}%
minColorRange: 50
maxColorRange: 90
valColorRange: ${{ steps.extract-stryker-score.outputs.stryker-score }}

- name: Create the SVG Badge for Deploy Rate
continue-on-error: true
uses: Schneegans/[email protected]
with:
auth: ${{ steps.app-token.outputs.token }}
gistID: 9ce1ad7d8e9db99796e782b244eefa4a
filename: dora-stryker.svg
label: Mutation Score
namedLogo: stryker
message: ${{ steps.extract-stryker-score.outputs.stryker-score }}%
minColorRange: 50
maxColorRange: 90
Expand Down

0 comments on commit 8208ba6

Please sign in to comment.