Skip to content

Conversation

@dgolombek
Copy link

@dgolombek dgolombek commented Oct 27, 2025

Description

This addresses #615 by adding the new ACTIVITY parameters. When this is specified, it overrides the default event-to-activity heuristic in #find_activity and selects the activity to run directly. This allows the end user to write their logic in the workflows when required.

Testing

I've added unit tests for these, but I haven't added integration or end-to-end tests, I was unable to get the environment set up correctly.

@github-actions
Copy link

End-to-end public repo

Admin commands cheatsheet:

  • /e2e (in approved PR review body): Trigger end-to-end tests on external contributions
  • /invite (in comment): Invite the author & admins to the end-to-end private repo

@dgolombek dgolombek force-pushed the custom_event_dispatching branch from ff1c83e to 01882d1 Compare October 27, 2025 01:55
@github-actions
Copy link

github-actions bot commented Oct 27, 2025

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  coverage_comment
  activity.py
  main.py 78
  settings.py
Project Total  

This report was generated by python-coverage-comment-action

README.md Outdated
Comment on lines 482 to 498

# List of Github Events which should be treated as Pull Requests,
# analyzing the .coverage file as described in [PR Mode](#pr-mode)
# above. Specified as a comma-separated list
EVENTS_AS_PR: ""

# List of Github Events which should extract the coverage rate and store
# information onto the dedicated coverage branch, as described in
# [Default Branch Mode](#default-branch-mode) above. Specified as a
# comma-separated list.
EVENTS_AS_COVERAGE: ""

# List of Github Events which should result solely in comments being posted
# to the pull request. See
# [Commenting on the PR on the `push` event](#commenting-on-the-pr-on-the-push-event)
# below. Specified as a comma-separated list.
EVENTS_AS_COMMENT: ""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit skeptical of exposing events_as configuration, as something like push could be a PR if on a feature branch and a "coverage" if on the default branch ? Shouldn't we expose directly activity = "process_pr" / "post_comment" / "save_coverage_data_files" ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would certainly lead to much simpler code in the action, at the cost (but power) of logic in the user's workflow files. I wish the embedded logic in workflows was a bit cleaner, or that you could directly embed a snippet of javascript in the action definition, but there are always ways of achieving what you need.

Copy link
Member

@ewjoachim ewjoachim Oct 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can add readme for "usual" cases:

with:
  activity: "${{ github.event_name == 'push' && 'save_coverage_data_files' || 'process_pr' }}"

# or
with:
  activity: "${{ (github.event_name == 'push' && github.ref_name == 'main') && 'save_coverage_data_files' || 'process_pr' }}"

I'd say that starting from this, it should be fairly easy to tweak and achieve what you want ? I'm open to different opinions ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I think that makes sense, and I've updated the code accordingly.

Copy link
Member

@ewjoachim ewjoachim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome start :)

@dgolombek dgolombek force-pushed the custom_event_dispatching branch from 6550942 to 89e663b Compare October 27, 2025 16:40
### Description

This addresses py-cov-action#615 by adding the new ACTIVITY parameters. When this
is specified, it overrides the default event-to-activity heuristic in
#find_activity and selects the activity to run directly. This allows
the end user to write their logic in the workflows when required.

### Testing

I've added unit tests for these, but I haven't added integration or
end-to-end tests, I was unable to get the environment set up
correctly.
@dgolombek dgolombek force-pushed the custom_event_dispatching branch from 7358075 to f636f2d Compare October 28, 2025 14:20
@dgolombek dgolombek requested a review from ewjoachim October 30, 2025 16:51
@dgolombek
Copy link
Author

@ewjoachim sorry, I lost track of this. What are your thoughts on the last update here?

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

Successfully merging this pull request may close these issues.

2 participants