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

Feature: Split PR & issues into separate events #272

Merged
merged 10 commits into from
May 2, 2023

Conversation

A2-NieR
Copy link
Contributor

@A2-NieR A2-NieR commented Apr 1, 2023

  • read and understood the Contributing Guidelines
  • Updated any nessecary files such as the README.md and/or CHANGELOG.md.

Type of Pull request

  • Minor Change
    This Pull request doesn't break existing configuration.
  • Major Change
    This Pull request will break existing configuration.
  • Bug fix
    This Pull request will fix a (critical) bug.
  • Documentation
    This Pull request only changes documentation (README.md, CHANGELOG.md, etc.)
  • Other: __________

Description

This PR splits the pr and issue events into different events so users can better include/exclude specific events.

To Do:

  • Update changelog after Merge/Release

@A2-NieR A2-NieR changed the title Feature: Split PR events into separate open/merge/close events Feature: Split PR & issues into separate events Apr 1, 2023
@abhijoshi2k
Copy link
Member

For backward compatibility, we shouldn't discard the original pr and issue events.
If the older events are excluded, they should block all sub events.

For example, if pr is excluded, it should block pr_opened, pr_merged and pr_closed events.

@A2-NieR
Copy link
Contributor Author

A2-NieR commented Apr 3, 2023

For backward compatibility, we shouldn't discard the original pr and issue events. If the older events are excluded, they should block all sub events.

For example, if pr is excluded, it should block pr_opened, pr_merged and pr_closed events.

Makes sense. I will look into it.
Btw. how does one test the workflow? Tried with act but always run into this error:

act -s GITHUB_TOKEN=ghp_xyz... -j build -W .github/workflows/test-workflow.yml

docker exec cmd=[node /var/run/act/actions/Readme-Workflows-recent-activity@main/dist/index.js] user= workdir=
| serializers
| {
|   PushEvent: [Function: PushEvent],
|   IssuesEvent: [Function: IssuesEvent],
|   PullRequestEvent: [Function: PullRequestEvent],
|   CreateEvent: [Function: CreateEvent],
|   ForkEvent: [Function: ForkEvent],
|   GollumEvent: [Function: GollumEvent],
|   MemberEvent: [Function: MemberEvent],
|   PullRequestReviewEvent: [Function: PullRequestReviewEvent],
|   ReleaseEvent: [Function: ReleaseEvent],
|   WatchEvent: [Function: WatchEvent]
| }
| ✖  error     Event `push` is not supported by this action.

@abhijoshi2k
Copy link
Member

You can run the workflow on your own repo to test it.
For example, you can run the workflow by editing your workflow file as: BunnyTheLifeguard/recent-activity@feat/split-pr-events

@PuneetGopinath PuneetGopinath added Status: In progress This pr or issue is in progress Type: breaking This change will break previous versions labels Apr 10, 2023
@@ -10,8 +10,11 @@ const IssueCommentEvent = require("./events/IssueCommentEvent");
const CommitCommentEvent = require("./events/CommitCommentEvent");
const PullRequestReviewCommentEvent = require("./events/PullRequestReviewCommentEvent");
const PushEvent = require("./events/PushEvent");
const IssuesEvent = require("./events/IssuesEvent");
const PullRequestEvent = require("./events/PullRequestEvent");
const IssuesOpenEvent = require("./events/IssuesOpenEvent");
Copy link
Member

Choose a reason for hiding this comment

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

This is where the problem lies. GitHub API does not provide a type of the value "IssuesOpenEvent" or the other new names that you have made. Due to this change, while testing I see that none of the issue and pull request-related events are shown in the profile.
You can checkout https://docs.github.com/en/developers/webhooks-and-events/github-event-types for the docs

Copy link
Member

Choose a reason for hiding this comment

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

You have to modify the functions/filterContent.js file to use the respective serializers for their respective events

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah I see, thanks for the info.
Rn I don't have the time, so I can close the PR until I can look into this if you want me to?

Copy link
Member

Choose a reason for hiding this comment

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

You don't need to close the pr, let it be open. Whenever free you can look into the issue, that's not an problem.
We appreciate your efforts to contribute to Readme-Workflows!

Copy link
Member

@PuneetGopinath PuneetGopinath left a comment

Choose a reason for hiding this comment

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

Please do the needful.

@A2-NieR A2-NieR force-pushed the feat/split-pr-events branch 4 times, most recently from f423e4f to cdd8e50 Compare April 15, 2023 13:51
@A2-NieR
Copy link
Contributor Author

A2-NieR commented Apr 15, 2023

Reverted the Events according to the GH API and implemented a filter to extract disabled issues/pr actions.

@PuneetGopinath
Copy link
Member

Reverted the Events according to the GH API and implemented a filter to extract disabled issues/pr actions.

Sorry, I read the comment and the forgot it totally.
Did you test it? If so can you show the workflow results

I'm really very sorry for being inactive.

@PuneetGopinath
Copy link
Member

@Andre601 @abhijoshi2k Should we change 2021 to 2023 in the copyright in all code files? Or instead 2021 - 2023?
What's your opinion?

And the code has been tested and works... LGTM @bunnythelifeguard
Thank you for your contribution!

@A2-NieR
Copy link
Contributor Author

A2-NieR commented Apr 24, 2023

@Andre601 @abhijoshi2k Should we change 2021 to 2023 in the copyright in all code files? Or instead 2021 - 2023? What's your opinion?

And the code has been tested and works... LGTM @bunnythelifeguard Thank you for your contribution!

Awesome, thanks.

In my own repo I saw that PR stuff was listed again, but had no time to test for merge, close etc. :/

@abhijoshi2k
Copy link
Member

@PuneetGopinath I think we can change that to 2023. Feel free to do the change before release.

@PuneetGopinath PuneetGopinath merged commit fba5248 into Readme-Workflows:main May 2, 2023
2 checks passed
@PuneetGopinath
Copy link
Member

@Andre601 Can you do the release? I don't remember anything after a year of not touching github 😄

@Andre601
Copy link
Member

Andre601 commented May 2, 2023

@Andre601 Can you do the release? I don't remember anything after a year of not touching github 😄

Me neither. Need to look at this.
What release version should it be?

PuneetGopinath added a commit to PuneetGopinath/recent-activity that referenced this pull request May 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: In progress This pr or issue is in progress Type: breaking This change will break previous versions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants