coverallsapp/github-action

Support for pull_request:close on base branch

Opened this issue · 0 comments

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.