| 
									
										
										
										
											2024-01-08 16:44:54 -08:00
										 |  |  | #!/bin/bash
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # use to assemble the details for our release notes and write them to a file | 
					
						
							|  |  |  | # | 
					
						
							| 
									
										
										
										
											2024-01-09 15:10:12 -08:00
										 |  |  | # Usage: create-releasenotes.sh merge_sha | 
					
						
							| 
									
										
										
										
											2024-01-08 16:44:54 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-09 15:10:12 -08:00
										 |  |  | json=$(gh pr list -s merged -S "$1" --json title,number,url) | 
					
						
							| 
									
										
										
										
											2024-01-08 16:44:54 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-10 09:11:51 +13:00
										 |  |  | cp gh_release_notes_top.md gh_release_notes.md | 
					
						
							| 
									
										
										
										
											2024-01-10 19:13:48 -08:00
										 |  |  | if [[ $json != "[]" ]]; then | 
					
						
							| 
									
										
										
										
											2024-02-01 10:14:20 +13:00
										 |  |  | 	echo -n $json | jq -j '.[0]|{title}|join(" ")' > release_content_title.txt | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	( | 
					
						
							|  |  |  | 		echo -n 'This build was created by [merging pull request ' | 
					
						
							|  |  |  | 		echo -n $json | jq -j '.[0]|{number}|join(" ")' | 
					
						
							|  |  |  | 		echo -n ' (' | 
					
						
							|  |  |  | 		cat release_content_title.txt | 
					
						
							|  |  |  | 		echo -n ')](' | 
					
						
							|  |  |  | 		echo -n $json | jq -j '.[0]|{url}|join(" ")' | 
					
						
							|  |  |  | 		echo ' )' | 
					
						
							|  |  |  | 	) >> gh_release_notes.md | 
					
						
							| 
									
										
										
										
											2024-01-10 19:13:48 -08:00
										 |  |  | else | 
					
						
							| 
									
										
										
										
											2024-02-01 10:14:20 +13:00
										 |  |  | 	git log --pretty=format:"%an: '%s'" -n1 > release_content_title.txt | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	( | 
					
						
							|  |  |  | 		echo "This build was created by directly pushing to the Subsurface repo." | 
					
						
							|  |  |  | 		echo "The latest commit was [$(cat release_content_title.txt)](https://github.com/subsurface/subsurface/commit/$1 )" | 
					
						
							|  |  |  | 	) >> gh_release_notes.md | 
					
						
							| 
									
										
										
										
											2024-01-10 19:13:48 -08:00
										 |  |  | fi | 
					
						
							| 
									
										
										
										
											2024-01-10 09:11:51 +13:00
										 |  |  | cat gh_release_notes_bottom.md >> gh_release_notes.md |