-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hopefully reusable workflow agrees to support ${{inputs. XXX}} expression parameter passing #1976
Comments
I'm noticing the same and this feels like a bug. Before the inputs unification announcement, the
|
seeing similar issues here to what @nathanchapman pointed out. Last week this worked:
(in my called workflow i set the environment using Now this week it doesn't work (no environment is getting set on the summary page and all the secrets in the called workflow are now empty). Changing it to this suddenly works again:
this is almost definitely a regression... |
Same here ☝️ I'm filing a bug report with our GitHub Enterprise Cloud support. Here are some more details and examples for anyone interested. Now that inputs have been unified across manual and reusable workflows, we've moved to using the Example 1In this example, we're just setting up the workflow files. name: Dispatchable Workflow
on:
workflow_dispatch:
inputs:
gitRef:
type: string
description: The branch, tag, or SHA to checkout
required: false
jobs:
tests:
name: Tests
uses: ./.github/workflows/tests.yml
with:
gitRef: hardcoded
otherInput: hardcoded
secrets: inherit name: Tests
on:
workflow_call:
inputs:
gitRef:
type: string
description: The branch, tag, or SHA to test
required: true
otherInput:
type: string
description: Input only for example
required: true
jobs:
unitTests:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Debug Inputs
run: echo "${{ toJSON(inputs) }}" Running this workflow, whether a value is set for
Example 2The reusable workflow remains the same, but we've modified how it's being called (with the name: Dispatchable Workflow
on:
workflow_dispatch:
inputs:
gitRef:
type: string
description: The branch, tag, or SHA to checkout
required: false
jobs:
tests:
name: Tests
uses: ./.github/workflows/tests.yml
with:
gitRef: ${{ inputs.gitRef }}
otherInput: hardcoded
secrets: inherit results in the following when
Example 3The previous example looks like a possible name clash, so let's modify our dispatchable workflow even further to avoid a possible clash: name: Dispatchable Workflow
on:
workflow_dispatch:
inputs:
checkoutRef:
type: string
description: The branch, tag, or SHA to checkout
required: false
jobs:
tests:
name: Tests
uses: ./.github/workflows/tests.yml
with:
gitRef: ${{ inputs.checkoutRef || 'master' }}
otherInput: hardcoded
secrets: inherit results in the following when
Still not what we're expecting as output within the reusable
It appears that Example 4Now, let's switch from using the name: Dispatchable Workflow
on:
workflow_dispatch:
inputs:
checkoutRef:
type: string
description: The branch, tag, or SHA to checkout
required: false
jobs:
tests:
name: Tests
uses: ./.github/workflows/tests.yml
with:
gitRef: ${{ github.event.inputs.checkoutRef || 'master' }}
otherInput: hardcoded
secrets: inherit results in the following when
this finally gives us the correct behavior in
Example 5In this example, we're unifying the names of the inputs once again. name: Dispatchable Workflow
on:
workflow_dispatch:
inputs:
gitRef:
type: string
description: The branch, tag, or SHA to checkout
required: false
jobs:
tests:
name: Tests
uses: ./.github/workflows/tests.yml
with:
gitRef: ${{ github.event.inputs.gitRef || 'master' }}
otherInput: hardcoded
secrets: inherit results in the following when
and the following when nothing is passed as the
This is close to the correct behavior. It allows computation (namely, default / fallback values) and the inputs context is correct within the reusable However, it's only not "muddied" because the input names match. Any additional inputs added to the dispatchable workflow end up in the Requested ChangeThe |
We have noticed this regression and waiting for the fix to be rolled out. cc @genieCS |
Hi @JavaScriptBach, this will mostly go in a day. If it's getting delayed, i will update. |
This issue seems to be resolved for me, the inputs context now has valid
They are still merged, workflow_call inputs overrides workflow_dispatch inputs if they have different names both are in the inputs context. I think merged inputs are intensional, but unexpected |
Also, @ChristopherHX made a great point here that this context availability isn't yet documented on https://docs.github.com/en/enterprise-cloud@latest/actions/learn-github-actions/contexts#context-availability |
@nathanchapman @ChristopherHX @JavaScriptBach and others: The changes have been rolled out for every one and hope there are no issues.
Yes, we are passing dispatch inputs into reusable wfs too.
Regarding the docs update, good point. we will be updating soon. Thanks everyone for sharing details and improving our product. |
Would be great if inputs from dispatched workflow will be implicitly passed to a callable one, or at least have some sort of short syntax for that, e.g. jobs:
release:
uses: ../.github/workflows/release.yaml@master
with:
inputs: inherited # forwarded OR ${{ github.inputs }} etc Thanks! |
Would also be great to know what version of Actions this is in, and how that corresponds to GHE version, for those of us on GHE. I find it extremely difficult to track what I should be expecting to see/work in the version we have or not, or if I want to request an upgrade from our admins for a certain feature what version I should be asking for, etc... |
Seems that inputs are inherited now even though only secrets are specified to be inherited. |
Describe the enhancement
I wanted to pass the parameters of the workflow_dispatch input in a reusable workflow,
and with ${{inputs.username}} expression, the value could not be read and without an error message.
But if using ${{github.event.inputs.username}} it works fine, I don't know why.
The official documentation does not detail the difference between the two and which to use in reusable workflows
Code Snippet
Additional information
Add any other context about the feature here.
NOTE: if the feature request has been agreed upon then the assignee will create an ADR. See docs/adrs/README.md
The text was updated successfully, but these errors were encountered: