Open Xulunix opened 1 year ago
Is there any other way to get the users email address in a job or to notify him of the result?
Maybe it should be an internal feature of Gitea to balance privacy and usage.
Moving the delivery notification of the action result to Gitea itself would be the best solution. This way one could remove the requirement for mail credentials to be present on the runner as well.
Hi there, we have the same problem. Pull requests are pushed to a CI pipeline system and the author of the pull requst get's an email with the result. Since the update, these emails can no longer be deliered. Maybe we can have a global preference e.g. in app.ini to control the behavior?
@lunny How should we proceed on this? Is there something planned for upcoming releases (1.22?) that enables pipelines to get the email address again or a native way to have Gitea notify the user about the result of an action? This feature was an important part of the workflow for me and others.
Warning workaround, it's not known if this will be disabled by a security fix
I don't like that Gitea Actions needs security workarounds for the email, but here we are.
You can still get your email, asking rest to give you the mail (at least if it is visible for other users). Tested with latest 1.20.5 and nightly agent
on:
push:
jobs:
comment:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
id: get-mail
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
return (await github.rest.users.getByUsername({
username: ${{ tojson(github.event.sender.login) }}
})).data.email;
result-encoding: string
- name: Print Email
run: |
echo ${{ steps.get-mail.outputs.result }}
edit: encode result as string instead of json
I'm very creative in writing workarounds in the Actions Ecosystem
I'm not shure why this should be needed to get the mail, but what does I know
Warning workaround, it's not known if this will be disabled by a security fix
I don't like that Gitea Actions needs security workarounds for the email, but here we are.
You can still get your email, asking rest to give you the mail (at least if it is visible for other users). Tested with latest 1.20.5 and nightly agent
on: push: jobs: comment: runs-on: ubuntu-latest steps: - uses: actions/github-script@v6 id: get-mail with: github-token: ${{secrets.GITHUB_TOKEN}} script: | return (await github.rest.users.getByUsername({ username: ${{ tojson(github.event.sender.login) }} })).data.email; result-encoding: string - name: Print Email run: | echo ${{ steps.get-mail.outputs.result }}
edit: encode result as string instead of json
I'm very creative in writing workarounds in the Actions Ecosystem
I'm not shure why this should be needed to get the mail, but what does I know
I can confirm this workaround does return the actual email. However, i think there shouldn't be the need for a workaround for such common features.
Description
Since Version 1.20.3 or 1.20.4, the email address of the pusher is no longer available in the context of a running action. Instead it is replaced by the hidden USERNAME@noreply.HOSTNAME placeholder. We were using the pushers email address in order to notify him about the results of tests running in actions. This is now broken as i can't find another way to get the email address of the user in the context of a action.
The Issue might be related to this: https://github.com/go-gitea/gitea/pull/26350
Gitea Version
1.20.4
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Screenshots
No response
Git Version
2.40.1
Operating System
Rootless Gitea image
How are you running Gitea?
Rootless Gitea image in Kubernetes (repackaged to include custom root-ca certs)
Database
PostgreSQL