Skip to content

Instantly share code, notes, and snippets.

@esouthren
Last active April 26, 2019 16:46
Show Gist options
  • Save esouthren/eb6564522c902e6b9ca0ceb4402a4e0d to your computer and use it in GitHub Desktop.
Save esouthren/eb6564522c902e6b9ca0ceb4402a4e0d to your computer and use it in GitHub Desktop.
(params) => {
// use our data connection to get a list of all repository commits
let commits = api.run("this.list_commits", {owner: params.owner, repo: params.repo});
// select a random commit from the list
var commit_count = commits.length;
var random_commit = commits[Math.floor(Math.random() * commit_count)];
return random_commit;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment