You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The action returns additional outputs thanks to #105, but it would be great to return also the GitHub App user id, which we can fetch using the GH CLI for instance with gh api "/users/<app-slug>[bot]" --jq .id.
The rationale is that to get the commit authenticated properly, we have to use the user id and not the installation id (as also mentioned in this discussion. This was discussed in the mentioned PR, but somehow only the installation id was added to the outputs.
installation-id is not equal to user id. #105 (comment)
The user id can be obtained by requesting https://github.com/proxy/api.github.com/users/$AppSlug[bot].
Here's how my bot signature is generated.
functionset_dco_signature {
if [[ $TOKEN== ghp_* ]];then# https://github.blog/2021-04-05-behind-githubs-new-authentication-token-formats/# What starts with 'ghp_' is the GitHub personal access token
response=$(curl -s -H "Authorization: token $TOKEN""$GITHUB_URL/user")elif [[ $APP_SLUG ]];then
CommitBot=$APP_SLUGelse
CommitBot="github-actions"fiif [[ $CommitBot ]];then
response=$(curl -s -H "Authorization: token $TOKEN""$GITHUB_URL/users/$CommitBot\[bot\]")fi
CommitBot=$(echo "$response"| jq -r '.login')
id=$(echo "$response"| jq -r '.id')echo"Signed-off-by: $CommitBot <$id+$CommitBot@users.noreply.github.com>"
}
installation-id is not equal to user id. #105 (comment) The user id can be obtained by requesting https://github.com/proxy/api.github.com/users/$AppSlug[bot].
Here's how my bot signature is generated.
functionset_dco_signature {
if [[ $TOKEN== ghp_* ]];then# https://github.blog/2021-04-05-behind-githubs-new-authentication-token-formats/# What starts with 'ghp_' is the GitHub personal access token
response=$(curl -s -H "Authorization: token $TOKEN""$GITHUB_URL/user")elif [[ $APP_SLUG ]];then
CommitBot=$APP_SLUGelse
CommitBot="github-actions"fiif [[ $CommitBot ]];then
response=$(curl -s -H "Authorization: token $TOKEN""$GITHUB_URL/users/$CommitBot\[bot\]")fi
CommitBot=$(echo "$response"| jq -r '.login')
id=$(echo "$response"| jq -r '.id')echo"Signed-off-by: $CommitBot <$id+$CommitBot@users.noreply.github.com>"
}
Exactly, which is why I think it makes sense to return it as an output to the action 😄
Yes, that would work indeed, but my initial thought was that as the action returns metadata already it would make sense, even if it requires one additional call.
If not possible I will adapt in that way.
Yes, that would work indeed, but my initial thought was that as the action returns metadata already it would make sense, even if it requires one additional call.
If not possible I will adapt in that way.
Actions are composable, I'd rather document how to get what you want in our README as it is a common request, but not add more code to this action
I think @maboloshi suggestion above is great on how to get the app user ID.
By the way, for @semantic-release specifically, I don't think it's necessary unless you use the git plugin. I'm co-maintain semantic-release and use it a lot, I never needed to set any of theGIT_ environment variables. But feel free to open an issue over at @semantic-release as it's off-topic for this discussion.
Yes, that would work indeed, but my initial thought was that as the action returns metadata already it would make sense, even if it requires one additional call.
If not possible I will adapt in that way.
Actions are composable, I'd rather document how to get what you want in our README as it is a common request, but not add more code to this action
I think @maboloshi suggestion above is great on how to get the app user ID.
By the way, for @semantic-release specifically, I don't think it's necessary unless you use the git plugin. I'm co-maintain semantic-release and use it a lot, I never needed to set any of theGIT_ environment variables. But feel free to open an issue over at @semantic-release as it's off-topic for this discussion.
Thanks, I can open a PR to mention this to the readme file then.
And I am indeed using the git plugin for my semantic release configuration, hence the need for environment variables!
Activity
maboloshi commentedon Jun 26, 2024
installation-idis not equal touser id. #105 (comment)The
user idcan be obtained by requestinghttps://github.com/proxy/api.github.com/users/$AppSlug[bot].Here's how my bot signature is generated.
vleon1a commentedon Jun 26, 2024
Exactly, which is why I think it makes sense to return it as an output to the action 😄
gr2m commentedon Jun 26, 2024
I agree it would be convenient to add the app's user ID to the output, but it would require an additional request that most users won't need.
I suggest we document that approach first in the README, with an extra step to retrieve the user ID using https://github.com/octokit/request-action/ or something similar.
vleon1a commentedon Jun 27, 2024
Maybe we could add an additional input to request it?
maboloshi commentedon Jun 27, 2024
@vleon1a You can try this.
vleon1a commentedon Jun 27, 2024
Yes, that would work indeed, but my initial thought was that as the action returns metadata already it would make sense, even if it requires one additional call.
If not possible I will adapt in that way.
gr2m commentedon Jun 27, 2024
Actions are composable, I'd rather document how to get what you want in our README as it is a common request, but not add more code to this action
I think @maboloshi suggestion above is great on how to get the app user ID.
By the way, for @semantic-release specifically, I don't think it's necessary unless you use the
gitplugin. I'm co-maintain semantic-release and use it a lot, I never needed to set any of theGIT_environment variables. But feel free to open an issue over at @semantic-release as it's off-topic for this discussion.vleon1a commentedon Jun 27, 2024
Thanks, I can open a PR to mention this to the readme file then.
And I am indeed using the
gitplugin for my semantic release configuration, hence the need for environment variables!maboloshi commentedon Jun 27, 2024
It looks like #145 is already doing this, probably with a preference for the
ghcommand.vleon1a commentedon Jul 1, 2024
Closing as the readme has been updated in #145