├── SECURITY.md ├── .github └── CODEOWNERS ├── CardTemplate └── Teams │ ├── HandleBars │ ├── issue_closed_reopened.handlebars │ ├── pull_request_closed_reopened.handlebars │ ├── issue_pr_comment_text.handlebars │ ├── pull_request_review_edited.handlebars │ ├── pull_request_review_submitted.handlebars │ ├── code_pushed.handlebars │ ├── issue_pr_comment_edited.handlebars │ ├── blob_unfurl.handlebars │ ├── repo_unfurl.handlebars │ ├── account_unfurl.handlebars │ ├── comment_unfurl.handlebars │ ├── issue_unfurl.handlebars │ ├── pull_unfurl.handlebars │ ├── issue_opened.handlebars │ └── pull_request_opened.handlebars │ └── Liquid │ └── issue_opened.liquid ├── EventTemplate └── HandleBars │ ├── issue_pull_request_generic.handlebars │ └── issue_opened.handlebars ├── LICENSE ├── CONTRIBUTING.md ├── CODE_OF_CONDUCT.md ├── README.md └── TransformerConfig.json /SECURITY.md: -------------------------------------------------------------------------------- 1 | If you discover a security issue in this repo, please submit it through the [GitHub Security Bug Bounty](https://hackerone.com/github) 2 | 3 | Thanks for helping make this module safe for everyone. 4 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # These owners will be the default owners for everything in the repo # 3 | ###################################################################### 4 | * @github/chatops 5 | -------------------------------------------------------------------------------- /CardTemplate/Teams/HandleBars/issue_closed_reopened.handlebars: -------------------------------------------------------------------------------- 1 | Issue {{action}} by 2 | @{{sender.login}}
3 | #{{issue.number}} {{{formatted_html issue.title}}}
-------------------------------------------------------------------------------- /EventTemplate/HandleBars/issue_pull_request_generic.handlebars: -------------------------------------------------------------------------------- 1 | { 2 | "sender_login": "{{sender.login}}", 3 | "sender_url": "{{sender.html_url}}", 4 | "comment_url": "{{comment.html_url}}", 5 | "comment_body": "{{{formatted_body_html comment.body}}}", 6 | "image_list" : [ 7 | {{#list_image comment.body}} 8 | "{{this}}", 9 | {{/list_image}} 10 | "" 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /CardTemplate/Teams/HandleBars/pull_request_closed_reopened.handlebars: -------------------------------------------------------------------------------- 1 | Pull request {{#if pull_request.merged}} merged {{else}} {{action}} {{/if}} by 2 | @{{sender.login}}
3 | #{{pull_request.number}} {{{formatted_html pull_request.title}}}
-------------------------------------------------------------------------------- /CardTemplate/Teams/HandleBars/issue_pr_comment_text.handlebars: -------------------------------------------------------------------------------- 1 | Comment 2 | by 3 | @{{sender_login}}
4 | {{#if comment_body}} 5 | {{{comment_body}}}
6 | {{/if}} 7 | 8 | {{#each image_list}} 9 | {{#if this }} 10 |
11 | {{/if}} 12 | {{/each}} 13 | -------------------------------------------------------------------------------- /CardTemplate/Teams/HandleBars/pull_request_review_edited.handlebars: -------------------------------------------------------------------------------- 1 | {{review_image_unicode review.state}} {{review_message review.state}} 2 | by 3 | @{{sender.login}}
4 | {{#if review.body}} 5 | {{{ formatted_body_html review.body}}}
6 | {{/if}} 7 | {{#list_image review.body}} 8 |
9 | {{/list_image}} 10 | -------------------------------------------------------------------------------- /CardTemplate/Teams/HandleBars/pull_request_review_submitted.handlebars: -------------------------------------------------------------------------------- 1 | {{review_image_unicode review.state}} {{review_message review.state}} 2 | by 3 | @{{sender.login}}
4 | {{#if review.body}} 5 | {{{ formatted_body_html review.body}}}
6 | {{/if}} 7 | {{#list_image review.body}} 8 |
9 | {{/list_image}} 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 GitHub 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /CardTemplate/Teams/HandleBars/code_pushed.handlebars: -------------------------------------------------------------------------------- 1 | {{#if (check_no_commits commitsCount forced)}}**force-pushed the [{{format_ref ref}}]({{repository.html_url}}/tree/{{format_ref ref}}) branch from [{{short_sha before}}]({{compare}}) to [{{short_sha after}}]({{compare}})** 2 |
{{repository.full_name}}
3 | {{else}} 4 | **[{{commitsCount}} new {{#if_plural commitsCount}}commits{{else}}commit{{/if_plural}}]({{compare}}) {{#if forced}}force-pushed {{else}}pushed {{/if}} to [{{format_ref ref}}]({{repository.html_url}}/tree/{{format_ref ref}}) by [{{sender.login}}]({{sender.html_url}})** 5 |
{{repository.full_name}}
6 | {{#each commits}} 7 | {{short_sha this.id}} {{format_message this.message}}
8 | {{/each}} 9 | {{/if}} 10 | -------------------------------------------------------------------------------- /CardTemplate/Teams/HandleBars/issue_pr_comment_edited.handlebars: -------------------------------------------------------------------------------- 1 | { 2 | "type": "AdaptiveCard", 3 | "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", 4 | "version": "1.0", 5 | "body": [ 6 | { 7 | "type": "TextBlock", 8 | "text": "Comment by **{{sender.login}}**" 9 | }, 10 | {{#if issue}} 11 | { 12 | "type": "TextBlock", 13 | "text": "[Comment on #{{issue.number}} {{{formatted_title issue.title}}}]({{comment.html_url}})" 14 | } 15 | {{/if}} 16 | {{#if pull_request}} 17 | { 18 | "type": "TextBlock", 19 | "text": "[Comment on #{{pull_request.number}} {{{formatted_title pull_request.title}}}]({{comment.html_url}})" 20 | } 21 | {{/if}} 22 | {{#if comment.body}} 23 | ,{ 24 | "type": "TextBlock", 25 | "text": "{{{formatted_body comment.body}}}", 26 | "wrap": true, 27 | "spacing" : "none" 28 | } 29 | {{/if}} 30 | {{#list_image comment.body}} 31 | ,{ 32 | "type": "Image", 33 | "url": "{{this}}" 34 | } 35 | {{/list_image}} 36 | ] 37 | } 38 | -------------------------------------------------------------------------------- /EventTemplate/HandleBars/issue_opened.handlebars: -------------------------------------------------------------------------------- 1 | { 2 | "type": "AdaptiveCard", 3 | "version": "1.0", 4 | "body": [ 5 | { 6 | "type": "ColumnSet", 7 | "columns": [ 8 | { 9 | "type": "Column", 10 | "width": "auto", 11 | "items": [ 12 | { 13 | "type": "TextBlock", 14 | "weight": "bolder", 15 | "text": "Issue opened {{issue.number}}: {{issue.title}}", 16 | "wrap": true 17 | }, 18 | { 19 | "type": "TextBlock", 20 | "size": "small", 21 | "isSubtle": true, 22 | "text": "Created by", 23 | "wrap": true, 24 | "spacing": "none", 25 | "separator": true 26 | } 27 | ] 28 | } 29 | ], 30 | "spacing": "large", 31 | "separator": true 32 | }, 33 | { 34 | "type": "Container", 35 | "items": [ 36 | { 37 | "type": "FactSet", 38 | "facts": [ 39 | { 40 | "title": "Repository: ", 41 | "value": "{{repository.name}}" 42 | } 43 | ] 44 | } 45 | ] 46 | } 47 | ] 48 | } -------------------------------------------------------------------------------- /CardTemplate/Teams/Liquid/issue_opened.liquid: -------------------------------------------------------------------------------- 1 | { 2 | "type": "AdaptiveCard", 3 | "version": "1.0", 4 | "body": [ 5 | { 6 | "type": "ColumnSet", 7 | "columns": [ 8 | { 9 | "type": "Column", 10 | "width": "auto", 11 | "items": [ 12 | { 13 | "type": "TextBlock", 14 | "weight": "bolder", 15 | "text": "Issue opened {{issue.number}}: {{issue.title | upcase }}", 16 | "wrap": true 17 | }, 18 | { 19 | "type": "TextBlock", 20 | "size": "small", 21 | "isSubtle": true, 22 | "text": "Created by", 23 | "wrap": true, 24 | "spacing": "none", 25 | "separator": true 26 | } 27 | ] 28 | } 29 | ], 30 | "spacing": "large", 31 | "separator": true 32 | }, 33 | { 34 | "type": "Container", 35 | "items": [ 36 | { 37 | "type": "FactSet", 38 | "facts": [ 39 | { 40 | "title": "Repository: ", 41 | "value": "{{repository.name | upcase }}" 42 | } 43 | ] 44 | } 45 | ] 46 | } 47 | ] 48 | } -------------------------------------------------------------------------------- /CardTemplate/Teams/HandleBars/blob_unfurl.handlebars: -------------------------------------------------------------------------------- 1 | { 2 | "preview": 3 | { 4 | "contentType": "application/vnd.microsoft.card.thumbnail", 5 | "contentUrl": null, 6 | "content": { 7 | "title": "{{{blob.name}}}", 8 | "subtitle": null, 9 | "text": "{{{repository.full_name}}}", 10 | "images": [ 11 | { 12 | "url": "{{repository.owner.avatar_url}}", 13 | "alt": null, 14 | "tap": null 15 | } 16 | ], 17 | "buttons": null, 18 | "tap": null 19 | }, 20 | "name": null, 21 | "thumbnailUrl": null 22 | }, 23 | "contentType": "application/vnd.microsoft.card.adaptive", 24 | "content": 25 | { 26 | "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", 27 | "type": "AdaptiveCard", 28 | "version": "1.0", 29 | "body": [ 30 | { 31 | "type": "Container", 32 | "items": [ 33 | { 34 | "type": "TextBlock", 35 | "text": "{{{blob.path}}}", 36 | "weight": "bolder", 37 | "size": "large", 38 | "wrap": true 39 | } 40 | {{#if blob.content}} 41 | , 42 | { 43 | "type": "TextBlock", 44 | "text": "{{{blob_formatted_content blob.content line}}}", 45 | "wrap": true 46 | } 47 | {{/if}} 48 | ] 49 | } 50 | ] 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Contributing 2 | 3 | [fork]: https://github.com/github/dte-templates/fork 4 | [pr]: https://github.com/github/dte-templates/compare 5 | [style]: https://github.com/styleguide/js 6 | [code-of-conduct]: CODE_OF_CONDUCT.md 7 | 8 | Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great. 9 | 10 | Contributions to this project are [released](https://help.github.com/articles/github-terms-of-service/#6-contributions-under-repository-license) to the public under the [project's open source license](LICENSE.md). 11 | 12 | Please note that this project is released with a [Contributor Code of Conduct][code-of-conduct]. By participating in this project you agree to abide by its terms. 13 | 14 | ## Submitting a pull request 15 | 16 | 0. [Fork][fork] and clone the repository 17 | 0. Create a new branch: `git checkout -b my-branch-name` 18 | 0. Make your change 19 | 0. Push to your fork and [submit a pull request][pr] 20 | 0. Pat your self on the back and wait for your pull request to be reviewed and merged. 21 | 22 | Here are a few things you can do that will increase the likelihood of your pull request being accepted: 23 | 24 | - Follow the [style guide][style]. 25 | - Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests. 26 | - Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html). 27 | 28 | ## Resources 29 | 30 | - [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/) 31 | - [Using Pull Requests](https://help.github.com/articles/about-pull-requests/) 32 | - [GitHub Help](https://help.github.com) 33 | -------------------------------------------------------------------------------- /CardTemplate/Teams/HandleBars/repo_unfurl.handlebars: -------------------------------------------------------------------------------- 1 | { 2 | "preview": 3 | { 4 | "contentType": "application/vnd.microsoft.card.thumbnail", 5 | "contentUrl": null, 6 | "content": { 7 | "title": "{{{repository.full_name}}}", 8 | "subtitle": null, 9 | {{#if repository.description}} 10 | "text": "{{{repository.description}}}", 11 | {{/if}} 12 | "images": [ 13 | { 14 | "url": "{{repository.owner.avatar_url}}", 15 | "alt": null, 16 | "tap": null 17 | } 18 | ], 19 | "buttons": null, 20 | "tap": null 21 | }, 22 | "name": null, 23 | "thumbnailUrl": null 24 | }, 25 | "contentType": "application/vnd.microsoft.card.adaptive", 26 | "content": 27 | { 28 | "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", 29 | "type": "AdaptiveCard", 30 | "version": "1.0", 31 | "body": [ 32 | { 33 | "type": "Container", 34 | "items": [ 35 | { 36 | "type": "TextBlock", 37 | "text": "{{{repository.full_name}}}", 38 | "weight": "bolder", 39 | "size": "large", 40 | "wrap": true 41 | } 42 | {{#if repository.description}} 43 | , 44 | { 45 | "type": "TextBlock", 46 | "text": "{{{formatted_body repository.description}}}", 47 | "wrap": true 48 | } 49 | {{/if}} 50 | {{#list_image repository.description}} 51 | , 52 | { 53 | "type": "Image", 54 | "url": "{{this}}" 55 | } 56 | {{/list_image}} 57 | ] 58 | }, 59 | { 60 | "type": "Container", 61 | "separator":true, 62 | "items": [ 63 | { 64 | "type": "FactSet", 65 | "separator":true, 66 | "facts": [ 67 | { 68 | "title": "Last Updated:", 69 | "value": "{{from_now_date repository.updated_at}}" 70 | } 71 | {{#if repository.network_count}} 72 | , 73 | { 74 | "title": "Forks:", 75 | "value": "{{repository.network_count}}" 76 | } 77 | {{/if}} 78 | {{#if repository.stargazers_count}} 79 | , 80 | { 81 | "title": "Stars:", 82 | "value": "{{repository.stargazers_count}}" 83 | } 84 | {{/if}} 85 | ] 86 | } 87 | ] 88 | } 89 | ] 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /CardTemplate/Teams/HandleBars/account_unfurl.handlebars: -------------------------------------------------------------------------------- 1 | { 2 | "preview": 3 | { 4 | "contentType": "application/vnd.microsoft.card.thumbnail", 5 | "contentUrl": null, 6 | "content": { 7 | "title": "{{#if account.name}}{{{account.name}}}{{else}}{{{account.login}}}{{/if}}", 8 | "subtitle": null, 9 | {{#if account.bio}} 10 | "text": "{{{account.bio}}}", 11 | {{/if}} 12 | "images": [ 13 | { 14 | "url": "{{account.avatar_url}}", 15 | "alt": null, 16 | "tap": null 17 | } 18 | ], 19 | "buttons": null, 20 | "tap": null 21 | }, 22 | "name": null, 23 | "thumbnailUrl": null 24 | }, 25 | "contentType": "application/vnd.microsoft.card.adaptive", 26 | "content": 27 | { 28 | "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", 29 | "type": "AdaptiveCard", 30 | "version": "1.0", 31 | "body": [ 32 | { 33 | "type": "Container", 34 | "items": [ 35 | { 36 | "type": "ColumnSet", 37 | "spacing": "small", 38 | "columns": [ 39 | { 40 | "type": "Column", 41 | "width": "50px", 42 | "verticalContentAlignment": "Center", 43 | "items": [ 44 | { 45 | "size": "small", 46 | "type": "Image", 47 | "url": "{{account.avatar_url}}", 48 | "height": "50px" 49 | } 50 | ] 51 | }, 52 | { 53 | "type": "Column", 54 | "width": "auto", 55 | "spacing": "small", 56 | "verticalContentAlignment": "Center", 57 | "items": [ 58 | { 59 | "type": "TextBlock", 60 | "text": "{{#if account.name}}{{{account.name}}}{{else}}{{{account.login}}}{{/if}}", 61 | "weight": "bolder", 62 | "size": "large", 63 | "wrap": true 64 | } 65 | {{#if account.bio}} 66 | , 67 | { 68 | "type": "TextBlock", 69 | "text": "{{{account.bio}}}", 70 | "wrap": true, 71 | "spacing": "None" 72 | } 73 | {{/if}} 74 | ] 75 | } 76 | ] 77 | } 78 | ] 79 | }, 80 | { 81 | "type": "Container", 82 | "separator":true, 83 | "items": [ 84 | { 85 | "type": "FactSet", 86 | "separator":true, 87 | "facts": [ 88 | {{#if account.location}} 89 | { 90 | "title": "Location:", 91 | "value": "{{{account.location}}}" 92 | }, 93 | {{/if}} 94 | { 95 | "title": "Repositories:", 96 | "value": "{{account.public_repos}}" 97 | } 98 | ] 99 | } 100 | ] 101 | } 102 | ] 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at opensource@github.com. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq 77 | -------------------------------------------------------------------------------- /CardTemplate/Teams/HandleBars/comment_unfurl.handlebars: -------------------------------------------------------------------------------- 1 | { 2 | "preview": 3 | { 4 | "contentType": "application/vnd.microsoft.card.thumbnail", 5 | "contentUrl": null, 6 | "content": { 7 | "title": "Comment on #{{issue.number}} {{{formatted_title issue.title}}}", 8 | "subtitle": null, 9 | "text": "{{issue.user.login}} commented on this issue.", 10 | "images": [ 11 | { 12 | "url": "{{issue.user.avatar_url}}", 13 | "alt": null, 14 | "tap": null 15 | } 16 | ], 17 | "buttons": null, 18 | "tap": null 19 | }, 20 | "name": null, 21 | "thumbnailUrl": null 22 | }, 23 | "contentType": "application/vnd.microsoft.card.adaptive", 24 | "content": 25 | { 26 | "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", 27 | "type": "AdaptiveCard", 28 | "version": "1.0", 29 | "body": [ 30 | { 31 | "type": "Container", 32 | "items": [ 33 | { 34 | "type": "TextBlock", 35 | "text": "Comment on #{{issue.number}} {{{formatted_title issue.title}}}", 36 | "weight": "bolder", 37 | "size": "large", 38 | "wrap": true 39 | }, 40 | { 41 | "type": "ColumnSet", 42 | "spacing": "small", 43 | "columns": [ 44 | { 45 | "type": "Column", 46 | "width": "auto", 47 | "items": [ 48 | { 49 | "size": "small", 50 | "type": "Image", 51 | "url": "{{issue.user.avatar_url}}", 52 | "height": "25px" 53 | } 54 | ] 55 | }, 56 | { 57 | "type": "Column", 58 | "width": "auto", 59 | "spacing": "small", 60 | "verticalContentAlignment": "Center", 61 | "items": [ 62 | { 63 | "type": "TextBlock", 64 | "text": "[{{issue.user.login}}]({{issue.user.url}}) commented on this issue.", 65 | "wrap": true 66 | } 67 | ] 68 | } 69 | ] 70 | }, 71 | { 72 | "type": "ColumnSet", 73 | "spacing": "small", 74 | "columns": [ 75 | { 76 | "type": "Column", 77 | "width": "auto", 78 | "verticalContentAlignment": "Center", 79 | "items": [ 80 | { 81 | "size": "small", 82 | "type": "Image", 83 | "url": "{{baseURL}}/static/img/github-mark.png", 84 | "height": "15px" 85 | } 86 | ] 87 | }, 88 | { 89 | "type": "Column", 90 | "width": "auto", 91 | "spacing": "small", 92 | "verticalContentAlignment": "Center", 93 | "items": [ 94 | { 95 | "type": "TextBlock", 96 | "text": "[{{{repository.full_name}}}]({{repository.html_url}})", 97 | "wrap": true 98 | } 99 | ] 100 | } 101 | ] 102 | } 103 | ] 104 | }, 105 | { 106 | "type": "Container", 107 | "separator":true, 108 | "items": [ 109 | {{#if comment.body}} 110 | { 111 | "type": "TextBlock", 112 | "text": "{{{formatted_body comment.body}}}", 113 | "wrap": true 114 | } 115 | {{/if}} 116 | {{#list_image comment.body}} 117 | , 118 | { 119 | "type": "Image", 120 | "url": "{{this}}" 121 | } 122 | {{/list_image}} 123 | ] 124 | } 125 | ] 126 | } 127 | } 128 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # dte-templates 2 | 3 | Contains templates that can be used by [Dynamic-Template-Engine](https://github.com/github/Dynamic-Template-Engine) node module. This repository showcases how the templates are need to be structured for ensuring proper loading and rendering of the templates. 4 | 5 | # About 6 | 7 | This repository houses templates utilized by Teams + Github integration code, moreover it showcases how templates can be used with [Dynamic-Template-Engine](https://github.com/github/Dynamic-Template-Engine) node module. 8 | 9 | # Table of contents 10 | 11 | - [How to use?](#how-to-use) 12 | - [Using a public repo vs local copy?](#using-a-public-repo-vs-local-copy) 13 | - [Understanding the TransformerConfig](#understanding-the-transformerConfig) 14 | - [Setup](#setup) 15 | 16 | ## How to use? 17 | 18 | The templates can be loaded by [Dynamic-Template-Engine](https://github.com/github/Dynamic-Template-Engine) node module at runtime from either the local copies of templates or from a public github repository. The only requirement for the repository and/or from the local version is to adhere to the pre defined template directory structure with a Transformer Config json file. 19 | 20 | The structure of the template directory either the local or the cloud version should be as follows: 21 | 22 | ``` 23 | | -> CardTemplate ------------> [CLIENT_NAME] (currently only Teams supported) -------> [TEMPLATE_ENGINE_NAME] (ex. Liquid, HandleBars) -------------> Template files 24 | | -> EventTemplate -----------> [TEMPLATE_ENGINE_NAME] (ex. Liquid, HandleBars) -------------> Template files 25 | | -> TransformerConfig.json (this should have all the template registered for successful loading by the engine. 26 | ``` 27 | An example of the above structure: 28 | ``` 29 | CardTemplate ---> Teams ---> HandleBars ---> Hello.handlebars 30 | EventTemplate ---> Liquid ---> World.liquid 31 | ``` 32 | 33 | More Info of how to use the templates with [Dynamic-Template-Engine](https://github.com/github/Dynamic-Template-Engine) can be found [here](https://github.com/github/Dynamic-Template-Engine/tree/master#template-directory-structure) 34 | 35 | > :warning: **NOTE**: The names of the folders are case sensitive 36 | 37 | ## Using a public repo vs local copy? 38 | 39 | If the templates you use are generic or do not contain any internal data then having those templates in a public repo allows you to share your templates with the world, helping get user contributions and suggestions. 40 | If the templates being used have content you wish to keep private, then having the templates as a local copy is the recommended way. 41 | 42 | ## Understanding the TransformerConfig 43 | 44 | The TransformerConfig.json is the file that allows you to load different templates for different tasks. Following is an example TransformConfig.json 45 | ``` 46 | { 47 | "cardRenderer":[ 48 | { 49 | "SourceType": "IssueOpened", // Source type can be any string 50 | "ClientType": "Teams", // Has to be an ClientType value currently only Teams is supported 51 | "TemplateType": "HandleBars", // Has to be TemplateType enum value, currently HandleBars and Liquid are the two supported 52 | "TemplateName": "issue_opened.handlebars" // name of the template file 53 | }, 54 | { 55 | "SourceType": "IssueReopened", 56 | "ClientType": "Teams", 57 | "TemplateType": "HandleBars", 58 | "TemplateName": "issue_reopened.handlebars" 59 | } 60 | ], 61 | "partials":[], 62 | "eventTransformer":[ 63 | { 64 | "SourceType":"IssueOpened",// Source type can be any string 65 | "TemplateType":"HandleBars",// Has to be TemplateType enum value, currently HandleBars and Liquid are the two supported 66 | "TemplateName":"issue_opened.handlebars" // name of the template file 67 | } 68 | ] 69 | } 70 | ``` 71 | 72 | ## Setup 73 | 74 | For setting up the dynamic-template-engine to work with a repo follow the [setup instructions of dynamic-template-engine](https://github.com/github/Dynamic-Template-Engine#setup) 75 | 76 | ## Contributing 77 | Want to help improve the integration between GitHub and Slack? Check out the [contributing docs](CONTRIBUTING.md) to get involved. 78 | 79 | ## Code of Conduct 80 | 81 | See [our code of conduct](CODE_OF_CONDUCT.md). 82 | 83 | ## License 84 | The project is available as open source under the terms of the [MIT License](LICENSE). 85 | 86 | When using the GitHub logos, be sure to follow the [GitHub logo guidelines](https://github.com/logos). 87 | 88 | ## Maintainer Contact 89 | 90 | To reach out the the maintainers use [mail](mailto:opensource+github/dte-templates@github.com) 91 | -------------------------------------------------------------------------------- /TransformerConfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "cardRenderer":[ 3 | { 4 | "SourceType": "IssueOpened", 5 | "ClientType": "Teams", 6 | "TemplateType": "HandleBars", 7 | "TemplateName": "issue_opened.handlebars" 8 | }, 9 | { 10 | "SourceType": "IssueReopened", 11 | "ClientType": "Teams", 12 | "TemplateType": "HandleBars", 13 | "TemplateName": "issue_opened.handlebars" 14 | }, 15 | { 16 | "SourceType": "IssueClosed", 17 | "ClientType": "Teams", 18 | "TemplateType": "HandleBars", 19 | "TemplateName": "issue_opened.handlebars" 20 | }, 21 | { 22 | "SourceType": "IssueReopenedReply", 23 | "ClientType": "Teams", 24 | "TemplateType": "HandleBars", 25 | "TemplateName": "issue_closed_reopened.handlebars" 26 | }, 27 | { 28 | "SourceType": "IssueClosedReply", 29 | "ClientType": "Teams", 30 | "TemplateType": "HandleBars", 31 | "TemplateName": "issue_closed_reopened.handlebars" 32 | }, 33 | { 34 | "SourceType": "IssueUpdated", 35 | "ClientType": "Teams", 36 | "TemplateType": "HandleBars", 37 | "TemplateName": "issue_opened.handlebars" 38 | }, 39 | { 40 | "SourceType": "IssuePRComment", 41 | "ClientType": "Teams", 42 | "TemplateType": "HandleBars", 43 | "TemplateName": "issue_pr_comment_text.handlebars" 44 | }, 45 | { 46 | "SourceType": "PullRequestOpened", 47 | "ClientType": "Teams", 48 | "TemplateType": "HandleBars", 49 | "TemplateName": "pull_request_opened.handlebars" 50 | }, 51 | { 52 | "SourceType": "PullRequestClosed", 53 | "ClientType": "Teams", 54 | "TemplateType": "HandleBars", 55 | "TemplateName": "pull_request_opened.handlebars" 56 | }, 57 | { 58 | "SourceType": "PullRequestReopened", 59 | "ClientType": "Teams", 60 | "TemplateType": "HandleBars", 61 | "TemplateName": "pull_request_opened.handlebars" 62 | }, 63 | { 64 | "SourceType": "PullRequestReopenedReply", 65 | "ClientType": "Teams", 66 | "TemplateType": "HandleBars", 67 | "TemplateName": "pull_request_closed_reopened.handlebars" 68 | }, 69 | { 70 | "SourceType": "PullRequestClosedReply", 71 | "ClientType": "Teams", 72 | "TemplateType": "HandleBars", 73 | "TemplateName": "pull_request_closed_reopened.handlebars" 74 | }, 75 | { 76 | "SourceType": "PullRequestUpdated", 77 | "ClientType": "Teams", 78 | "TemplateType": "HandleBars", 79 | "TemplateName": "pull_request_opened.handlebars" 80 | }, 81 | { 82 | "SourceType": "IssueOpened", 83 | "ClientType": "Teams", 84 | "TemplateType": "Liquid", 85 | "TemplateName": "issue_opened.liquid" 86 | }, 87 | { 88 | "SourceType": "CodePushed", 89 | "ClientType": "Teams", 90 | "TemplateType": "HandleBars", 91 | "TemplateName": "code_pushed.handlebars" 92 | }, 93 | { 94 | "SourceType": "issue.unfurl", 95 | "ClientType": "Teams", 96 | "TemplateType": "HandleBars", 97 | "TemplateName": "issue_unfurl.handlebars" 98 | }, 99 | { 100 | "SourceType": "pull.unfurl", 101 | "ClientType": "Teams", 102 | "TemplateType": "HandleBars", 103 | "TemplateName": "pull_unfurl.handlebars" 104 | }, 105 | { 106 | "SourceType": "comment.unfurl", 107 | "ClientType": "Teams", 108 | "TemplateType": "HandleBars", 109 | "TemplateName": "comment_unfurl.handlebars" 110 | }, 111 | { 112 | "SourceType": "repo.unfurl", 113 | "ClientType": "Teams", 114 | "TemplateType": "HandleBars", 115 | "TemplateName": "repo_unfurl.handlebars" 116 | }, 117 | { 118 | "SourceType": "account.unfurl", 119 | "ClientType": "Teams", 120 | "TemplateType": "HandleBars", 121 | "TemplateName": "account_unfurl.handlebars" 122 | }, 123 | { 124 | "SourceType": "blob.unfurl", 125 | "ClientType": "Teams", 126 | "TemplateType": "HandleBars", 127 | "TemplateName": "blob_unfurl.handlebars" 128 | }, 129 | { 130 | "SourceType": "PullRequestReviewSubmitted", 131 | "ClientType": "Teams", 132 | "TemplateType": "HandleBars", 133 | "TemplateName": "pull_request_review_submitted.handlebars" 134 | }, 135 | { 136 | "SourceType": "PullRequestReviewEdited", 137 | "ClientType": "Teams", 138 | "TemplateType": "HandleBars", 139 | "TemplateName": "pull_request_review_edited.handlebars" 140 | } 141 | ], 142 | "partials":[], 143 | "eventTransformer":[ 144 | { 145 | "SourceType":"IssueOpened", 146 | "TemplateType":"HandleBars", 147 | "TemplateName":"issue_opened.handlebars" 148 | }, 149 | { 150 | "SourceType": "IssueOrPRPayloadGeneric", 151 | "TemplateType": "HandleBars", 152 | "TemplateName": "issue_pull_request_generic.handlebars" 153 | } 154 | ] 155 | } -------------------------------------------------------------------------------- /CardTemplate/Teams/HandleBars/issue_unfurl.handlebars: -------------------------------------------------------------------------------- 1 | { 2 | "preview": 3 | { 4 | "contentType": "application/vnd.microsoft.card.thumbnail", 5 | "contentUrl": null, 6 | "content": { 7 | "title": "#{{issue.number}} {{{formatted_title issue.title}}}", 8 | "subtitle": null, 9 | "text": "{{issue.state}} | {{issue.user.login}} created this issue on {{formatted_date issue.created_at}} | {{issue.comments}} {{#if_plural issue.comments}}comments{{else}}comment{{/if_plural}}", 10 | "images": [ 11 | { 12 | "url": "{{issue.user.avatar_url}}", 13 | "alt": null, 14 | "tap": null 15 | } 16 | ], 17 | "buttons": null, 18 | "tap": null 19 | }, 20 | "name": null, 21 | "thumbnailUrl": null 22 | }, 23 | "contentType": "application/vnd.microsoft.card.adaptive", 24 | "content": 25 | { 26 | "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", 27 | "type": "AdaptiveCard", 28 | "version": "1.0", 29 | "body": [ 30 | { 31 | "type": "Container", 32 | "items": [ 33 | { 34 | "type": "TextBlock", 35 | "text": "#{{issue.number}} {{{formatted_title issue.title}}}", 36 | "weight": "bolder", 37 | "size": "large", 38 | "wrap": true 39 | }, 40 | { 41 | "type": "ColumnSet", 42 | "spacing": "small", 43 | "columns": [ 44 | { 45 | "type": "Column", 46 | "width": "auto", 47 | "items": [ 48 | { 49 | "size": "small", 50 | "type": "Image", 51 | "url": "{{issue.user.avatar_url}}", 52 | "height": "25px" 53 | } 54 | ] 55 | }, 56 | { 57 | "type": "Column", 58 | "width": "auto", 59 | "spacing": "small", 60 | "verticalContentAlignment": "Center", 61 | "items": [ 62 | { 63 | "type": "TextBlock", 64 | "text": "[{{issue.user.login}}]({{issue.user.url}}) created this issue on {{formatted_date issue.created_at}}. {{issue.comments}} {{#if_plural issue.comments}}comments{{else}}comment{{/if_plural}}", 65 | "wrap": true 66 | } 67 | ] 68 | } 69 | ] 70 | }, 71 | { 72 | "type": "ColumnSet", 73 | "spacing": "small", 74 | "columns": [ 75 | { 76 | "type": "Column", 77 | "width": "auto", 78 | "items": [ 79 | { 80 | "size": "small", 81 | "type": "Image", 82 | "url": "{{baseURL}}{{get_status_image_issue 'issue' issue.state}}", 83 | "height": "25px" 84 | } 85 | ] 86 | }, 87 | { 88 | "type": "Column", 89 | "width": "auto", 90 | "verticalContentAlignment": "Center", 91 | "items": [ 92 | { 93 | "size": "small", 94 | "type": "Image", 95 | "url": "{{baseURL}}/static/img/github-mark.png", 96 | "height": "15px" 97 | } 98 | ] 99 | }, 100 | { 101 | "type": "Column", 102 | "width": "auto", 103 | "spacing": "small", 104 | "verticalContentAlignment": "Center", 105 | "items": [ 106 | { 107 | "type": "TextBlock", 108 | "text": "[{{repository.full_name}}]({{repository.html_url}})", 109 | "wrap": true 110 | } 111 | ] 112 | } 113 | ] 114 | } 115 | ] 116 | }, 117 | { 118 | "type": "Container", 119 | "separator":true, 120 | "items": [ 121 | {{#if issue.body}} 122 | { 123 | "type": "TextBlock", 124 | "text": "{{{formatted_body issue.body}}}", 125 | "wrap": true 126 | }, 127 | {{/if}} 128 | {{#list_image issue.body}} 129 | { 130 | "type": "Image", 131 | "url": "{{this}}" 132 | }, 133 | {{/list_image}} 134 | { 135 | "type": "FactSet", 136 | "separator":true, 137 | "facts": [ 138 | {{#if issue.labels}} 139 | { 140 | "title": "Labels:", 141 | "value": "{{label_short_text issue.labels}}" 142 | } 143 | {{/if}} 144 | {{#if issue.assignees }} 145 | {{#if issue.labels}} 146 | , 147 | {{/if}} 148 | { 149 | "title": "Assignees:", 150 | "value": "{{assignees_short_text issue}}" 151 | } 152 | {{/if}} 153 | ] 154 | } 155 | ] 156 | } 157 | ] 158 | } 159 | } 160 | -------------------------------------------------------------------------------- /CardTemplate/Teams/HandleBars/pull_unfurl.handlebars: -------------------------------------------------------------------------------- 1 | { 2 | "preview": 3 | { 4 | "contentType": "application/vnd.microsoft.card.thumbnail", 5 | "contentUrl": null, 6 | "content": { 7 | "title": "#{{pull.number}} {{{formatted_title pull.title}}}", 8 | "subtitle": null, 9 | "text": "{{#if pull.draft}}draft{{else}}{{pull.state}}{{/if}} | merge {{pull.commits}} {{#if_plural pull.commits}}commits{{else}}commit{{/if_plural}} into {{pull.base.ref}} from {{pull.head.ref}}", 10 | "images": [ 11 | { 12 | "url": "{{pull.user.avatar_url}}", 13 | "alt": null, 14 | "tap": null 15 | } 16 | ], 17 | "buttons": null, 18 | "tap": null 19 | }, 20 | "name": null, 21 | "thumbnailUrl": null 22 | }, 23 | "contentType": "application/vnd.microsoft.card.adaptive", 24 | "content": 25 | { 26 | "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", 27 | "type": "AdaptiveCard", 28 | "version": "1.0", 29 | "body": [ 30 | { 31 | "type": "Container", 32 | "items": [ 33 | { 34 | "type": "TextBlock", 35 | "text": "#{{pull.number}} {{{formatted_title pull.title}}}", 36 | "weight": "bolder", 37 | "size": "large", 38 | "wrap": true 39 | }, 40 | { 41 | "type": "ColumnSet", 42 | "spacing": "small", 43 | "columns": [ 44 | { 45 | "type": "Column", 46 | "width": "auto", 47 | "verticalContentAlignment": "Center", 48 | "items": [ 49 | { 50 | "size": "small", 51 | "type": "Image", 52 | "url": "{{pull.user.avatar_url}}", 53 | "height": "25px" 54 | } 55 | ] 56 | }, 57 | { 58 | "type": "Column", 59 | "width": "auto", 60 | "spacing": "small", 61 | "verticalContentAlignment": "Center", 62 | "items": [ 63 | { 64 | "type": "TextBlock", 65 | "text": "merge {{pull.commits}} {{#if_plural pull.commits}}commits{{else}}commit{{/if_plural}} into [{{pull.base.ref}}]({{repository.html_url}}/tree/{{pull.base.ref}}) from [{{pull.head.ref}}]({{repository.html_url}}/tree/{{pull.head.ref}})", 66 | "spacing": "small", 67 | "wrap": true 68 | } 69 | ] 70 | } 71 | ] 72 | }, 73 | { 74 | "type": "ColumnSet", 75 | "spacing": "small", 76 | "columns": [ 77 | { 78 | "type": "Column", 79 | "width": "auto", 80 | "items": [ 81 | { 82 | "size": "small", 83 | "type": "Image", 84 | "url": "{{baseURL}}{{get_status_image_pr 'pull_request' pull}}", 85 | "height": "25px" 86 | } 87 | ] 88 | }, 89 | { 90 | "type": "Column", 91 | "width": "auto", 92 | "verticalContentAlignment": "Center", 93 | "items": [ 94 | { 95 | "size": "small", 96 | "type": "Image", 97 | "url": "{{baseURL}}/static/img/github-mark.png", 98 | "height": "15px" 99 | } 100 | ] 101 | }, 102 | { 103 | "type": "Column", 104 | "width": "auto", 105 | "spacing": "small", 106 | "verticalContentAlignment": "Center", 107 | "items": [ 108 | { 109 | "type": "TextBlock", 110 | "text": "[{{repository.full_name}}]({{repository.html_url}})", 111 | "wrap": true 112 | } 113 | ] 114 | } 115 | ] 116 | } 117 | ] 118 | }, 119 | { 120 | "type": "Container", 121 | "separator": true, 122 | "items": [ 123 | {{#if pull.body}} 124 | { 125 | "type": "TextBlock", 126 | "text": "{{{formatted_body pull.body}}}", 127 | "wrap": true 128 | }, 129 | {{/if}} 130 | {{#list_image pull.body}} 131 | { 132 | "type": "Image", 133 | "url": "{{this}}" 134 | }, 135 | {{/list_image}} 136 | { 137 | "type": "FactSet", 138 | "separator":true, 139 | "facts": [ 140 | {{#if (is_present pull.requested_reviewers pull.requested_teams)}} 141 | { 142 | "title": "Reviewers:", 143 | "value": "{{reviewers_short_text repository pull}}" 144 | } 145 | {{/if}} 146 | {{#if pull.labels}} 147 | {{#if (is_present pull.requested_reviewers pull.requested_teams)}} 148 | , 149 | {{/if}} 150 | { 151 | "title": "Labels:", 152 | "value": "{{label_short_text pull.labels}}" 153 | } 154 | {{/if}} 155 | {{#if pull.assignees}} 156 | {{#if pull.labels}} 157 | , 158 | {{else}} 159 | {{#if (is_present pull.requested_reviewers pull.requested_teams)}} 160 | , 161 | {{/if}} 162 | {{/if}} 163 | { 164 | "title": "Assignees:", 165 | "value": "{{assignees_short_text pull}}" 166 | } 167 | {{/if}} 168 | ] 169 | } 170 | ] 171 | } 172 | ] 173 | } 174 | } 175 | -------------------------------------------------------------------------------- /CardTemplate/Teams/HandleBars/issue_opened.handlebars: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", 3 | "type": "AdaptiveCard", 4 | "version": "1.0", 5 | "body": [ 6 | { 7 | "type": "Container", 8 | "items": [ 9 | { 10 | "type": "TextBlock", 11 | "text": "**Issue opened by {{{get_github_profile_link issue.user.login}}} on {{{formatted_date issue.created_at}}}**" 12 | }, 13 | { 14 | "type": "TextBlock", 15 | "text": "[#{{issue.number}} {{{formatted_title issue.title}}}]({{issue.html_url}})", 16 | "wrap": "true", 17 | "weight": "bolder", 18 | "spacing": "small", 19 | "size": "large" 20 | }, 21 | { 22 | "type": "ColumnSet", 23 | "spacing": "small", 24 | "columns": [ 25 | { 26 | "type": "Column", 27 | "width": "auto", 28 | "items": [ 29 | { 30 | "size": "small", 31 | "type": "Image", 32 | "url": "{{baseURL}}{{get_status_image_issue 'issue' issue.state}}", 33 | "height": "25px" 34 | } 35 | ] 36 | }, 37 | { 38 | "type": "Column", 39 | "width": "auto", 40 | "verticalContentAlignment": "Center", 41 | "items": [ 42 | { 43 | "size": "small", 44 | "type": "Image", 45 | "url": "{{baseURL}}/static/img/github-mark.png", 46 | "height": "15px" 47 | } 48 | ] 49 | }, 50 | { 51 | "type": "Column", 52 | "width": "auto", 53 | "spacing": "small", 54 | "verticalContentAlignment": "Center", 55 | "items": [ 56 | { 57 | "type": "TextBlock", 58 | "text": "[{{repository.full_name}}]({{repository.html_url}})", 59 | "wrap": true 60 | } 61 | ] 62 | } 63 | ] 64 | } 65 | ] 66 | }, 67 | { 68 | "type": "Container", 69 | "separator":true, 70 | "items": [ 71 | {{#if issue.body}} 72 | { 73 | "type": "TextBlock", 74 | "text": "{{{formatted_body issue.body}}}", 75 | "wrap": true 76 | }, 77 | {{/if}} 78 | {{#list_image issue.body}} 79 | { 80 | "type": "Image", 81 | "url": "{{this}}" 82 | }, 83 | {{/list_image}} 84 | { 85 | "type": "FactSet", 86 | "separator":true, 87 | "facts": [ 88 | {{#if issue.labels}} 89 | { 90 | "title": "Labels:", 91 | "value": "{{label_short_text issue.labels}}" 92 | } 93 | {{/if}} 94 | {{#if issue.assignees }} 95 | {{#if issue.labels}} 96 | , 97 | {{/if}} 98 | { 99 | "title": "Assignees:", 100 | "value": "{{assignees_short_text issue}}" 101 | } 102 | {{/if}} 103 | ] 104 | } 105 | {{#if betaEnabled}} 106 | , 107 | { 108 | "type": "ActionSet", 109 | "actions": [ 110 | { 111 | "type": "Action.ShowCard", 112 | "title": "Comment", 113 | "style": "default", 114 | "card": { 115 | "type": "AdaptiveCard", 116 | "body": [ 117 | { 118 | "type": "Input.Text", 119 | "isMultiline": true, 120 | "placeholder": "Leave a comment here...", 121 | "id": "commentText" 122 | }, 123 | { 124 | "type": "ActionSet", 125 | "actions": [ 126 | { 127 | "type": "Action.Submit", 128 | "title": "Submit", 129 | "data": { 130 | "owner": "{{repository.owner.login}}", 131 | "repo": "{{repository.name}}", 132 | "issueNumber":"{{issue.number}}", 133 | "state": "{{issue.state}}", 134 | "actionType":"issueComment" 135 | } 136 | } 137 | ] 138 | } 139 | ] 140 | } 141 | } 142 | , 143 | { 144 | "type": "Action.ShowCard", 145 | "title": "{{state issue.state}}", 146 | "style": "default", 147 | "card": { 148 | "type": "AdaptiveCard", 149 | "body": [ 150 | { 151 | "type": "Input.Text", 152 | "isMultiline": true, 153 | "placeholder": "Leave a comment here...", 154 | "id": "issueCommentText" 155 | }, 156 | { 157 | "type": "ActionSet", 158 | "actions": [ 159 | { 160 | "type": "Action.Submit", 161 | "title": "Submit", 162 | "data": { 163 | "owner": "{{repository.owner.login}}", 164 | "repo": "{{repository.name}}", 165 | "issueNumber":"{{issue.number}}", 166 | "state": "{{issue.state}}", 167 | "actionType":"changeIssueState" 168 | } 169 | } 170 | ] 171 | } 172 | ] 173 | } 174 | } 175 | ] 176 | } 177 | {{/if}} 178 | ] 179 | } 180 | ] 181 | } 182 | -------------------------------------------------------------------------------- /CardTemplate/Teams/HandleBars/pull_request_opened.handlebars: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://adaptivecards.io/schemas/adaptive-card.json", 3 | "type": "AdaptiveCard", 4 | "version": "1.0", 5 | "body": [ 6 | { 7 | "type": "Container", 8 | "items": [ 9 | { 10 | "type": "TextBlock", 11 | "text": "**Pull request opened by {{{get_github_profile_link pull_request.user.login}}} on {{{formatted_date pull_request.created_at}}}**" 12 | }, 13 | { 14 | "type": "TextBlock", 15 | "text": "[#{{pull_request.number}} {{{formatted_title pull_request.title}}}]({{pull_request.html_url}})", 16 | "wrap": "true", 17 | "weight": "bolder", 18 | "spacing": "small", 19 | "size": "large" 20 | }, 21 | { 22 | "type": "ColumnSet", 23 | "spacing": "small", 24 | "columns": [ 25 | { 26 | "type": "Column", 27 | "width": "auto", 28 | "items": [ 29 | { 30 | "size": "small", 31 | "type": "Image", 32 | "url": "{{baseURL}}{{get_status_image_pr 'pull_request' pull_request}}", 33 | "height": "25px" 34 | } 35 | ] 36 | }, 37 | { 38 | "type": "Column", 39 | "width": "auto", 40 | "verticalContentAlignment": "Center", 41 | "items": [ 42 | { 43 | "size": "small", 44 | "type": "Image", 45 | "url": "{{baseURL}}/static/img/github-mark.png", 46 | "height": "15px" 47 | } 48 | ] 49 | }, 50 | { 51 | "type": "Column", 52 | "width": "auto", 53 | "spacing": "small", 54 | "verticalContentAlignment": "Center", 55 | "items": [ 56 | { 57 | "type": "TextBlock", 58 | "text": "[{{repository.full_name}}]({{repository.html_url}})", 59 | "wrap": true 60 | } 61 | ] 62 | } 63 | ] 64 | }, 65 | { 66 | "type": "TextBlock", 67 | "text": "merge {{pull_request.commits}} {{#if_plural pull_request.commits}}commits{{else}}commit{{/if_plural}} into [{{ 68 | pull_request.base.ref}}]({{repository.html_url}}/tree/{{pull_request.base.ref}}) from [{{pull_request.head.ref}}]({{ 69 | repository.html_url}}/tree/{{pull_request.head.ref}})", 70 | "spacing": "small", 71 | "wrap": "true" 72 | } 73 | ] 74 | }, 75 | {{#if pull_request.body}} 76 | { 77 | "type": "Container", 78 | "separator": true, 79 | "items": [ 80 | { 81 | "type": "TextBlock", 82 | "text": "{{{formatted_body pull_request.body}}}", 83 | "wrap": true 84 | } 85 | {{#list_image pull_request.body}} 86 | , 87 | { 88 | "type": "Image", 89 | "url": "{{this}}" 90 | } 91 | {{/list_image}} 92 | ] 93 | }, 94 | {{/if}} 95 | { 96 | "type": "Container", 97 | "separator": true, 98 | "items": [ 99 | { 100 | "type": "ColumnSet", 101 | "spacing": "small", 102 | "columns": [ 103 | { 104 | "type": "Column", 105 | "width": "97px", 106 | "spacing": "small", 107 | "verticalContentAlignment": "Center", 108 | "items": [ 109 | { 110 | "type": "TextBlock", 111 | "text": "**Files Changed:**", 112 | "weight": "bolder" 113 | } 114 | ] 115 | }, 116 | { 117 | "type": "Column", 118 | "spacing": "small", 119 | "verticalContentAlignment": "Center", 120 | "items": [ 121 | { 122 | "type": "TextBlock", 123 | "text": "[{{pull_request.changed_files}}]({{pull_request.html_url}}/files)" 124 | } 125 | ] 126 | } 127 | ] 128 | }, 129 | { 130 | "type": "ColumnSet", 131 | "spacing": "None", 132 | "columns": [ 133 | {{#if check_context}} 134 | { 135 | "type": "Column", 136 | "width": "97px", 137 | "spacing": "small", 138 | "verticalContentAlignment": "Center", 139 | "items": [ 140 | { 141 | "type": "TextBlock", 142 | "text": "**Checks:**", 143 | "weight": "bolder" 144 | } 145 | ] 146 | }, 147 | { 148 | "type": "Column", 149 | "width": "auto", 150 | "spacing": "small", 151 | "verticalContentAlignment": "Center", 152 | "items": [ 153 | { 154 | "size": "small", 155 | "type": "Image", 156 | "url": "{{baseURL}}{{{check_image check_context}}}", 157 | "height": "9px" 158 | } 159 | ] 160 | }, 161 | { 162 | "type": "Column", 163 | "spacing": "small", 164 | "verticalContentAlignment": "Center", 165 | "wrap": "true", 166 | "items": [ 167 | { 168 | "type": "TextBlock", 169 | "text": "[{{{check_message check_context}}}]({{pull_request.html_url}}/checks)" 170 | } 171 | ] 172 | } 173 | {{/if}} 174 | ] 175 | }, 176 | { 177 | "type": "ColumnSet", 178 | "spacing": "None", 179 | "columns": [ 180 | {{#if (is_present pull_request.requested_reviewers pull_request.requested_teams)}} 181 | { 182 | "type": "Column", 183 | "width": "97px", 184 | "spacing": "small", 185 | "verticalContentAlignment": "Center", 186 | "items": [ 187 | { 188 | "type": "TextBlock", 189 | "text": "**Reviewers:**", 190 | "weight": "bolder" 191 | } 192 | ] 193 | }, 194 | { 195 | "type": "Column", 196 | "spacing": "small", 197 | "verticalContentAlignment": "Center", 198 | "items": [ 199 | { 200 | "type": "TextBlock", 201 | "text": "{{reviewers_short_text repository pull_request}}" 202 | } 203 | ] 204 | } 205 | {{/if}} 206 | ] 207 | }, 208 | { 209 | "type": "ColumnSet", 210 | "spacing": "None", 211 | "columns": [ 212 | {{#if pull_request.labels}} 213 | { 214 | "type": "Column", 215 | "width": "97px", 216 | "spacing": "small", 217 | "verticalContentAlignment": "Center", 218 | "items": [ 219 | { 220 | "type": "TextBlock", 221 | "text": "**Labels:**", 222 | "weight": "bolder" 223 | } 224 | ] 225 | }, 226 | { 227 | "type": "Column", 228 | "spacing": "small", 229 | "verticalContentAlignment": "Center", 230 | "items": [ 231 | { 232 | "type": "TextBlock", 233 | "text": "{{label_short_text pull_request.labels}}" 234 | } 235 | ] 236 | } 237 | {{/if}} 238 | ] 239 | }, 240 | { 241 | "type": "ColumnSet", 242 | "spacing": "None", 243 | "columns": [ 244 | {{#if pull_request.assignees}} 245 | { 246 | "type": "Column", 247 | "width": "97px", 248 | "spacing": "small", 249 | "verticalContentAlignment": "Center", 250 | "items": [ 251 | { 252 | "type": "TextBlock", 253 | "text": "**Assignees:**", 254 | "weight": "bolder" 255 | } 256 | ] 257 | }, 258 | { 259 | "type": "Column", 260 | "spacing": "small", 261 | "verticalContentAlignment": "Center", 262 | "items": [ 263 | { 264 | "type": "TextBlock", 265 | "text": "{{assignees_short_text pull_request}}" 266 | } 267 | ] 268 | } 269 | {{/if}} 270 | ] 271 | } 272 | {{#if betaEnabled}} 273 | , 274 | { 275 | "type": "ActionSet", 276 | "actions": [ 277 | { 278 | "type": "Action.ShowCard", 279 | "title": "Comment", 280 | "style": "default", 281 | "card": { 282 | "type": "AdaptiveCard", 283 | "body": [ 284 | { 285 | "type": "Input.Text", 286 | "isMultiline": true, 287 | "id": "commentText", 288 | "placeholder": "Leave a comment here..." 289 | }, 290 | { 291 | "type": "ActionSet", 292 | "actions": [ 293 | { 294 | "type": "Action.Submit", 295 | "title": "Submit", 296 | "style": "default", 297 | "data": { 298 | "owner": "{{repository.owner.login}}", 299 | "repo": "{{repository.name}}", 300 | "prNumber":"{{pull_request.number}}", 301 | "actionType":"prComment" 302 | } 303 | } 304 | ] 305 | } 306 | ] 307 | } 308 | } 309 | ] 310 | } 311 | {{/if}} 312 | ] 313 | } 314 | ] 315 | } 316 | --------------------------------------------------------------------------------