Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Ry0taK committed Aug 31, 2024
1 parent 1d66049 commit 1596b5e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion .github/scripts/acquire-lock.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ function configureGit() {
cp.execSync('git config --global user.name "github-actions[bot]"');
}

function checkoutBranch(branch) {
cp.execSync('git pull');
try {
cp.execFileSync('git', ['checkout', branch]);
} catch (e) {
cp.execFileSync('git', ['checkout', '-b', branch]);
}
}

function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
Expand All @@ -15,7 +24,7 @@ configureGit();
(async () => {
while (true) {
try {
cp.execFileSync('git', ['checkout', '-b', 'workflow-lock']);
checkoutBranch('workflow-lock');
cp.execSync('git commit --allow-empty -m "Acquire lock"');
cp.execFileSync('git', ['push', '-u', 'origin', 'workflow-lock']);
console.log("Acquired lock!");
Expand Down

0 comments on commit 1596b5e

Please sign in to comment.