Skip to content

Commit

Permalink
[Release] Stage to Main (#2423)
Browse files Browse the repository at this point in the history
  • Loading branch information
milo-pr-merge[bot] authored Jun 6, 2024
2 parents b07f1a5 + 95a6593 commit e5bff30
Show file tree
Hide file tree
Showing 7 changed files with 165 additions and 103 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,21 @@ const RCPDates = [
},
];

const isWithinRCP = () => {
const isWithinRCP = (offset = 0) => {
const now = new Date();
if (now.getFullYear() !== CURRENT_YEAR) {
console.log(`ADD NEW RCPs for ${CURRENT_YEAR + 1}`);
return true;
}

if (RCPDates.some(({ start, end }) => start <= now && now <= end)) {
console.log('Current date is within a RCP. Stopping execution.');
if (RCPDates.some(({ start, end }) => {
const adjustedStart = new Date(start);
adjustedStart.setDate(adjustedStart.getDate() - offset);
return start <= now && now <= end
})) {
console.log(
'Current date is within a RCP (2 days earlier for stage, to keep stage clean & make CSO contributions during an RCP easier). Stopping execution.'
);
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/merge-to-stage.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ const main = async (params) => {
github = params.github;
owner = params.context.repo.owner;
repo = params.context.repo.repo;
if (isWithinRCP()) return console.log('Stopped, within RCP period.');
if (isWithinRCP(2)) return console.log('Stopped, within RCP period.');

try {
const stageToMainPR = await getStageToMainPR();
Expand Down
66 changes: 37 additions & 29 deletions libs/features/personalization/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,51 +213,59 @@ function createPreviewPill(manifests) {
document.body.dataset.mepHighlight = true;
}

const PREVIEW_BUTTON_ID = 'preview-button';

div.innerHTML = `
<div class="mep-manifest mep-badge">
<span class="mep-open"></span>
<div class="mep-manifest-count">${manifests?.length || 0} Manifest(s) served</div>
</div>
<div class="mep-popup">
<div class="mep-popup-header">
<div>
<h4>${manifests?.length || 0} Manifest(s) served</h4>
<span class="mep-close"></span>
<div class="mep-manifest-page-info-title">Page Info:</div>
<div>Target integration feature is ${targetOnText}</div>
<div>Personalization feature is ${personalizationOnText}</div>
<div>Page's Locale is ${config.locale.ietf}</div>
</div>
</div>
<div class="mep-manifest-list">
<div class="mep-manifest-info">
<div class="mep-manifest-variants">
<input type="checkbox" name="mepHighlight" id="mepHighlightCheckbox" ${mepHighlightChecked} value="true"> <label for="mepHighlightCheckbox">Highlight changes</label>
<div class="mep-popup-header">
<div>
<h4>${manifests?.length || 0} Manifest(s) served</h4>
<span class="mep-close"></span>
<div class="mep-manifest-page-info-title">Page Info:</div>
<div>Target integration feature is ${targetOnText}</div>
<div>Personalization feature is ${personalizationOnText}</div>
<div>Page's Locale is ${config.locale.ietf}</div>
</div>
</div>
${manifestList}
<div class="mep-advanced-container">
<div class="mep-toggle-advanced">Advanced options</div>
<div class="mep-manifest-info mep-advanced-options">
<div>
Optional: new manifest location or path
</div>
<div class="mep-manifest-list">
<div class="mep-manifest-info">
<div class="mep-manifest-variants">
<input type="checkbox" name="mepHighlight" id="mepHighlightCheckbox" ${mepHighlightChecked} value="true"> <label for="mepHighlightCheckbox">Highlight changes</label>
</div>
</div>
${manifestList}
<div class="mep-advanced-container">
<div class="mep-toggle-advanced">Advanced options</div>
<div class="mep-manifest-info mep-advanced-options">
<div>
<input type="text" name="new-manifest" id="new-manifest">
Optional: new manifest location or path
</div>
<div class="mep-manifest-variants">
<div>
<input type="text" name="new-manifest" id="new-manifest">
</div>
</div>
</div>
</div>
<div class="mep-manifest-info">
<div class="mep-manifest-variants mep-advanced-options">
<input type="checkbox" name="mepPreviewButtonCheckbox" id="mepPreviewButtonCheckbox" value="off"> <label for="mepPreviewButtonCheckbox">add mepButton=off to preview link</label>
<div class="mep-manifest-info">
<div class="mep-manifest-variants mep-advanced-options">
<input type="checkbox" name="mepPreviewButtonCheckbox" id="mepPreviewButtonCheckbox" value="off"> <label for="mepPreviewButtonCheckbox">add mepButton=off to preview link</label>
</div>
</div>
</div>
</div>
</div>
<div class="dark">
<a class="con-button outline button-l" href="${simulateHref.href}" title="Preview above choices">Preview</a>
<div class="dark">
<a class="con-button outline button-l" data-id="${PREVIEW_BUTTON_ID}" title="Preview above choices">Preview</a>
</div>
</div>`;

const previewButton = div.querySelector(`a[data-id="${PREVIEW_BUTTON_ID}"]`);

if (previewButton) previewButton.href = simulateHref.href;

overlay.append(div);
addPillEventListeners(div);
}
Expand Down
Loading

0 comments on commit e5bff30

Please sign in to comment.