Skip to content

Commit

Permalink
fixed more bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
sarem-h committed Jun 9, 2024
1 parent 5fb90ec commit fa6746a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/components/AppHeader/AccountMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
<Menu
Expand Down

0 comments on commit fa6746a

Please sign in to comment.