coverallsapp / coverallsapp/github-action

Support for pull_request:close on base branch

Open
#110 0 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

Currently base branch reporting requires a push event type. A number of workflows that our team has use the pull_request: closed event like so:

name: Merge to main

on:
  pull_request:
    types: [closed]
    branches:
      - main

jobs:
  deploy:
    name: deploy
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - uses: actions/setup-node@v2
        with:
          node-version: 16.x
          cache: 'yarn'

      - run: yarn install --frozen-lockfile

      - run: yarn test --coverage --silent

      - uses: coverallsapp/github-action@1.1.3
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}

I believe this could work with an override of the GITHUB_EVENT_NAME, but this can not be done through env variables, so it would be great to have an input to override the event type (so for closed PRs on the default branch it can be overriden) something like:

      - uses: coverallsapp/github-action@1.1.3
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          git-branch: 'main'
          event-type: 'push'

That way the setting of CI_PULL_REQUEST can be skipped.

It would be even better if this was handled without needing to pass input overrides, but the input can give us a way to test a bit before it is handled by default. Worth note that I also tried setting git-branch: 'main' with no luck (I think branch is being picked up correctly through GITHUB_REF).

In the meantime we will have to have duplicate workflows with the different event type just to upload coverage, which isn't ideal. Please let me know if you need any more info.

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 in src/run.ts at the setting of CI_PULL_REQUEST referenced in the issue, then trace how the GitHub Actions event and base branch are read. Check the existing action inputs and tests, if present, before deciding how a closed pull_request event should be handled. Done means coverage uploads work for pull_request: closed on the base branch without duplicate workflows.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, typescript
Domain
ci-cd, testing
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.