Skip to content

Commit

Permalink
Start the RCP for stage earlier (#2373)
Browse files Browse the repository at this point in the history
Add offset to stage merges
  • Loading branch information
mokimo authored Jun 5, 2024
1 parent 7e0a838 commit 95a6593
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 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

0 comments on commit 95a6593

Please sign in to comment.