-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new event actions and examples from example payload files provi…
- Loading branch information
Showing
95 changed files
with
36,579 additions
and
4,004 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
module.exports = getActionsAndExamplesFromPayloads | ||
|
||
const { readdirSync } = require('fs') | ||
|
||
function getActionsAndExamplesFromPayloads () { | ||
const eventsByName = {} | ||
for (const path of readdirSync('payload-examples/api.github.com')) { | ||
const [name] = path.split('.') | ||
|
||
const payload = require(`../payload-examples/api.github.com/${path}`) | ||
|
||
if (!eventsByName[name]) { | ||
eventsByName[name] = { | ||
actions: [], | ||
examples: [] | ||
} | ||
} | ||
|
||
if (payload.action) { | ||
eventsByName[name].actions.push(payload.action) | ||
} | ||
eventsByName[name].examples.push(payload) | ||
} | ||
|
||
return eventsByName | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.