Skip to content

Commit e7ba986

Browse files
DogeTheBeasttuunit
andauthored
feat: filtering of event types (#131)
--------- Signed-off-by: Jan Larwig <jan@larwig.com> Co-authored-by: Jan Larwig <jan@larwig.com>
1 parent 7028164 commit e7ba986

File tree

6 files changed

+20
-4
lines changed

6 files changed

+20
-4
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ Use the following `input params` to customize it for your use case:-
5858
| `EMPTY_COMMIT_MSG` | :memo: empty commit to keep workflow active after 60 days of no activity | Commit message used when there are no updates |
5959
| `MAX_LINES` | 5 | The maximum number of lines populated in your readme file |
6060
| `TARGET_FILE` | README.md | The file to insert recent activity into |
61+
| `FILTER_EVENTS` | IssueCommentEvent,IssuesEvent,PullRequestEvent,ReleaseEvent | Display specific event type |
6162

6263
```yml
6364
name: Update README

action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ inputs:
3131
description: "Commit message used when there are no updates"
3232
default: ":memo: empty commit to keep workflow active after 60 days of no activity"
3333
required: false
34+
FILTER_EVENTS:
35+
description: "Events that should be displayed on profile"
36+
default: "IssueCommentEvent,IssuesEvent,PullRequestEvent,ReleaseEvent"
37+
required: false
38+
3439
branding:
3540
color: yellow
3641
icon: activity

dist/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19869,6 +19869,7 @@ const COMMIT_MSG = core.getInput("COMMIT_MSG");
1986919869
const MAX_LINES = core.getInput("MAX_LINES");
1987019870
const TARGET_FILE = core.getInput("TARGET_FILE");
1987119871
const EMPTY_COMMIT_MSG = core.getInput("EMPTY_COMMIT_MSG");
19872+
const FILTER_EVENTS = core.getInput("FILTER_EVENTS");
1987219873

1987319874
/**
1987419875
* Returns the sentence case representation
@@ -20059,7 +20060,11 @@ Toolkit.run(
2005920060

2006020061
const content = events.data
2006120062
// Filter out any boring activity
20062-
.filter((event) => serializers.hasOwnProperty(event.type))
20063+
.filter(
20064+
(event) =>
20065+
serializers.hasOwnProperty(event.type) &&
20066+
FILTER_EVENTS.includes(event.type),
20067+
)
2006320068
// We only have five lines to work with
2006420069
.slice(0, MAX_LINES)
2006520070
// Call the serializer to construct a string

index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const COMMIT_MSG = core.getInput("COMMIT_MSG");
1111
const MAX_LINES = core.getInput("MAX_LINES");
1212
const TARGET_FILE = core.getInput("TARGET_FILE");
1313
const EMPTY_COMMIT_MSG = core.getInput("EMPTY_COMMIT_MSG");
14+
const FILTER_EVENTS = core.getInput("FILTER_EVENTS");
1415

1516
/**
1617
* Returns the sentence case representation
@@ -201,7 +202,11 @@ Toolkit.run(
201202

202203
const content = events.data
203204
// Filter out any boring activity
204-
.filter((event) => serializers.hasOwnProperty(event.type))
205+
.filter(
206+
(event) =>
207+
serializers.hasOwnProperty(event.type) &&
208+
FILTER_EVENTS.includes(event.type),
209+
)
205210
// We only have five lines to work with
206211
.slice(0, MAX_LINES)
207212
// Call the serializer to construct a string

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "github-activity-readme",
3-
"version": "0.4.6",
3+
"version": "0.5.0",
44
"description": "Updates README with the recent GitHub activity of a user",
55
"main": "index.js",
66
"keywords": [],

0 commit comments

Comments
 (0)