When contributing to this repository, please first discuss the change you wish to make via GitHub Issue.
Adding a new Shortcut action is relatively straightforward.
- Create a test Shortcut on your iOS device containing the new action.
- Airdrop the Shortcut to your development machine.
- Move it into a
/shortcuts
directory in the root of this project. - Run
node scripts/parse.js
and select your Shortcut and action. This will log out the parsed Shortcut data. - Copy this data into a new file in
src/actions
, optionally using an existing action as a template. The file (and action) you're creating should be the name of the action as it appears in the Shortcuts app, camelCased. For example, if you were adding the 'Run Home Scene' action, the file would be namedrunHomeScene.ts
and it would export a function namedrunHomeScene
. If in any doubt, use the already implemented actions as guides. - Connect up all Shortcut options to the function parameters. Try to be as thorough as possible and make sure you cover all possible options. You'll likely need to add some new types to
src/interfaces/WF
andsrc/interfaces/WF/WFWorkflowActionParameters.ts
. You'll also want to check whether or not the action can be used as a 'Magic Variable'. If it can, don't forget to wrap the exported function with thewithActionOutput
function (seesrc/actions/number.ts
as an example). - Export the new file from
src/actions/index.ts
. - Add tests for the new action to
__tests__/actions
. Again, try to be as thorough as possible and use another action's tests as a starting point. - Make sure all tests pass, and that the new action is documented with TypeDoc in the same way all other actions are.
- Build a test Shortcut (you can find info on how to do that locally here) and Airdrop it to your phone to make sure that the new action works as expected.
- Open a Pull Request!
If any of this doesn't make sense please let me know! I want to make this process as simple as possible, so any and all feedback is appreciated. Open an issue with any comments. 🙂