github-activity-readme
github-activity-readme copied to clipboard
Add INJECT option to inject js at runtime (and some other stuff, I got carried away)
This makes it possible for people to, for example: extend the script to work with other event types, and filter events
an example of js that I would like to inject is
// add serializer for releases
serializers.ReleaseEvent = (item) => {
return `🏷️ Released [${item.payload.tag_name}](${urlPrefix}/${item.repo.name}/releases/${item.payload.tag_name}) of ${toUrlFormat(
item.repo.name
)}`;
}
// only show one event of each type
processEvents = (events) => {
const output = []
const usedTypes = []
// Filter out any boring activity
const filtered = events.filter((event) => serializers.hasOwnProperty(event.type))
filtered.forEach(event => {
if (!usedTypes.includes(event.type)) {
usedTypes.push(event.type)
output.push(serializers[item.type](item))
}
});
}
Hi @non-bin seems like a cool idea and you seem to know what you are doing. Unfortunately, not everyone is this well versed with JavaScript. This feature would broaden the scope of the Action way to much and I see the risk of unintended malfunction and code injection. Which would most likely cause a lot of raised issues that are not truly related to this GitHub Action.
Therefore I unfortunately have to decline this PR to keep the scope in line and manageable.
FYI: Release event will be added with #97
Fair enough, I'll keep using it just thought someone might find it useful ☺️