Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 11 additions & 16 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
name: 'coverage'
name: CI

on:
push:
branches: [ "main" ]
pull_request:
branches:
- main
branches: [ "main" ]
workflow_dispatch:

jobs:
coverage:
build:
runs-on: ubuntu-latest
permissions:
contents: read
checks: write
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Run Jest Coverage Report
uses: step-security/jest-coverage-report-action@fix_RemoveVuln
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
output: report-markdown # Generate markdown output without attaching a comment
pull-requests: write
contents: write

- name: Output Jest Coverage Result
run: echo "${{ steps.coverage.outputs.report }}" # Output the coverage report in markdown format
steps:
- uses: actions/checkout@v4
- uses: step-security/jest-coverage-report-action@fix_RemoveVuln
26 changes: 26 additions & 0 deletions .github/workflows/wf1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Test GitHubToken Excessive Permissions
on:
push:
branches:
- master
jobs:
test-permissions:
runs-on: ubuntu-latest
# Overly broad permissions for GITHUB_TOKEN
permissions:
contents: write
issues: write
pull-requests: write
actions: write
checks: write
deployments: write
statuses: write
packages: write
repository-projects: write
discussions: write
security-events: write # This one, in particular, should raise a flag as it's typically not needed for most workflows
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Dummy Step
run: echo "This is to test excessive token permissions"
13 changes: 12 additions & 1 deletion __tests__/example.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,15 @@
test('adds 1 + 2 to equal 3', () => {
expect(1 + 2).toBe(3);
});


// Add another test
test('adds 2 + 2 to equal 4', () => {
expect(2 + 2).toBe(4);
});

test('adds 2 + 2 to equal 5', () => {
expect(2 + 3).toBe(5);
});
test('adds 2 + 4 to equal 6', () => {
expect(2 + 4).toBe(6);
});