unsplash / comment-on-pr

A GitHub Action to comment on the relevant open PR when a commit is pushed.
MIT License
150 stars 84 forks source link

Can environment variables be used in msg? #29

Closed richardtapendium closed 4 years ago

richardtapendium commented 4 years ago

Is there a way to use environment variables in the msg?

jobs:
  post-url:
    name: Comment preview url on PR
    runs-on: ubuntu-latest
    steps:
      - name: comment PR
        uses: unsplash/comment-on-pr@master
        env:
          FIRST_NAME: Mona
          BRANCH_NAME: ${GITHUB_REF##*/}
          GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
        with:
          msg: The branch is ${{ env.BRANCH_NAME }} branch name.

Using env.FIRST_NAME works fine, but env.BRANCH_NAME doesn't.

Is there a way to make this work?

Any help is definitely appreciated.

richardtapendium commented 4 years ago

All good, just realised I needed to do this instead:

with:
  msg: The branch is ${{ github.head_ref }} branch name.