Skip to content

Commit

Permalink
Change faux git activity strategy (#19)
Browse files Browse the repository at this point in the history
Do faux activity on master and then go back one commit
  • Loading branch information
connorads authored May 9, 2021
1 parent 55ec4bb commit 4e44854
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/lib.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as playwright from 'playwright';
import simpleGit from 'simple-git';
import simpleGit, {ResetMode} from 'simple-git';
import {promises as fs} from 'fs';

const maybeGetBadgeAwardedText = (page: playwright.Page) =>
Expand Down Expand Up @@ -27,7 +27,7 @@ const screenshotElement = async (
};

const generateFauxRepoActivity = async (
branch = 'faux-activity-branch',
branch = 'master',
filePath = 'faux-activity.txt'
) => {
console.log('Creating faux repo activity using git');
Expand All @@ -42,15 +42,18 @@ const generateFauxRepoActivity = async (
'41898282+github-actions[bot]@users.noreply.github.com'
);
}

console.log('Checking out branch', branch);
await git.checkoutLocalBranch(branch);
await git.checkout(branch);
console.log('Creating file', filePath);
await fs.appendFile(filePath, new Date().toISOString());
console.log('Committing and force pushing file', filePath);
console.log('Committing and pushing file', filePath);
await git
.add(filePath)
.commit('Creating some repo activity 🏃‍')
.push('origin', branch);
console.log('Hard resetting to HEAD~1 and force pushing');
await git
.reset(ResetMode.HARD, ['HEAD~1'])
.push('origin', branch, ['--force']);
console.log('Changes pushed to branch', branch);
};
Expand Down

0 comments on commit 4e44854

Please sign in to comment.