0

I want check if the commit message is not [RELEASE] but [PATCH], [MINOR] or [MAJOR]. I define all as Environment Variables.

`But when I run the workflow i get the error: Unrecognized named-value: 'env'. Located at position 1 within expression: env.PATCH == 'true'

What I'm doing wrong?

Thanks for help

env:
COMMIT_MSG: ${{ github.event.head_commit.message }} 
PATCH: ${{ startsWith(github.event.head_commit.message, '[PATCH]') || 'false' }} 
MINOR: ${{ startsWith(github.event.head_commit.message, '[MINOR]') || 'false' }} 
MAJOR: ${{ startsWith(github.event.head_commit.message, '[MAJOR]') || 'false' }} 

if: "!startsWith(github.event.head_commit.message, '[RELEASE]') && (${{ env.PATCH == 'true' }} || ${{env.MINOR == 'true' }} || ${{ env.MAJOR == 'true' }})"

I hope somebody can fix my Line of Code.

Christoph
  • 1
  • 1

1 Answers1

0

I will assume that the syntax at your yaml file is correct. env variables can only be accessed within steps, not within jobs or outside them so it should be:

jobs:
  job:
    steps:
      - name: step
        if: ${{ env.PATCH == 'true ... }}