atlassian-external-hooks icon indicating copy to clipboard operation
atlassian-external-hooks copied to clipboard

Documentation for /dev/stdin ?

Open byteduty opened this issue 2 years ago • 2 comments

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.

byteduty avatar Feb 20 '23 15:02 byteduty

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

kovetskiy avatar Feb 21 '23 07:02 kovetskiy

@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.

byteduty avatar Feb 21 '23 12:02 byteduty