From fa6746af4605654ab2fdbafb479d1c9c587e09b2 Mon Sep 17 00:00:00 2001 From: pir8bay Date: Mon, 10 Jun 2024 02:09:12 +0300 Subject: [PATCH] fixed more bugs --- .github/workflows/preview.yaml | 7 +++++-- src/components/AppHeader/AccountMenu.jsx | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index 5d7cec3f..99e614f3 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -30,6 +30,9 @@ jobs: id: commit_hash run: echo "COMMIT_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV + - name: Inject Git Commit Hash + run: sed -i "s/REACT_APP_GIT_COMMIT_HASH/${{ env.COMMIT_HASH }}/g" ./dist/src/components/AppHeader/AccountMenu.jsx + - name: Find PR number id: pr uses: actions/github-script@v7 @@ -48,8 +51,8 @@ jobs: console.info("Pull request number is", pullRequestNumber) return pullRequestNumber - - name: Inject Git Commit Hash - run: sed -i "s/REACT_APP_GIT_COMMIT_HASH_PLACEHOLDER/${{ env.COMMIT_HASH }}/g" ./src/components/AppHeader/AccountMenu.jsx + - name: Build Project + run: npm run build - name: Deploy to Cloudflare Pages id: cloudflare-publish diff --git a/src/components/AppHeader/AccountMenu.jsx b/src/components/AppHeader/AccountMenu.jsx index e0029bcf..c76d3a13 100644 --- a/src/components/AppHeader/AccountMenu.jsx +++ b/src/components/AppHeader/AccountMenu.jsx @@ -24,9 +24,11 @@ const AccountMenu = ({ profile, open, anchorEl, onClose, ...rest }) => { const shortenGitHash = fullHash => fullHash ? fullHash.substring(0, 7) : ''; + // Read the commit hash from the environment variable set during the build process const gitCommitHash = process.env.REACT_APP_GIT_COMMIT_HASH_PLACEHOLDER || ''; const shortGitCommitHash = shortenGitHash(gitCommitHash); - const gitCommitUrl = gitCommitHash ? `https://github.com/commaai/openpilot/commit/${shortGitCommitHash}` : ''; + const gitCommitUrl = gitCommitHash ? `https://github.com/commaai/openpilot/commit/${gitCommitHash}` : ''; + console.log(gitCommitHash) return (