Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sarem-h committed Jun 9, 2024
1 parent ca7b89c commit f9debdf
Showing 1 changed file with 8 additions and 28 deletions.
36 changes: 8 additions & 28 deletions .github/workflows/preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,6 @@ jobs:
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event == 'pull_request' }}
runs-on: ubuntu-latest
steps:
- name: Big Eye-catching Banner
run: |
echo "::warning::"
echo "******************************************************************************"
echo "* *"
echo "* 🚀 Running Preview Workflow boiiiiii 🚀 *"
echo "* *"
echo "******************************************************************************"
echo "::end::"
- uses: actions/checkout@v4

- name: Download build artifacts
Expand All @@ -36,22 +26,9 @@ jobs:
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: List dist directory contents
run: ls -R ./dist

- name: Check if AccountMenu.jsx exists
run: |
if [ ! -f ./dist/src/components/AppHeader/AccountMenu.jsx ]; then
echo "::error:: AccountMenu.jsx not found!"
exit 1
fi
- name: Get Git Commit Hash
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_PLACEHOLDER/${{ env.COMMIT_HASH }}/g" ./dist/src/components/AppHeader/AccountMenu.jsx
run: echo "::set-output name=commit_hash::$(git rev-parse HEAD)"

- name: Find PR number
id: pr
Expand All @@ -71,14 +48,17 @@ jobs:
console.info("Pull request number is", pullRequestNumber)
return pullRequestNumber
- name: Build Project
run: npm run build
- name: Inject Git Commit Hash
run: sed -i "s/REACT_APP_GIT_COMMIT_HASH/${{ steps.commit_hash.outputs.commit_hash }}/g" ./src/components/AppHeader/AccountMenu.jsx

- name: Set React Environment Variable
run: echo "REACT_APP_GIT_COMMIT_HASH=${{ steps.commit_hash.outputs.commit_hash }}" >> $GITHUB_ENV
fix
- name: Deploy to Cloudflare Pages
id: cloudflare-publish
uses: cloudflare/[email protected]
with:
branch: ${{ github.head_ref }}
branch: ${{ steps.pr.outputs.result }}
projectName: connect
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
apiToken: ${{ secrets.CLOUDFLARE_PAGES_TOKEN }}
Expand All @@ -94,7 +74,7 @@ jobs:
* mark your PR as a draft until it's ready to review
* post the preview on [Discord](https://discord.comma.ai); feedback from users will speed up the PR review
Deployed preview: https://${{ steps.pr.outputs.result }}.connect-d5y.pages.dev (Commit: ${{ env.COMMIT_HASH }})
Deployed preview: https://${{ steps.pr.outputs.result }}.connect-d5y.pages.dev (Commit: ${{ steps.commit_hash.outputs.commit_hash }})
comment_tag: run_id
pr_number: ${{ steps.pr.outputs.result }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit f9debdf

Please sign in to comment.