reconquest / atlassian-external-hooks

External Hooks plugin for Atlassian Bitbucket
https://external-hooks.reconquest.io
Other
44 stars 37 forks source link

Documentation for /dev/stdin ? #136

Open byteduty opened 1 year ago

byteduty commented 1 year ago

The example in the Debug scripts lists parameters passed via STDIN. I've been searching through all the documentation and other than mentions of GLOBAL VARIABLES and potential positional parameters I cannot find the details of the STDIN data. PLease can you point me to this, or document this?

Many apologies if it's just I've missed this multiple times

Colin.

kovetskiy commented 1 year ago

Hey, no worries, the scripts receive the standard git hooks stdin format, for example, for pre-receive: https://git-scm.com/docs/githooks#pre-receive

Here is an example where I use this stdin: https://external-hooks.reconquest.io/docs/example.bitbucket-add_hook_javascript_linter/#setting-up-hook

byteduty commented 1 year ago

@kovetskiy Thank you for the prompt confirmation, this makes sense.

It might be worth adding a sub-heading in the documentation to just clarify that in addition to the ENVIRONMENT VARIABLES, the standard Git hook stdin, as you've pointed out above is provided too the script:

This hook executes once for the receive operation. It takes no arguments, but for each ref to be updated it receives on standard input a line of the format:

SP SP LF where is the old object name stored in the ref, is the new object name to be stored in the ref and is the full name of the ref. When creating a new ref, is the all-zeroes object name.

Many thanks.