Set more environment variables to allow their use in custom hooks #103

Closed
opened 2025-11-02 03:08:58 -06:00 by GiteaMirror · 10 comments
Owner

Originally created by @afdev82 on GitHub (Nov 30, 2016).

In order to write custom hooks that use some variables, Gitea should export them in the environment.

For example, currently I need to know the user that is pushing a branch.
I think this could be easily done adding an os.Setenv line like here.

Originally created by @afdev82 on GitHub (Nov 30, 2016). In order to write custom hooks that use some variables, Gitea should export them in the environment. For example, currently I need to know the user that is pushing a branch. I think this could be easily done adding an `os.Setenv` line like [here](https://github.com/gogits/gogs/blob/7e15ff9486cde36b76f3d39b7db23f89278acb7d/cmd/serve.go#L256).
GiteaMirror added the type/proposaltype/enhancement labels 2025-11-02 03:08:58 -06:00
Author
Owner

@strk commented on GitHub (Dec 2, 2016):

#317 adds one such variable, do you have a list of variables you think should be exposed ?

@strk commented on GitHub (Dec 2, 2016): #317 adds one such variable, do you have a list of variables you think should be exposed ?
Author
Owner

@afdev82 commented on GitHub (Dec 2, 2016):

@strk Yes, I opened the #317 😛
I don't have a list, I think it's enough to know the user that is pushing (for my actual needs).
I saw that also the https://github.com/gogits/gogs/pull/3921, I think we should agree how many variables to expose and document that.
I exported the name, because I don't think it's a good idea to expose the id. IMHO for a custom hook it would be enough to have the name (to whitelist it).

@afdev82 commented on GitHub (Dec 2, 2016): @strk Yes, I opened the #317 :stuck_out_tongue: I don't have a list, I think it's enough to know the user that is pushing (for my actual needs). I saw that also the https://github.com/gogits/gogs/pull/3921, I think we should agree how many variables to expose and document that. I exported the name, because I don't think it's a good idea to expose the id. IMHO for a custom hook it would be enough to have the name (to whitelist it).
Author
Owner

@lunny commented on GitHub (Dec 3, 2016):

since #317 is in 1.1, so I change this to 1.1

@lunny commented on GitHub (Dec 3, 2016): since #317 is in 1.1, so I change this to 1.1
Author
Owner

@tboerger commented on GitHub (Dec 3, 2016):

I would take that into the 1.0 release because users like @afdev82 are able to provide hooks for protected branches until we release native protected branches. This change is quite simple.

@tboerger commented on GitHub (Dec 3, 2016): I would take that into the 1.0 release because users like @afdev82 are able to provide hooks for protected branches until we release native protected branches. This change is quite simple.
Author
Owner

@lunny commented on GitHub (Dec 4, 2016):

Then what's the status of #317? If #317 will be merged in 1.0, this could be changed to 1.0

@lunny commented on GitHub (Dec 4, 2016): Then what's the status of #317? If #317 will be merged in 1.0, this could be changed to 1.0
Author
Owner

@tboerger commented on GitHub (Dec 4, 2016):

It just needs another lgtm

@tboerger commented on GitHub (Dec 4, 2016): It just needs another lgtm
Author
Owner

@bkcsoft commented on GitHub (Dec 5, 2016):

@afdev82 was this supposed to be closed with #317 ? otherwise feel free to reopen it (it got closed automagically by merging 317)

@bkcsoft commented on GitHub (Dec 5, 2016): @afdev82 was this supposed to be closed with #317 ? otherwise feel free to reopen it (it got closed automagically by merging 317)
Author
Owner

@afdev82 commented on GitHub (Dec 5, 2016):

@bkcsoft Yes, it's fine. Thanks ;)

@afdev82 commented on GitHub (Dec 5, 2016): @bkcsoft Yes, it's fine. Thanks ;)
Author
Owner

@afdev82 commented on GitHub (Dec 5, 2016):

I didn't understand the target version, I thought was the 1.0.0 release in the end.

@afdev82 commented on GitHub (Dec 5, 2016): I didn't understand the target version, I thought was the 1.0.0 release in the end.
Author
Owner

@tboerger commented on GitHub (Dec 5, 2016):

You are right, it will be available for 1.0.0

@tboerger commented on GitHub (Dec 5, 2016): You are right, it will be available for 1.0.0
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#103