Placed the Custom Actions pre-requisites at the top of the document instead of the middle. These **pre-requisites** are easily missed if developers are writing custom actions.

Signed-off-by: Anthony Ikeda <anthony.ikeda@gmail.com>
This commit is contained in:
Anthony Ikeda
2021-11-08 14:21:44 -08:00
parent 58d0c50d5d
commit 5b9d1291f7
@@ -8,6 +8,40 @@ If you're wanting to extend the functionality of the Scaffolder, you can do so
by writing custom actions which can be used along side our
[built-in actions](./builtin-actions.md).
---
**NOTE**
When adding custom actions, the actions array will **replace the built-in actions too**, so if you
want to have those as well as your new one, you'll need to do the following:
```ts
import { createBuiltinActions } from '@backstage/plugin-scaffolder-backend';
import { ScmIntegrations } from '@backstage/integration';
const integrations = ScmIntegrations.fromConfig(config);
const builtInActions = createBuiltinActions({
containerRunner,
integrations,
config,
catalogClient,
reader,
});
const actions = [...builtInActions, createNewFileAction()];
return await createRouter({
containerRunner,
logger,
config,
database,
catalogClient,
reader,
actions,
});
```
---
### Writing your Custom Action
Your custom action can live where you choose, but simplest is to include it
@@ -126,36 +160,6 @@ return await createRouter({
});
```
**NOTE** - the actions array will replace the built-in actions too, so if you
want to have those as well as your new one, you'll need to do the following:
```ts
import { createBuiltinActions } from '@backstage/plugin-scaffolder-backend';
import { ScmIntegrations } from '@backstage/integration';
const integrations = ScmIntegrations.fromConfig(config);
const builtInActions = createBuiltinActions({
containerRunner,
integrations,
config,
catalogClient,
reader,
});
const actions = [...builtInActions, createNewFileAction()];
return await createRouter({
containerRunner,
logger,
config,
database,
catalogClient,
reader,
actions,
});
```
### List of custom action packages
Here is a list of Open Source custom actions that you can add to your Backstage