PNW-2730 - updated logic to handle empty label use case #26
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ℹ️ What's this PR do?
This PR introduces a self-healing mechanism to the editorial workflow to handle cases where a Pull Request fails to get labeled upon creation, making it more resilient. It also includes a fix for the entry deletion process.
getCmsRefsfunction inAPI.tsthat fetches all open PRs matching the CMS branch prefix. If a PR is found without a CMS status label, it automatically applies the defaultinitialWorkflowStatus, ensuring no entry becomes "invisible" to the workflow.getStackLabelhelper to ensure the stack's PR always has a valid status label, applying one on-the-fly if it's missing to prevent processing errors.editorialWorkflow.tsandentries.tsto properly pass thecustomEntrycontext during unpublishing/deletion operations.👀 Where should the reviewer start?
packages/decap-cms-backend-github/src/API.ts: Review the newgetCmsRefsandgetStackLabelfunctions, which contain the core logic for the self-healing mechanism.packages/decap-cms-core/src/actions/editorialWorkflow.ts: Inspect the changes for the delete entry workflow fix.packages/decap-cms-core/src/actions/entries.ts: Review the related context-passing fix for entry deletion.📱 How should this be tested?
On
landings-cmscheckout tofeat/PNW-2730_label-missing-improvementsto make all the following testsTest Case 1: Unlabeled PR Recovery
netlify-cms/draftlabel before the CMS polls again.Test Case 2: Standard Workflow (Regression Test)
Test Case 3: Delete/Unpublish Workflow
🤔 Any background context you want to provide?
Problem: Occasionally, the GitHub API fails to apply a status label (e.g.,
netlify-cms/draft) to a newly created PR. This makes the PR "invisible" to the CMS, blocking the user from viewing, editing, or publishing their changes via the editorial workflow.Solution: This PR refactors the GitHub backend to be resilient to this failure. Instead of only fetching PRs that are already labeled, the backend now fetches all relevant open PRs, identifies any without a CMS label, and automatically applies the default initial status. This creates a self-healing system that ensures every entry is correctly tracked.
This work is based on the technical study from PNW-2728.