Versions Compared
Key
- This line was added.
- This line was removed.
- Formatting was changed.
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
...
Table of Contents |
---|
Merge Check Hook
Objects
changeSet
List of changesets
Code Block |
---|
[{
"fromHash":"ahash",
"toHash":"bash",
"refId","refId",
"type":"add",
"branch":"master"
},{
"fromHash":"ahash",
"toHash":"bash",
"refId","refId",
"type":"add",
"branch":"master"
}] |
repository
Basic Metadata about the repository
Code Block |
---|
{
"id":1232,
"name":"Repository name",
"slug":"rep_1"
} |
project
Basic metadata about the project
Code Block |
---|
{
"key":"PROJECT_1",
"name":"Project name"
} |
currentUser
Returns the current user
Code Block |
---|
{
"userName":"bsmith",
"fullName": "Bob Smith",
"email": "bob@example.com"
} |
Functions
Function | Sample call | Data returned | ||
---|---|---|---|---|
stash.log(str)Puts a log entry in the atlassian-stash.log | stash.log('Debug');{code} | None | ||
stash.sendEmail( to, subject, body)Sends an email to the toEmail from the fromUser | stash.sendEmail('bob@example.com','Hello World!','My body goes here'); | None | ||
stash.getUser(String username)Looks up a stash user | stash.getUser('jbob') |
| ||
stash.getUsersInGroup(String groupname)Looks up a list of users by group | stash.getUsersInGroup('stash-users'); |
| ||
stash.sendHttp( method, url)Makes an http request to desired url | stash.sendHttp('GET','http://example.com'); |
| ||
stash.sendHttp( method, url, body)Makes an http request to desired url with a body | stash.sendHttp('PUT','http://example.com','{}'); |
| ||
stash.sendFeedback( subject, body, block)Provides feedback to the end user. If block(boolean) is true then the action will be rejected |
| None | ||
stash.executeCommand(command)Executes the command | stash.executeCommand('echo "Hello World!"'); |
| ||
stash.fetchCommit(projectKey, repoSlug, refId)Retrieves a single commit | stash.fetchCommits('PROJECT_1', 'rep_1', '0a943a29376f2336b78312d99e65da17048951db') |
| ||
stash.fetchCommits(projectKey, repoSlug, startRef, endRef)Retrieves multiple commits | stash.fetchCommits('PROJECT_1', 'rep_1', '0a943a29376f2336b78312d99e65da17048951db','0a943a29376f2336b78312d99e65da17048951db') |
|
Post Hook
Same as above with following exceptions:
Pre-Receive Hook
Same as above with following exceptions: