v2.0.25 fails with 404 when using {repository} URL parameter set to ${{ github.repository }}
kd7lxl opened this issue ยท comments
We have a workflow that requests the list of files modified by a PR. Here's the code:
name: kube-score
on:
# pull_request workflows run in the context of the fork, when applicable, and
# thus does not have permission to comment on the PR. To support this, this
# workflow only publishes an artifact and the comment will be posted by the
# pr-comment workflow.
# https://github.blog/2020-08-03-github-actions-improvements-for-fork-and-pull-request-workflows/#improvements-for-public-repository-forks
pull_request:
paths:
- "**-version.txt"
jobs:
kube-score:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: octokit/request-action@v2.x
id: list_files
with:
route: GET /repos/:repository/pulls/:number/files
repository: ${{ github.repository }}
number: ${{ github.event.pull_request.number }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
This stopped working when v2.0.25 was released. The error is not found
:
2021-01-25T21:49:32.3761923Z Download action repository 'octokit/request-action@v2.x'
2021-01-25T21:49:35.9635012Z ##[warning]Unexpected input(s) 'repository', 'number', valid inputs are ['route', 'mediaType']
2021-01-25T21:49:35.9691635Z ##[group]Run octokit/request-action@v2.x
2021-01-25T21:49:35.9692287Z with:
2021-01-25T21:49:35.9692842Z route: GET /repos/:repository/pulls/:number/files
2021-01-25T21:49:35.9693621Z repository: <redacted>
2021-01-25T21:49:35.9694284Z number: 8631
2021-01-25T21:49:35.9694703Z mediaType: {}
2021-01-25T21:49:35.9695128Z env:
2021-01-25T21:49:35.9696104Z GITHUB_TOKEN: ***
2021-01-25T21:49:35.9696545Z ##[endgroup]
2021-01-25T21:49:36.3260397Z GET /repos/:repository/pulls/:number/files
2021-01-25T21:49:36.3261858Z > repository: <redacted>
2021-01-25T21:49:36.3262527Z > number: 8631
2021-01-25T21:49:36.3264255Z > mediaType: [object Object]
2021-01-25T21:49:36.4425840Z ##[error]Not Found
I looked at the diff and it's not obvious why it broke. I switched to - uses: octokit/request-action@v2.0.24
and it started working again.
Is this on a private repository? We do send requests using env.GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
in our tests, and they all passed. I'm not sure what broke either.
Can you please create a secret ACTIONS_STEP_DEBUG
and set it to 1
? That will enable debug logs
@gr2m I experienced a similar issue with a 'Not Found' error. For me, it looks like the repository parameter is not registering. I tested it out and if I have a setup like:
- name: GET REPO
uses: octokit/request-action@v2.x
id: getRepo
with:
route: GET /repos/{repo}
repo: ${{github.repository}}
mediaType: '{"Accept": application/vnd.github.v3+json}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
I get the error, but if I replace the route to look like this without the repo
parameter:
route: GET /repos/${{github.repository}}
It works
It might be related to URL parameter encoding, see my comment here: #69 (comment)
Can you try setting owner
/ repo
separately? The /
character in github.repository
is what is likely causing the problem here
Yes, that was it. Following 9736caa works. The workflow had not been updated with that usage change.
I'd recommend bumping more than just the patch version to indicate there was a breaking change.
I'd recommend bumping more than just the patch version to indicate there was a breaking change.
That change was not intentional, I'll try to fix/workaround it and push another version today
Thanks for clarifying the title!
In case you're still curious, here's the debug log: https://gist.github.com/kd7lxl/29ad1c2144692e49cc7067e2af634a87
Thanks! You can see the incorrect URL encoding of the repository owner/name
in https://gist.github.com/kd7lxl/29ad1c2144692e49cc7067e2af634a87#file-action-log-L102, that's why you get a 404
๐ This issue has been resolved in version 2.0.26 ๐
The release is available on GitHub release
Your semantic-release bot ๐ฆ๐