Getting "Error undefined: No tag found in ref or input!" when running on a release:published trigger
richbrowne-openfin opened this issue · comments
I'm using v1.13.0, and am getting a "Error: Error undefined: No tag found in ref or input!" error when running using a release:published trigger. According to the GitHub docs, the GITHUB_REF
value will be "Tag ref of release refs/tags/<tag_name>" so this error should not be occurring?
To confirm, my workflow trigger is set to:
on:
release:
types: [published]
My ncipollo/release-action workflow task:
- name: Update release
uses: ncipollo/release-action@v1.13.0
with:
allowUpdates: ${{ true }}
bodyFile: metadata/${{ needs.adapter.outputs.version }}.md
name: v${{ needs.adapter.outputs.version }}
omitNameDuringUpdate: ${{ true }}
omitPrereleaseDuringUpdate: ${{ true }}
token: ${{ secrets.GITHUB_TOKEN }}
Hmm yeah I would think it would work, or at least not fail when looking for the tag ref. Could you add a step in your workflow which prints out that github ref variable? Guessing it's either missing or not the same format as tags
@ncipollo thanks for the quick response. I should say this workflow is running on a windows-based runner, I created a simple workflow to output env variables:
name: Release
on:
release:
types: [published]
jobs:
test:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 'lts/*'
registry-url: https://registry.npmjs.org
- name: Test
shell: powershell
run: |
Write-Host "Printing Environment Variables:"
Write-Host "-----------------------------------------"
Write-Host "GITHUB_REF: $env:GITHUB_REF"
Write-Host "GITHUB_REF_NAME: $env:GITHUB_REF_NAME"
Write-Host "GITHUB_REF_PROTECTED: $env:GITHUB_REF_PROTECTED"
Write-Host "GITHUB_REF_TYPE: $env:GITHUB_REF_TYPE"
Write-Host "RUNNER_ARCH: $env:RUNNER_ARCH"
Write-Host "RUNNER_NAME: $env:RUNNER_NAME"
Write-Host "RUNNER_OS: $env:RUNNER_OS"
Write-Host "-----------------------------------------"
After running this I got the following output:
Printing Environment Variables:
-----------------------------------------
GITHUB_REF: refs/tags/test
GITHUB_REF_NAME: test
GITHUB_REF_PROTECTED: false
GITHUB_REF_TYPE: tag
RUNNER_ARCH: X[64](https://github.com/openfin/excel-integration/actions/runs/7043624357/job/19169748700#step:4:65)
RUNNER_NAME: GitHub Actions 2
RUNNER_OS: Windows
More weirdness, I just re-ran my original workflow (after re-running it a number of times), and it worked! Did a bit more digging and found this open issue from August, this comment in particular appears to match my experience:
The behavior is quite weird: sometimes the
GITHUB_REF
environment variable is well populated, sometimes it is empty.
Given that this bug has been open since August and is still not fixed, would it be possible to also check the github.event.release.tag_name
variable as suggested in this comment?
Nice find! Hmm, is this something you can manually set via the tag field in the workflow? If that works I think I would probably prefer to update the readme with that as an example rather than adding a specific code path for that in the action. There are probably other cases where you want to extract the tag from a different variable and I'd like to lean on a solution which solves for it generally (ie using tag input + variables)
Actually on balance you're right i think, setting the tag value is probably the best option here. Hopefully Microsoft will fix the bug at some point soon! Thanks @ncipollo.