Defaults? Documentation wrong or my bad understanding?

https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#defaults

Was expecting to be able to do:

name: workflow 1
defaults:
artifact-path: build/
jobs:

And that available to all jobs via action library or raw INPUT_ARTIFACT_PATH.

Seems the documenation is confusing here if only two specific run: options are configurable?

Hi @sitepodmatt,
Currently, defaults only support shell and working-directory options for all run steps in a workflow.
For your requirement , please consider using workflow level env . In steps inputs under with, you could use ${{env.artifact-path}} syntax . There is an example workflow:

name: workflow 1
on: 
  push: 
env:
  artifact-path: build/
jobs:
  job1-test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - run: echo $HOSTNAME
      - name: Upload a Build Artifact
        uses: actions/upload-artifact@v2
        with:
          name: drop
          path: ${{env.artifact-path}}

Also, you could share your idea in the Feedback form for GitHub Actions.

Thanks Ive asked them to implementation the documentation - mainly A map of default settings that will apply to all jobs in the workflow.

1 Like