feat: add initial workflow status in config
Summary
For our case we now use the editional workflow, we use it to preview our changes, but sometimes we just want to publish directly. And this is not possible, we have to save, change status to ready and publish.
I would have preferred to do this issue #4054 but it seemed more complex for a first issue on the project :)
The goal here is to add the initial status in the configuration, then in our cas we can put PENDING_PUBLISH status by default and then publish directly.
Test plan
Checklist
Please add a x inside each checkbox:
- [x] I have read the contribution guidelines.
- [x] Code is formatted via running
yarn format. - [x] Tests are passing via running
yarn test. - [x] The status checks are successful (continuous integration). Those can be seen below.

I don't really know where to add the expected test, if you can guide me :)
Hello @bytrangle, thanks for your review.
I tried when I start the backend, and everything work right. But inside test I can't find where I can test this behavior, in the file that you have pointed out to me it doesn't work because it's looks like it's not in "editorial_workflow".
I tried here :
- https://github.com/netlify/netlify-cms/blob/dbf2920254fb3682e12463a6df8ded4b94b55be0/packages/netlify-cms-core/src/tests/backend.spec.js#L347
And here :
- https://github.com/netlify/netlify-cms/blob/cb2ad687ee250937a9dffc21ebfd4c399c6d76db/packages/netlify-cms-backend-test/src/tests/implementation.spec.js#L48
But we can only access to the
window.repoFileswhere there is no the entry workflow state.
Can you give me a little help please?
On further investigation, I think the test should be in netlify-cms-core/.../actions/__tests__/config.spec.js.
I got the idea from the test "should set publish_mode from config". I've tried create a barebone config object with two props: publish_mode and default_workflow_status.
Then I called applyDefaults(config). This function takes the original config object parsed from config.yml file and mutate it so that certain important properties won't be undefined if the user forgot to add them.
For example, publish_mode has to be SIMPLE_WOKFLOW, slug has to be an empty object, collections is an empty array unless specified otherwise in the config.
Then I check if applyDefaults(config).default_workflow_status is equal to the value I passed to the namesake property of the config.
You'll also need to modify the applyDefaults(config) so that if the user sets publish_mode to editorial_workflow, and don't specify the default_workflow_status, the mutated config will have a property default_workflow_status set to draft.
Does that make sense?
@bytrangle Oh nice ! It's really clear, I will do that :)
Just for your last sentence, you really think it's useful with the following code ?
- https://github.com/RomainOliva/netlify-cms/blob/e89358a11101377de3c0ca3eb7187a3cf8b545e1/packages/netlify-cms-core/src/reducers/config.ts#L38
With this line if there is no default_workflow_status it take the first status (draft one)
thanks again for your help
@bytrangle I just add a fixup commit with some change and the test, tell me if this sounds good to you :)
@krider2010 Look forward to your review.
Just a heads up I'm working on being added to the maintainer group for review reasons.
@bytrangle There is no other reviewer who can watch this pr? :)
@bytrangle Small up please, this feature would allow us to save a lot of time in our processes 🙈
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
It is still relevant today 🙈
It is still relevant today see_no_evil
waiting for this to happen
@RomainOliva are you still interested in moving this forward?
@martinjagodic Yes, it can be interesting to merge it 😇
Great! Can you solve the merge conflicts? They mostly emerged because of the package rename.
Deploy request for cms-demo rejected.
| Name | Link |
|---|---|
| Latest commit | cb2ee3da0502823bc4af7273444d73ddeb77956f |
Deploy Preview for decap-www ready!
| Name | Link |
|---|---|
| Latest commit | cb2ee3da0502823bc4af7273444d73ddeb77956f |
| Latest deploy log | https://app.netlify.com/sites/decap-www/deploys/654e52adad3a9d00086355ce |
| Deploy Preview | https://deploy-preview-6469--decap-www.netlify.app/docs/configuration-options |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
@martinjagodic sorry for the delay, it's all good the PR is rebased :)