Can a Gitlab CI template reference and use Project Variables?

I’m trying to define a reusable workflow template for my organisation. The job within this template references a project variable (e.g. EXAMPLE_API_KEY) which looks roughly like below:

customjob:
  image:
    name: $[[ inputs.image ]]:$[[ inputs.version ]]
    entrypoint: [""]
  script:
    - mycmd login
  variables:
    EXAMPLE_API_KEY: $EXAMPLE_API_KEY

The EXAMPLE_API_KEY is a project level variable which is not flagged to be protected or expanded, and I have ticked it to be masked (it meets the regular expression requirements, and I’ve also tested without masking).

From my app repo I then want to call my reusable workflow that is located in some template repo, for example:

include:
  - project: kash/cicd-workflows
    ref: main
    file: workflow.yml

When this runs it appears that the EXAMPLE_API_KEY is unset. Is it possible to only reference it in the customjob like I’ve done above, or would I need to essentially define workflow inputs and pass it from the app repo downwards?

I’ve resolved this now. What I didn’t realise was the workflow files are merged and run as if it exists within the repository, so the project variable will be available to it without any additional configuration (I don’t need to provide the variables block and pass it through). With the snippet I gave in my first post, the env var was being overwritten and set to the literal string “$EXAMPLE_API_KEY”.