"{}" argument syntax in route does not work, ":" works
dzeyelid opened this issue · 6 comments
The README shows sample codes with {}
as an argument, but it does not work. The samples confuse users. I guess it's better to replace the syntax with :
.
For example,
# This does not work
- uses: octokit/request-action@v2.x
id: get_latest_release
with:
route: GET /repos/{owner}/{repo}/releases/latest
owner: octokit
repo: request-action
# This works
- uses: octokit/request-action@v2.x
id: get_latest_release
with:
route: GET /repos/:owner/:repo/releases/latest
owner: octokit
repo: request-action
Anyway, thanks for this great action!
Best regards,
We run our tests using the {}
notation, so I'm very sure that it works
request-action/.github/workflows/test.yml
Lines 14 to 22 in 3eac707
Here is the log from the latest test build:
https://github.com/octokit/request-action/runs/1746833106?check_suite_focus=true#step:7:62
What error are you getting?
Oh, I'm sorry. I tested once again to respond to you, I noticed my case was a particular one.
In summary, GET /repos/{owner}/{repo}/releases/latest
works but GET /repos/{repo}/releases/latest
does not work. GET /repos/:repo/releases/latest
also works.
The reason why I wrote the code above that because I thought it's convenient to use the context ${{ github.repository }}
to indicate repository. The context is a string like {owner}/{repo}
.
The action log is here https://github.com/dzeyelid/github-actions-playground/runs/1759887820
There is a difference in encoding depending on whether you use :
or {}
. When using the {}
notation, it correctly encodes the "/"
character as per specification. When using :
it does not, which is actually a bug, which in your case makes it work, but I would not depend on it. We will stop supporting :
in a future version altogether.
I would recommend to use the two URL parameters GET /repos/{owner}/{repo}/releases/latest
as it is documented. Alternatively you can use GET /repositories/{repository_id}/releases/latest
which is an endpoint that exist, but is not currently documented.
@gr2m Thanks for explain detailly. I'll fix my code with {}
.
(I hope split()
function will be added to GitHub Actions built-in function.)
Anyway, I close this issue. Thanks so much!
GET /repos/{repo}/releases/latest
should work again, via v2.0.26. Can you give it another try to confirm?
@gr2m Yes, I was able to see the result /repos/{repo}/releases/latest
by checking my improved workflow. It's convenient. :)
The action log is here.
https://github.com/dzeyelid/github-actions-playground/runs/1766724662
Thanks so much!