coverallsapp / coverallsapp/github-action

Documentation Request- Add GitHub Secrets Exmaple

Open
#53 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
No language data
Stars
520
Forks
78
PR merge metrics
No merged PRs in 30d

Description

I found the JS/TS documentation a bit confusing as how to integrate the GithubActions/ CI.
I really struggled on how to inject the secret: COVERALLS_REPO_TOKEN

I could not get the coveralls github action to work... not sure if that was my laziness in not wanting to read more on the Github Actions or if there is bug...

I eventually ended up usiung Github Secrets and the solution involves less magic (AKA GitHub Action Magic)

NPM Config Example

package.json full reference is below

{ 
  "scripts":{
     "test": "nyc ts-node test/index.test.ts",
     "reportCov": "nyc report --reporter=text-lcov | coveralls",
}

GitHub Action File Exmaple

nodejs.yml full reference is below

name: Build & Tests
on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]
jobs:

  build:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [10.x, 12.x, 14.x]
    steps:
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}
    - name: CheckOut Latest
      uses: actions/checkout@v2
    - run: npm ci
    - run: npm run lint
    - run: npm run build --if-present
    
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node-version: [10.x, 12.x, 14.x]
    steps:
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}
    - name: CheckOut Latest
      uses: actions/checkout@v2
    - run: npm ci
    - name: Run Tests + Report Coverage
      env: 
        COVERALLS_SERVICE_NAME: 'GitHub CI'
        COVERALLS_GIT_BRANCH: master
        COVERALLS_REPO_TOKEN : ${{ secrets.COVERALLS_REPO_TOKEN }}
        NODE_COVERALLS_DEBUG: 0 # or 1 for verbsoe
      run: |
        npm run test && 
        npm run reportCov

Notice

All I needed to know when getting started with GitHub Actions was this line in the nodejs.yml
COVERALLS_REPO_TOKEN : ${{ secrets.COVERALLS_REPO_TOKEN }}

...Just thought I would drop this in your issues so that any future person searching through here might be able to scratch their own itch on how to integrate their npm run scripts and GitHub Actions/ CI

Anyway nice product and keep up the great work. I am new user, and enjoying it so far.

Referenced Files

For the files in the wild, the two full blown config files are:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the package.json and .github/workflows/nodejs.yml examples linked in the issue, then inspect the repository’s existing documentation entry point for CI guidance. Done means the documentation explains creating a GitHub Secret and wiring COVERALLS_REPO_TOKEN into the workflow, with the referenced links and example configuration presented clearly.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, javascript, typescript
Domain
ci-cd, documentation, testing
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.