Skip to content

Commit

Permalink
fix footer link
Browse files Browse the repository at this point in the history
  • Loading branch information
danieleguido committed Mar 11, 2024
1 parent 222d40c commit 65c098f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/gatsby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
- name: Get git tag and revision
id: git
run: |
echo "GIT_REVISION=$(git rev-parse HEAD)" >> $GITHUB_ENV
echo "GIT_REVISION=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
echo "GIT_REPO=$(git config --get remote.origin.url)" >> $GITHUB_ENV
- name: Build with Gatsby
Expand Down
4 changes: 4 additions & 0 deletions src/components/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ import LogoFnr from "./_svg/LogoFnr"
import LogoSnsf from "./_svg/LogoSnsf"

const getGithubRepoUrl = (gitRepo, gitRevision) => {
if (gitRepo.startsWith("https")) {
return `${gitRepo}/commit/${gitRevision}`
}
// Regular expression to extract the repository path from the gitRepo string
const repoRegex = /github\.com[:/](.*)\.git/
const repoMatches = gitRepo.match(repoRegex)

if (repoMatches && repoMatches.length > 1) {
const repoPath = repoMatches[1]
return `https://github.com/${repoPath}/commit/${gitRevision}`
Expand Down

0 comments on commit 65c098f

Please sign in to comment.