File tree Expand file tree Collapse file tree 1 file changed +10
-14
lines changed Expand file tree Collapse file tree 1 file changed +10
-14
lines changed Original file line number Diff line number Diff line change @@ -19,32 +19,28 @@ jobs:
1919 with :
2020 node-version : ' 20.14'
2121
22- # Inject BRANCH_NAME into environment variables
23- - name : Set BRANCH_NAME
24- run : echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV
22+ - name : Extract branch name
23+ id : extract_branch
24+ run : |
25+ if [[ "${GITHUB_REF}" == "refs/heads/"* ]]; then
26+ echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
27+ elif [[ "${GITHUB_REF}" == "refs/pull/"* ]]; then
28+ echo "BRANCH_NAME=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
29+ else
30+ echo "BRANCH_NAME=unknown" >> $GITHUB_ENV
31+ fi
2532
2633 # Navigate to the correct working directory and install dependencies
2734 - name : Install dependencies
2835 working-directory : ./
2936 run : npm install
3037
31- - name : Replace password placeholder
32- working-directory : ./
33- run : |
34- echo "Rewriting password-config.json..."
35- if [ ! -f ./static/password-config.json ]; then
36- echo "File not found, creating a new one."
37- echo '{"password": "PLACEHOLDER"}' > ./static/password-config.json
38- fi
39- sed -i "s/PLACEHOLDER/${{ secrets.DOCUSAURUS_PASSWORD }}/g" ./static/password-config.json
40-
4138 # Build the project
4239 - name : Build project
4340 working-directory : ./
4441 env :
4542 ALGOLIA_APP_ID : ${{ secrets.ALGOLIA_APP_ID }}
4643 ALGOLIA_API_KEY : ${{ secrets.ALGOLIA_API_KEY }}
47- ALGOLIA_INDEX_NAME : ${{ secrets.ALGOLIA_INDEX_NAME }}
4844 BRANCH_NAME : ${{ env.BRANCH_NAME }}
4945 TRACKING_ID : ${{ secrets.GA_TRACKING_ID }}
5046 run : |
You can’t perform that action at this time.
0 commit comments