Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why running only for pull requests events? #280

Closed
uilianries opened this issue Mar 2, 2024 · 2 comments
Closed

Why running only for pull requests events? #280

uilianries opened this issue Mar 2, 2024 · 2 comments

Comments

@uilianries
Copy link

Hello and thank you for providing this project, it's really useful!

Currently I'm trying to use it for a project, but it seems like I can not decide about the logic involving the event due the follow condition:

if (eventName !== 'pull_request') {

const eventName = context.eventName
    if (eventName !== 'pull_request') {
      core.setFailed(`action support only pull requests but event is ${eventName}`)
      return
    }

So, basically we are only running nightly and manual workflow_dispatch CI jobs, which means, this project can not be used, because we still are not running for pull requests.

I would like to ask to raise that condition if possible, so users could decide the logic directly in their CI flow, instead:

- name: Coverage report
  if: github.event_name == 'pull_request'
  uses: orgoro/coverage@v3.1
  with:
    coverageFile: xmlcov/coverage.xml
    token: ${{ secrets.GITHUB_TOKEN }}

Regards!

@uilianries uilianries changed the title Why running only when pull requests event? Why running only for pull requests events? Mar 2, 2024
@orgoro
Copy link
Owner

orgoro commented Mar 29, 2024

it will require changes to the underlaying code to support the different events
I see one type of event is addressed here - #281

I will merge that PR to support the new event once it's fixed

@techman83
Copy link

This isn't as trivial as it might seem on the surface, as it is building a report on coverage when compared to the base reference, which is incredibly context specific.

From the environment variable docs

The name of the base ref or target branch of the pull request in a workflow run. This is only set when the event that triggers a workflow run is either pull_request or pull_request_target. For example, main.

Now, could this information be gathered for other event types, certainly. But what would be gained over simply calling something like, beyond a pretty summary for the work flow?

- name: Check Cover
  run: coverage report --fail-under=80

It would likely require an event parser, and potentially more complex configuration interface. Which might be out of scope for the goals of the action.

@orgoro orgoro closed this as completed Jul 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants