When you are using code repository locally, you can install hooks for all kinds of actions. In the same manner, at OSDN, you can use “Webhooks”.
To be more specific, when you are pushing (in the case of svn, committing), you will be converting the contents to JSON format and POST it on the assigned URL. At the destination of the POST, you can interpret JSON to request whatever action you like.
Login as admin of the project or chamber, then go to the repository browser and choose the submenu “hook settings” to set up.
The data structure is designed to be similar to that of github. However currently, it does not contain each commit information that exist in the push data.
Like general HTML format, data is in the form of Content-Disposiotn: form-data, and gets sent in Post method. It has a key called “payload”. The inside is JSON format.
- {
- "after": "6829ef8417b4d6c7cb20f4a34b6ccf4cb97dabe2",
- "before": "6789be548cc0d16a94f6d128ff813b64184ba549",
- "head_commit": {
- "author": {
- "email": "sugi@nemui.org",
- "name": "Tatsuki Sugiura"
- },
- "id": "6829ef8417b4d6c7cb20f4a34b6ccf4cb97dabe2",
- "message": "Test!\n",
- "timestamp": "2013-06-07T17:34:49",
- "url": "https://osdn.net/users/sugi/pf/sugitest/commits/6829ef8417b4d6c7cb20f4a34b6ccf4cb97dabe2"
- },
- "pusher": "sugi",
- "ref": "refs/heads/master",
- "repository": {
- "created_at": 1291198691,
- "description": "<i> test",
- "id": "6",
- "name": "sugitest",
- "pushed_at": 1370594094,
- "type": "git",
- "url": "https://osdn.net/users/sugi/pf/sugitest/"
- }
- }
Fields | git | hg | svn |
---|---|---|---|
after | Commit ID after pushing | The Commit ID after (of the final) pushing | Committed Revision |
before | Commit ID before pushing | The first Commit ID of the push | null |
head_commit | Commit information of the after's ID | Commit information of the after's ID | Commit information |
pusher | OSDN user ID | ||
ref | Ref of the destination of the push | The branch name of the push | The directory path that has been changed |
repository | Repository Information |
Press the “test” button to execute the hook request using the lastly pushed information. By using requestbin and the likes, you can confirm the data that will be sent.
[PageInfo]
LastUpdate: 2016-10-04 13:01:11, ModifiedBy: ishikawa
[License]
GNU Free Documentation License
[Permissions]
view:all, edit:members, delete/config:members