Skip to content

Instantly share code, notes, and snippets.

@mfojtik
Created October 14, 2019 10:57
Show Gist options
  • Save mfojtik/5f182223144cf7ff8c683ef63073697a to your computer and use it in GitHub Desktop.
Save mfojtik/5f182223144cf7ff8c683ef63073697a to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
repo_name=$1
repo_head=$(git ls-remote [email protected]:openshift/${repo_name} HEAD | sed 's/HEAD//')
commit_date=$(curl -s https://api.github.com/repos/openshift/${repo_name}/git/commits/${repo_head} | jq -r ".committer.date")
go mod edit -replace github.com/openshift/${repo_name}=github.com/openshift/${repo_name}@"v0.0.0-$(echo $commit_date | sed "s/[-:TZ]//g")-${repo_head:0:12}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment