├── .github
├── ISSUE_TEMPLATE.md
└── PULL_REQUEST_TEMPLATE.md
├── .gitignore
├── .vscode
└── extensions.json
├── CHANGELOG.md
├── CONTRIBUTING.md
├── LICENSE.md
├── README.md
├── ReleaseNotesGenerator
├── NewRelease.cs
├── ReleaseNotesGenerator.csproj
└── host.json
├── azuredeploy.json
└── images
├── addgithubwebhook.png
├── deployment.png
├── exp_release.png
├── functionurl.png
├── monitorfunction.png
├── newcontainer.png
├── redeliverwebhook.png
└── renderednotes.png
/.github/ISSUE_TEMPLATE.md:
--------------------------------------------------------------------------------
1 |
4 | > Please provide us with the following information:
5 | > ---------------------------------------------------------------
6 |
7 | ### This issue is for a: (mark with an `x`)
8 | ```
9 | - [ ] bug report -> please search issues before submitting
10 | - [ ] feature request
11 | - [ ] documentation issue or request
12 | - [ ] regression (a behavior that used to work and stopped in a new release)
13 | ```
14 |
15 | ### Minimal steps to reproduce
16 | >
17 |
18 | ### Any log messages given by the failure
19 | >
20 |
21 | ### Expected/desired behavior
22 | >
23 |
24 | ### OS and Version?
25 | > Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)
26 |
27 | ### Versions
28 | >
29 |
30 | ### Mention any other details that might be useful
31 |
32 | > ---------------------------------------------------------------
33 | > Thanks! We'll be in touch soon.
34 |
--------------------------------------------------------------------------------
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | ## Purpose
2 |
3 | * ...
4 |
5 | ## Does this introduce a breaking change?
6 |
7 | ```
8 | [ ] Yes
9 | [ ] No
10 | ```
11 |
12 | ## Pull Request Type
13 | What kind of change does this Pull Request introduce?
14 |
15 |
16 | ```
17 | [ ] Bugfix
18 | [ ] Feature
19 | [ ] Code style update (formatting, local variables)
20 | [ ] Refactoring (no functional changes, no api changes)
21 | [ ] Documentation content changes
22 | [ ] Other... Please describe:
23 | ```
24 |
25 | ## How to Test
26 | * Get the code
27 |
28 | ```
29 | git clone [repo-address]
30 | cd [repo-name]
31 | git checkout [branch-name]
32 | npm install
33 | ```
34 |
35 | * Test the code
36 |
37 | ```
38 | ```
39 |
40 | ## What to Check
41 | Verify that the following are valid
42 | * ...
43 |
44 | ## Other Information
45 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # Azure Functions localsettings file
5 | local.settings.json
6 |
7 | # User-specific files
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Build results
17 | [Dd]ebug/
18 | [Dd]ebugPublic/
19 | [Rr]elease/
20 | [Rr]eleases/
21 | x64/
22 | x86/
23 | bld/
24 | [Bb]in/
25 | [Oo]bj/
26 | [Ll]og/
27 |
28 | # Visual Studio 2015 cache/options directory
29 | .vs/
30 | # Uncomment if you have tasks that create the project's static files in wwwroot
31 | #wwwroot/
32 |
33 | # MSTest test Results
34 | [Tt]est[Rr]esult*/
35 | [Bb]uild[Ll]og.*
36 |
37 | # NUNIT
38 | *.VisualState.xml
39 | TestResult.xml
40 |
41 | # Build Results of an ATL Project
42 | [Dd]ebugPS/
43 | [Rr]eleasePS/
44 | dlldata.c
45 |
46 | # DNX
47 | project.lock.json
48 | project.fragment.lock.json
49 | artifacts/
50 |
51 | *_i.c
52 | *_p.c
53 | *_i.h
54 | *.ilk
55 | *.meta
56 | *.obj
57 | *.pch
58 | *.pdb
59 | *.pgc
60 | *.pgd
61 | *.rsp
62 | *.sbr
63 | *.tlb
64 | *.tli
65 | *.tlh
66 | *.tmp
67 | *.tmp_proj
68 | *.log
69 | *.vspscc
70 | *.vssscc
71 | .builds
72 | *.pidb
73 | *.svclog
74 | *.scc
75 |
76 | # Chutzpah Test files
77 | _Chutzpah*
78 |
79 | # Visual C++ cache files
80 | ipch/
81 | *.aps
82 | *.ncb
83 | *.opendb
84 | *.opensdf
85 | *.sdf
86 | *.cachefile
87 | *.VC.db
88 | *.VC.VC.opendb
89 |
90 | # Visual Studio profiler
91 | *.psess
92 | *.vsp
93 | *.vspx
94 | *.sap
95 |
96 | # TFS 2012 Local Workspace
97 | $tf/
98 |
99 | # Guidance Automation Toolkit
100 | *.gpState
101 |
102 | # ReSharper is a .NET coding add-in
103 | _ReSharper*/
104 | *.[Rr]e[Ss]harper
105 | *.DotSettings.user
106 |
107 | # JustCode is a .NET coding add-in
108 | .JustCode
109 |
110 | # TeamCity is a build add-in
111 | _TeamCity*
112 |
113 | # DotCover is a Code Coverage Tool
114 | *.dotCover
115 |
116 | # NCrunch
117 | _NCrunch_*
118 | .*crunch*.local.xml
119 | nCrunchTemp_*
120 |
121 | # MightyMoose
122 | *.mm.*
123 | AutoTest.Net/
124 |
125 | # Web workbench (sass)
126 | .sass-cache/
127 |
128 | # Installshield output folder
129 | [Ee]xpress/
130 |
131 | # DocProject is a documentation generator add-in
132 | DocProject/buildhelp/
133 | DocProject/Help/*.HxT
134 | DocProject/Help/*.HxC
135 | DocProject/Help/*.hhc
136 | DocProject/Help/*.hhk
137 | DocProject/Help/*.hhp
138 | DocProject/Help/Html2
139 | DocProject/Help/html
140 |
141 | # Click-Once directory
142 | publish/
143 |
144 | # Publish Web Output
145 | *.[Pp]ublish.xml
146 | *.azurePubxml
147 | # TODO: Comment the next line if you want to checkin your web deploy settings
148 | # but database connection strings (with potential passwords) will be unencrypted
149 | #*.pubxml
150 | *.publishproj
151 |
152 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
153 | # checkin your Azure Web App publish settings, but sensitive information contained
154 | # in these scripts will be unencrypted
155 | PublishScripts/
156 |
157 | # NuGet Packages
158 | *.nupkg
159 | # The packages folder can be ignored because of Package Restore
160 | **/packages/*
161 | # except build/, which is used as an MSBuild target.
162 | !**/packages/build/
163 | # Uncomment if necessary however generally it will be regenerated when needed
164 | #!**/packages/repositories.config
165 | # NuGet v3's project.json files produces more ignoreable files
166 | *.nuget.props
167 | *.nuget.targets
168 |
169 | # Microsoft Azure Build Output
170 | csx/
171 | *.build.csdef
172 |
173 | # Microsoft Azure Emulator
174 | ecf/
175 | rcf/
176 |
177 | # Windows Store app package directories and files
178 | AppPackages/
179 | BundleArtifacts/
180 | Package.StoreAssociation.xml
181 | _pkginfo.txt
182 |
183 | # Visual Studio cache files
184 | # files ending in .cache can be ignored
185 | *.[Cc]ache
186 | # but keep track of directories ending in .cache
187 | !*.[Cc]ache/
188 |
189 | # Others
190 | ClientBin/
191 | ~$*
192 | *~
193 | *.dbmdl
194 | *.dbproj.schemaview
195 | *.jfm
196 | *.pfx
197 | *.publishsettings
198 | node_modules/
199 | orleans.codegen.cs
200 |
201 | # Since there are multiple workflows, uncomment next line to ignore bower_components
202 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
203 | #bower_components/
204 |
205 | # RIA/Silverlight projects
206 | Generated_Code/
207 |
208 | # Backup & report files from converting an old project file
209 | # to a newer Visual Studio version. Backup files are not needed,
210 | # because we have git ;-)
211 | _UpgradeReport_Files/
212 | Backup*/
213 | UpgradeLog*.XML
214 | UpgradeLog*.htm
215 |
216 | # SQL Server files
217 | *.mdf
218 | *.ldf
219 |
220 | # Business Intelligence projects
221 | *.rdl.data
222 | *.bim.layout
223 | *.bim_*.settings
224 |
225 | # Microsoft Fakes
226 | FakesAssemblies/
227 |
228 | # GhostDoc plugin setting file
229 | *.GhostDoc.xml
230 |
231 | # Node.js Tools for Visual Studio
232 | .ntvs_analysis.dat
233 |
234 | # Visual Studio 6 build log
235 | *.plg
236 |
237 | # Visual Studio 6 workspace options file
238 | *.opt
239 |
240 | # Visual Studio LightSwitch build output
241 | **/*.HTMLClient/GeneratedArtifacts
242 | **/*.DesktopClient/GeneratedArtifacts
243 | **/*.DesktopClient/ModelManifest.xml
244 | **/*.Server/GeneratedArtifacts
245 | **/*.Server/ModelManifest.xml
246 | _Pvt_Extensions
247 |
248 | # Paket dependency manager
249 | .paket/paket.exe
250 | paket-files/
251 |
252 | # FAKE - F# Make
253 | .fake/
254 |
255 | # JetBrains Rider
256 | .idea/
257 | *.sln.iml
258 |
259 | # CodeRush
260 | .cr/
261 |
262 | # Python Tools for Visual Studio (PTVS)
263 | __pycache__/
264 | *.pyc
--------------------------------------------------------------------------------
/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "recommendations": [
3 | "ms-azuretools.vscode-azurefunctions"
4 | ]
5 | }
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## [project-title] Changelog
2 |
3 |
4 | # x.y.z (yyyy-mm-dd)
5 |
6 | *Features*
7 | * ...
8 |
9 | *Bug Fixes*
10 | * ...
11 |
12 | *Breaking Changes*
13 | * ...
14 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing to [project-title]
2 |
3 | This project welcomes contributions and suggestions. Most contributions require you to agree to a
4 | Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
5 | the rights to use your contribution. For details, visit https://cla.microsoft.com.
6 |
7 | When you submit a pull request, a CLA-bot will automatically determine whether you need to provide
8 | a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions
9 | provided by the bot. You will only need to do this once across all repos using our CLA.
10 |
11 | This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
12 | For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
13 | contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
14 |
15 | - [Code of Conduct](#coc)
16 | - [Issues and Bugs](#issue)
17 | - [Feature Requests](#feature)
18 | - [Submission Guidelines](#submit)
19 |
20 | ## Code of Conduct
21 | Help us keep this project open and inclusive. Please read and follow our [Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
22 |
23 | ## Found an Issue?
24 | If you find a bug in the source code or a mistake in the documentation, you can help us by
25 | [submitting an issue](#submit-issue) to the GitHub Repository. Even better, you can
26 | [submit a Pull Request](#submit-pr) with a fix.
27 |
28 | ## Want a Feature?
29 | You can *request* a new feature by [submitting an issue](#submit-issue) to the GitHub
30 | Repository. If you would like to *implement* a new feature, please submit an issue with
31 | a proposal for your work first, to be sure that we can use it.
32 |
33 | * **Small Features** can be crafted and directly [submitted as a Pull Request](#submit-pr).
34 |
35 | ## Submission Guidelines
36 |
37 | ### Submitting an Issue
38 | Before you submit an issue, search the archive, maybe your question was already answered.
39 |
40 | If your issue appears to be a bug, and hasn't been reported, open a new issue.
41 | Help us to maximize the effort we can spend fixing issues and adding new
42 | features, by not reporting duplicate issues. Providing the following information will increase the
43 | chances of your issue being dealt with quickly:
44 |
45 | * **Overview of the Issue** - if an error is being thrown a non-minified stack trace helps
46 | * **Version** - what version is affected (e.g. 0.1.2)
47 | * **Motivation for or Use Case** - explain what are you trying to do and why the current behavior is a bug for you
48 | * **Browsers and Operating System** - is this a problem with all browsers?
49 | * **Reproduce the Error** - provide a live example or a unambiguous set of steps
50 | * **Related Issues** - has a similar issue been reported before?
51 | * **Suggest a Fix** - if you can't fix the bug yourself, perhaps you can point to what might be
52 | causing the problem (line of code or commit)
53 |
54 | You can file new issues by providing the above information at the corresponding repository's issues link: https://github.com/[organization-name]/[repository-name]/issues/new].
55 |
56 | ### Submitting a Pull Request (PR)
57 | Before you submit your Pull Request (PR) consider the following guidelines:
58 |
59 | * Search the repository (https://github.com/[organization-name]/[repository-name]/pulls) for an open or closed PR
60 | that relates to your submission. You don't want to duplicate effort.
61 |
62 | * Make your changes in a new git fork:
63 |
64 | * Commit your changes using a descriptive commit message
65 | * Push your fork to GitHub:
66 | * In GitHub, create a pull request
67 | * If we suggest changes then:
68 | * Make the required updates.
69 | * Rebase your fork and force push to your GitHub repository (this will update your Pull Request):
70 |
71 | ```shell
72 | git rebase master -i
73 | git push -f
74 | ```
75 |
76 | That's it! Thank you for your contribution!
77 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) Microsoft Corporation. All rights reserved.
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
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ---
2 | services: functions, storage
3 | platforms: dotnet
4 | author: paladique
5 | ---
6 |
7 | # GitHub Release Notes Generator
8 | A serverless tool for generating a release notes document for projects hosted on GitHub.
9 |
10 | [](https://azuredeploy.net/?repository=https://github.com/Azure-Samples/functions-dotnet-github-release-notes)
11 |
12 | ## Features
13 |
14 | 
15 | _Example release on GitHub_
16 |
17 | 
18 | _Rendered markdown file of example release notes_
19 |
20 | The generator is a [function app](https://docs.microsoft.com/en-us/azure/azure-functions/functions-overview?WT.mc_id=demo-functions-jasmineg) containing a [GitHub webhook](https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-github-webhook-triggered-function?WT.mc_id=demo-functions-jasmineg) function that creates a Markdown file whenever a new release is created, using [Azure Blob Storage](https://azure.microsoft.com/en-us/services/storage/blobs?WT.mc_id=demo-functions-jasmineg).
21 |
22 | ## Prerequisites
23 |
24 | - [Azure](https://azure.microsoft.com/en-us/free?WT.mc_id=demo-functions-jasmineg) account.
25 | - [GitHub](https://github.com/join) account with an active repository.
26 |
27 | ### Portal Quickstart
28 |
29 | The following tutorial shows how to set up the function app from a forked version of the repository in the Azure Portal:
30 |
31 | #### Create a Blob Container
32 |
33 | 
34 |
35 | 1. Follow the first two sections of the following walkthrough on how to [create a container](https://docs.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-portal?WT.mc_id=demo-functions-jasmineg). Name the container `releases`
36 | 2. In the storage account menu, navigate to **Access keys** and copy the connection string for this field. Save for later.
37 |
38 | #### Deploy from a Forked GitHub Repository
39 | 1. Create a new function app. See section on how to [create a function app](https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-azure-function#create-a-function-app?WT.mc_id=demo-functions-jasmineg) to get started.
40 |
41 |
42 | 
43 |
44 | 2. In the **Platform features** tab, select **Deployment Options** and select **Setup** to set the deployment source.
45 | 3. Choose GitHub in the **Choose Source** menu. After following the authentication instructions, point the deployment source to the forked repository.
46 | 4. After it's been created, go to the new function app's Overview menu, click and open **Application settings**, scroll to and click **+ Add new setting**. Name the setting `StorageAccountConnectionString` and paste the copied connection string into the value field. Click **Save**
47 | 5. In the same function app, go to **Function app settings** and change the runtime version to 2 if not already set.
48 | 6. The the same function app settings, copy the default host key buy selecting the copy action and save for later.
49 | 
50 | 7. In the `New Release` function, copy the url by clicking **> Get function URL** and save for later. Repeat for **> Get GitHub secret**.
51 |
52 | #### Configure GitHub Webhook
53 | 1. In GitHub, select the repository to use with webhook. Navgiate to the repository's settings.
54 | 
55 | 2. In the menu on the left of the repository settings, select webhooks and click **add a webhook** button.
56 | 3. Follow the table to configure your settings:
57 |
58 | | Setting | Suggested value | Description |
59 | |---|---|---|
60 | | **Payload URL** | Copied values | Use the value returned by **> Get function URL** and the default host key so that it reads `https://functionappname.azurewebsites.net/api/NewRelease?code=[host key]` |
61 | | **Content type** | application/json | The function expects a JSON payload. |
62 | | **Secret** | Copied value | Use the value returned by **> Get GitHub secret**. |
63 | | **Event triggers** | Let me select individual events | We only want to trigger on release events. |
64 |
65 | 1. Click **add webhook**.
66 | 2. Go to your GitHub user settings, then to **Developer Settings** > [Personal Access Tokens](https://github.com/settings/tokens) > **Generate New Token**. Give this token a name and copy the token. [Instructions on creating a Personal Access Token on GitHub](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/).
67 | 3. Go back to the portal and to the function app **Application settings**, scroll to and click **+Add new setting**. Name the setting `ReleaseNotesAppToken` and paste the copied token into the value field.
68 |
69 | ### Using "Deploy to Azure"
70 | Click the "Deploy to Azure" button above to replicate the services used in this sample on your Azure subscription. This requires an additonal step of filling out the relevant configuration settings.
71 |
72 | **Storage Account Connection String** You'll need a storage account with a blob container called `releases`. Follow the first two sections of the following walkthrough on how to [create a container](https://docs.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-portal?WT.mc_id=demo-functions-jasmineg). In the storage account menu, navigate to **Access keys** and copy the connection string for this field.
73 |
74 | **GitHub App Token** From your GitHub user settings, go to **Developer Settings** > [Personal Access Tokens](https://github.com/settings/tokens) > **Generate New Token**. Give this token a description then copy and paste the generated token into this field. [Instructions on creating a Personal Access Token on GitHub](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/).
75 |
76 | ### Test the application
77 |
78 | Create a new release in the repository. Fill out the required fields and click **Publish release**. The generated blob will be a markdown file named as the release title.
79 |
80 | 
81 |
82 | _Monitor and review the functions' execution history in the **Monitor** context menu of the function._
83 |
84 | 
85 |
86 | _To run the function again without creating another release, go to the configured webhook in GitHub to redeliver it._
87 |
88 | ## Resources
89 | - [Introduction to Azure Functions](https://docs.microsoft.com/en-us/azure/azure-functions/functions-overview?WT.mc_id=demo-functions-jasmineg)
90 | - [Azure Functions triggers and bindings concepts](https://docs.microsoft.com/en-us/azure/azure-functions/functions-triggers-bindings?WT.mc_id=demo-functions-jasmineg)
91 | - [Azure Functions C# script (.csx) developer reference](https://docs.microsoft.com/en-us/azure/azure-functions/functions-reference-csharp?WT.mc_id=demo-functions-jasmineg)
92 | - [Octokit.NET](https://octokit.github.io/)
93 |
--------------------------------------------------------------------------------
/ReleaseNotesGenerator/NewRelease.cs:
--------------------------------------------------------------------------------
1 | using Azure.Storage.Blobs;
2 | using Microsoft.AspNetCore.Http;
3 | using Microsoft.Azure.WebJobs;
4 | using Microsoft.Azure.WebJobs.Extensions.Http;
5 | using Microsoft.Azure.WebJobs.Host;
6 | using Newtonsoft.Json;
7 | using Octokit;
8 | using System;
9 | using System.IO;
10 | using System.Threading.Tasks;
11 |
12 | namespace ReleaseNotesGenerator
13 | {
14 | public static class NewRelease
15 | {
16 | [FunctionName("NewRelease")]
17 | public static async Task Run([HttpTrigger(AuthorizationLevel.Anonymous, Route = null, WebHookType="github")]HttpRequest req, TraceWriter log)
18 | {
19 | // Get request body
20 | string requestBody = new StreamReader(req.Body).ReadToEnd();
21 | dynamic data = JsonConvert.DeserializeObject(requestBody);
22 |
23 | // Extract github release from request body
24 | string releaseBody = data?.release?.body;
25 | string releaseName = data?.release?.name;
26 | string repositoryName = data?.repository?.full_name;
27 |
28 | BlobServiceClient blobServiceClient = new BlobServiceClient(Environment.GetEnvironmentVariable("StorageAccountConnectionString"));
29 | var container = blobServiceClient.GetBlobContainerClient("releases");
30 | var blob = container.GetBlobClient(releaseName + ".md" );
31 |
32 | string txtIssues = await GetReleaseDetails(IssueTypeQualifier.Issue, repositoryName);
33 | string txtPulls = await GetReleaseDetails(IssueTypeQualifier.PullRequest, repositoryName);
34 |
35 | var text = String.Format("# {0} \n {1} \n\n" + "# Issues Closed:" + txtIssues + "\n\n# Changes Merged:" + txtPulls, releaseName, releaseBody);
36 |
37 | await blob.UploadAsync(BinaryData.FromString(text), overwrite: true);
38 | }
39 |
40 | public static async Task GetReleaseDetails(IssueTypeQualifier type, string repoName)
41 | {
42 | //Connect to client with OAuth App
43 | var github = new GitHubClient(new ProductHeaderValue("ReleaseNotesApp")){Credentials = new Credentials(Environment.GetEnvironmentVariable("ReleaseNotesAppToken")) };
44 |
45 | var twoWeeks = DateTime.Now.Subtract(TimeSpan.FromDays(14));
46 | var range = new DateRange(twoWeeks, SearchQualifierOperator.GreaterThanOrEqualTo);
47 | var request = new SearchIssuesRequest();
48 |
49 | request.Repos.Add(repoName);
50 | request.Type = type;
51 |
52 | //Find Issues or PRs closed or merged within the past 14 days in specified Repo
53 | if (type == IssueTypeQualifier.Issue)
54 | {
55 | request.Closed = range;
56 | }
57 | else
58 | {
59 | request.Merged = range;
60 | }
61 |
62 | var issues = await github.Search.SearchIssues(request);
63 |
64 | //Iterate and format text
65 | string searchResults = string.Empty;
66 | foreach(Issue x in issues.Items)
67 | {
68 | searchResults += String.Format("\n - [{0}]({1})", x.Title, x.HtmlUrl);
69 | }
70 |
71 | return searchResults;
72 | }
73 | }
74 | }
--------------------------------------------------------------------------------
/ReleaseNotesGenerator/ReleaseNotesGenerator.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | netstandard2.0
4 | V2
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | PreserveNewest
14 |
15 |
16 | PreserveNewest
17 | Never
18 |
19 |
20 |
--------------------------------------------------------------------------------
/ReleaseNotesGenerator/host.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "2.0"
3 | }
--------------------------------------------------------------------------------
/azuredeploy.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema":"http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
3 | "contentVersion":"1.0.0.0",
4 | "parameters":{
5 | "siteName":{
6 | "type":"string"
7 | },
8 | "storageAccountConnectionString":{
9 | "type":"string"
10 | },
11 | "gitHubAppToken":{
12 | "type":"string"
13 | },
14 | "siteLocation":{
15 | "type":"string",
16 | "defaultValue": "[resourceGroup().location]"
17 | },
18 | "repoUrl": {
19 | "type": "string"
20 | },
21 | "branch": {
22 | "type": "string",
23 | "defaultValue": "master"
24 | }
25 | },
26 | "variables": {
27 | "siteStorageAccountName": "[toLower(parameters('siteName'))]",
28 | "storageAccountid": "[concat(resourceGroup().id,'/providers/','Microsoft.Storage/storageAccounts/', variables('siteStorageAccountName'))]"
29 | },
30 | "resources":[
31 | {
32 | "type": "Microsoft.Storage/storageAccounts",
33 | "name": "[variables('siteStorageAccountName')]",
34 | "apiVersion": "2015-05-01-preview",
35 | "location": "[parameters('siteLocation')]",
36 | "properties": {
37 | "accountType": "Standard_LRS"
38 | }
39 | },
40 | {
41 | "apiVersion":"2016-03-01",
42 | "name":"[parameters('siteName')]",
43 | "type":"Microsoft.Web/sites",
44 | "kind": "functionapp",
45 | "location":"[parameters('siteLocation')]",
46 | "dependsOn": [
47 | "[resourceId('Microsoft.Storage/storageAccounts', variables('siteStorageAccountName'))]"
48 | ],
49 | "properties": {
50 | "siteConfig": {
51 | "appSettings": [
52 | {
53 | "name": "AzureWebJobsDashboard",
54 | "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('siteStorageAccountName'), ';AccountKey=', listKeys(variables('storageAccountid'),'2015-05-01-preview').key1)]"
55 | },
56 | {
57 | "name": "AzureWebJobsStorage",
58 | "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('siteStorageAccountName'), ';AccountKey=', listKeys(variables('storageAccountid'),'2015-05-01-preview').key1)]"
59 | },
60 | {
61 | "name": "WEBSITE_CONTENTAZUREFILECONNECTIONSTRING",
62 | "value": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('siteStorageAccountName'), ';AccountKey=', listKeys(variables('storageAccountid'),'2015-05-01-preview').key1)]"
63 | },
64 | {
65 | "name": "WEBSITE_CONTENTSHARE",
66 | "value": "[toLower(parameters('siteName'))]"
67 | },
68 | {
69 | "name": "FUNCTIONS_EXTENSION_VERSION",
70 | "value": "~2"
71 | },
72 | {
73 | "name": "StorageAccountConnectionString",
74 | "value": "[toLower(parameters('storageAccountConnectionString'))]"
75 | },
76 | {
77 | "name": "ReleaseNotesAppToken",
78 | "value": "[toLower(parameters('gitHubAppToken'))]"
79 | }
80 | ]
81 | }
82 | },
83 | "resources": [
84 | {
85 | "apiVersion": "2016-03-01",
86 | "name": "web",
87 | "type": "sourcecontrols",
88 | "dependsOn": [
89 | "[resourceId('Microsoft.Web/Sites', parameters('siteName'))]"
90 | ],
91 | "properties": {
92 | "RepoUrl": "[parameters('repoUrl')]",
93 | "branch": "[parameters('branch')]",
94 | "IsManualIntegration": true
95 | }
96 | }
97 | ]
98 | }
99 | ]
100 | }
101 |
--------------------------------------------------------------------------------
/images/addgithubwebhook.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Azure-Samples/functions-dotnet-github-release-notes/c87c0b32f78229f21340dbb77a5cc93e870b4f23/images/addgithubwebhook.png
--------------------------------------------------------------------------------
/images/deployment.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Azure-Samples/functions-dotnet-github-release-notes/c87c0b32f78229f21340dbb77a5cc93e870b4f23/images/deployment.png
--------------------------------------------------------------------------------
/images/exp_release.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Azure-Samples/functions-dotnet-github-release-notes/c87c0b32f78229f21340dbb77a5cc93e870b4f23/images/exp_release.png
--------------------------------------------------------------------------------
/images/functionurl.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Azure-Samples/functions-dotnet-github-release-notes/c87c0b32f78229f21340dbb77a5cc93e870b4f23/images/functionurl.png
--------------------------------------------------------------------------------
/images/monitorfunction.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Azure-Samples/functions-dotnet-github-release-notes/c87c0b32f78229f21340dbb77a5cc93e870b4f23/images/monitorfunction.png
--------------------------------------------------------------------------------
/images/newcontainer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Azure-Samples/functions-dotnet-github-release-notes/c87c0b32f78229f21340dbb77a5cc93e870b4f23/images/newcontainer.png
--------------------------------------------------------------------------------
/images/redeliverwebhook.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Azure-Samples/functions-dotnet-github-release-notes/c87c0b32f78229f21340dbb77a5cc93e870b4f23/images/redeliverwebhook.png
--------------------------------------------------------------------------------
/images/renderednotes.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Azure-Samples/functions-dotnet-github-release-notes/c87c0b32f78229f21340dbb77a5cc93e870b4f23/images/renderednotes.png
--------------------------------------------------------------------------------