diff --git a/README.md b/README.md index 6016ef6..5a10491 100644 --- a/README.md +++ b/README.md @@ -17,17 +17,17 @@ A GitHub Action that automatically updates your README file with the latest acti ## ✍️ Example - -1. ⭐ Starred [tandpfun/skill-icons](https://github.com/tandpfun/skill-icons) -2. 📝 Committed to [TheDanniCraft/activity-log](https://github.com/TheDanniCraft/activity-log/commit/82a29a67caae5401f63fbfa2881b547a120922d0) -3. 📝 Committed to [TheDanniCraft/TheDanniCraft](https://github.com/TheDanniCraft/TheDanniCraft/commit/2d8c4c86ad40a8a4b36bc3efb4cf809a28a77bf3) -4. 📝 Committed to [TheDanniCraft/activity-log](https://github.com/TheDanniCraft/activity-log/commit/8d08a705672161fecc9bcb1161cad02c0f31cabb) -5. 📝 Committed to [TheDanniCraft/activity-log](https://github.com/TheDanniCraft/activity-log/commit/fa768ba9bcd8eb7b77f0bc3aa85127337fba4761) -6. 📝 Committed to [TheDanniCraft/TheDanniCraft](https://github.com/TheDanniCraft/TheDanniCraft/commit/c93f85be52d453b7d15762d546b01f82831ddd98) -7. 🚀 Published release [`v1.0.2`](https://github.com/TheDanniCraft/activity-log/releases/tag/v1.0.2) in [TheDanniCraft/activity-log](https://github.com/TheDanniCraft/activity-log) -8. ➕ Created a new tag [`v1.0.2`](https://github.com/TheDanniCraft/activity-log/releases/tag/v1.0.2) in [TheDanniCraft/activity-log](https://github.com/TheDanniCraft/activity-log) -9. 📝 Committed to [TheDanniCraft/activity-log](https://github.com/TheDanniCraft/activity-log/commit/de1389ed933016c081bf18183df7c578563ed29f) -10. 📝 Committed to [TheDanniCraft/activity-log](https://github.com/TheDanniCraft/activity-log/commit/68ef80852f64d9f9a7b658398c3bf4550492dd64) + +1. ⭐ Starred [tandpfun/skill-icons](https://github.com/tandpfun/skill-icons) +2. 📝 Committed to [TheDanniCraft/activity-log](https://github.com/TheDanniCraft/activity-log/commit/82a29a67caae5401f63fbfa2881b547a120922d0) +3. 📝 Committed to [TheDanniCraft/TheDanniCraft](https://github.com/TheDanniCraft/TheDanniCraft/commit/2d8c4c86ad40a8a4b36bc3efb4cf809a28a77bf3) +4. 📝 Committed to [TheDanniCraft/activity-log](https://github.com/TheDanniCraft/activity-log/commit/8d08a705672161fecc9bcb1161cad02c0f31cabb) +5. 📝 Committed to [TheDanniCraft/activity-log](https://github.com/TheDanniCraft/activity-log/commit/fa768ba9bcd8eb7b77f0bc3aa85127337fba4761) +6. 📝 Committed to [TheDanniCraft/TheDanniCraft](https://github.com/TheDanniCraft/TheDanniCraft/commit/c93f85be52d453b7d15762d546b01f82831ddd98) +7. 🚀 Published release [`v1.0.2`](https://github.com/TheDanniCraft/activity-log/releases/tag/v1.0.2) in [TheDanniCraft/activity-log](https://github.com/TheDanniCraft/activity-log) +8. ➕ Created a new tag [`v1.0.2`](https://github.com/TheDanniCraft/activity-log/releases/tag/v1.0.2) in [TheDanniCraft/activity-log](https://github.com/TheDanniCraft/activity-log) +9. 📝 Committed to [TheDanniCraft/activity-log](https://github.com/TheDanniCraft/activity-log/commit/de1389ed933016c081bf18183df7c578563ed29f) +10. 📝 Committed to [TheDanniCraft/activity-log](https://github.com/TheDanniCraft/activity-log/commit/68ef80852f64d9f9a7b658398c3bf4550492dd64) ## 📖Usage @@ -127,6 +127,7 @@ Please note that only those public events that belong to the following list show - `StarEvent` - `PublicEvent` - `SponsorshipEvent` +- `GollumEvent` You can find an example [here](https://github.com/TheDanniCraft/activity-log/blob/master/.github/workflows/update-activity.yml). diff --git a/src/utils/eventDescriptions.js b/src/utils/eventDescriptions.js index 6b433df..8fb07d8 100644 --- a/src/utils/eventDescriptions.js +++ b/src/utils/eventDescriptions.js @@ -228,7 +228,30 @@ const eventDescriptions = { return isPrivate ? '🤝 Supported a sponsor in a private repo' : `🤝 Sponsored [${sponsorship.sponsor.login}](${sponsorUrl}) for [${repo.name}](${sponsoredUrl})`; - } + }, + + 'GollumEvent': ({ repo, isPrivate, payload }) => { + const pageCounts = payload.pages.reduce((counts, page) => { + if (page.action === 'created') { + counts.created += 1; + } else if (page.action === 'edited') { + counts.edited += 1; + } + return counts; + }, { created: 0, edited: 0 }); + + const { created, edited } = pageCounts; + const totalUpdated = created + edited; + + let description = ''; + if (totalUpdated > 0) { + description = isPrivate + ? `📝 Updated ${totalUpdated} page${totalUpdated > 1 ? 's' : ''}${created > 0 ? ` (+${created} new page${created > 1 ? 's' : ''})` : ''} in a private repo` + : `📝 Updated ${totalUpdated} page${totalUpdated > 1 ? 's' : ''}${created > 0 ? ` (+${created} new page${created > 1 ? 's' : ''})` : ''} in [${repo.name}](https://github.com/${repo.name})`; + } + + return description; + }, }; module.exports = eventDescriptions;