Skip to content

Commit

Permalink
Update expire-old-content.js
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardKanshen committed Nov 10, 2024
1 parent 8ea56f7 commit f75a233
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions expire-old-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,20 +122,20 @@ function updateCronSchedule() {

fs.writeFileSync(workflowPath, workflowContent, 'utf8');
console.log('Workflow cron schedule updated.');
return workflowContent == oldWorkflowContent
return workflowContent !== oldWorkflowContent
}

// Step 3: Commit and push changes if any files were modified
function commitAndPushChanges(hasComponentChanges) {
function commitAndPushChanges(hasChanges) {
if (process.env.TARGET_BRANCH === undefined) {
console.error('TARGET_BRANCH is not set. Not committing or pushing changes.');
return;
}
try {
if (hasComponentChanges) {
execSync(`git config user.email "41898282+github-actions[bot]@users.noreply.github.com"`);
execSync(`git config user.name "Anti-Social Bot"`);
execSync(`git add .`);
if (hasChanges) {
execSync(`git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"`);
execSync(`git config --global user.name "Anti-Social Bot"`);
execSync(`git add ${path.resolve(componentPath)} ${path.resolve(workflowPath)}`);
execSync(`git commit -m "Remove expired images and update cron schedule"`);
execSync(`git push origin HEAD:${process.env.TARGET_BRANCH}`);
console.log('Changes pushed to repository.');
Expand Down

0 comments on commit f75a233

Please sign in to comment.