Hi,
I would like to simplify my workflow by using a variable at certain places. That workflow ultimately becomes some kind of a template and I would like to make it as easiest as possible for people to maintain it, when they have created their own copy of that workflow. Therefore I was thinking to declare a global variable and use it in the workflow at many places:
It basically looks like this and people should only be required to maintain the pluginId:
env:
pluginId: 'plugin-fn-xml-node'
on:
push:
paths:
- ${{env.pluginId}}/**
- .github/workflows/**
pull_request:
paths:
- ${{env.pluginId}}/**
- '.github/workflows/**'
jobs:
build:
env:
working-directory: ${{env.pluginId}}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [8.x, 10.x, 12.x]
steps:
.....
That fails with the error message:
Your workflow file was invalid: The pipeline is not valid. .github/workflows/fn-xml-node-tests.yml (Line: 7, Col: 9): Unrecognized named-value: 'env'. Located at position 1 within expression: env.pluginId,.github/workflows/fn-xml-node-tests.yml (Line: 11, Col: 9): Unrecognized named-value: 'env'. Located at position 1 within expression: env.pluginId
It’s stated here: https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#env that workflow (global) variables are supported, but I don’t find a way to get it working. Unfortunately the documentation isn’t much talking about Workflow-Variables.
Can someone tell me, if this is possible? And if yes, what I’m doing wrong.
Thanks!
Chris