Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 2
Message 1 of 3

Error when using env variable from secrets

Solved! Go to Solution.

Hello,

 

I tried to generate a file and push it to the repository, but I receive the error:syntax error: unexpected end of file whenI try to set the user.email.

 

The action configuration:

name: generate-index

on:
  push:
    branches:
      - master
    paths:
      - resume.json

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v1
    - uses: actions/npm@master

    - name: Install jsonresume and generate
      run: |
        npm install resume-cli
        npm install jsonresume-theme-classy
        ./node_modules/.bin/resume export index.html --theme classy

    - name: Git push
      env:
        GIT_OWNER_EMAIL: ${{ secrets.GIT_OWNER_EMAIL }}
        GIT_OWNER_NAME: ${{ secrets.GIT_OWNER_NAME }}
        GIT_REMOTE_URL: ${{ secrets.GIT_REMOTE_URL }}
      run: |
        git config user.email "$GIT_OWNER_EMAIL"
        git config user.name "$GIT_OWNER_NAME"
        if [[ `git status --porcelain` ]]; then
          git add index.html
          git commit -a -m 'Updated index'
          git remote rm origin
          git remote add origin $GIT_REMOTE_URL
          git push origin HEAD:master

Secrets panel:

ss.png

 

The action's output:

ss1.png

 

Also, here it is the link to the repository: https://github.com/claudiunicolaa/claudiunicola.xyz

2 Replies
Solution
Pilot Lvl 2
Message 2 of 3

Re: Error when using env variable from secrets

You forgot "fi" ;)

 

Copilot Lvl 2
Message 3 of 3

Re: Error when using env variable from secrets

Well, I tried a lot of things but nothing regarding the "if" statement. :))

 

Thanks.