-
-
Notifications
You must be signed in to change notification settings - Fork 67
/
Copy pathadd-or-update-pr-issue-templates.sh
executable file
·156 lines (123 loc) · 5.17 KB
/
add-or-update-pr-issue-templates.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
#!/usr/bin/env bash
# This script will ensure a repo has the necessary pull request and issue templates as
# part of our contributing guide: https://doc.gruntwork.io/guides/contributing/
#
# It creates or replaces the following files:
# .github/ISSUE_TEMPLATE/bug_report.md
# .github/ISSUE_TEMPLATE/feature_request.md
# .github/pull_request_template.md
function create_bug_issue_template {
cat << "EOF" > .github/ISSUE_TEMPLATE/bug_report.md
---
name: Bug report
about: Create a bug report to help us improve.
title: ''
labels: bug
assignees: ''
---
<!--
Have any questions? Check out the contributing docs at https://gruntwork.notion.site/Gruntwork-Coding-Methodology-02fdcd6e4b004e818553684760bf691e,
or ask in this issue and a Gruntwork core maintainer will be happy to help :)
-->
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior including the relevant Terraform/Terragrunt/Packer version number and any code snippets and module inputs you used.
```hcl
// paste code snippets here
```
**Expected behavior**
A clear and concise description of what you expected to happen.
**Nice to have**
- [ ] Terminal output
- [ ] Screenshots
**Additional context**
Add any other context about the problem here.
EOF
}
function create_feature_issue_template {
cat << "EOF" > .github/ISSUE_TEMPLATE/feature_request.md
---
name: Feature request
about: Submit a feature request for this repo.
title: ''
labels: enhancement
assignees: ''
---
<!--
Have any questions? Check out the contributing docs at https://gruntwork.notion.site/Gruntwork-Coding-Methodology-02fdcd6e4b004e818553684760bf691e,
or ask in this issue and a Gruntwork core maintainer will be happy to help :)
-->
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
EOF
}
function create_pr_template {
cat << "EOF" > .github/pull_request_template.md
<!--
Have any questions? Check out the contributing docs at https://gruntwork.notion.site/Gruntwork-Coding-Methodology-02fdcd6e4b004e818553684760bf691e,
or ask in this Pull Request and a Gruntwork core maintainer will be happy to help :)
Note: Remember to add '[WIP]' to the beginning of the title if this PR is still a work-in-progress. Remove it when it is ready for review!
-->
## Description
<!-- Write a brief description of the changes introduced by this PR -->
### Documentation
<!--
If this is a feature PR, then where is it documented?
- If docs exist:
- Update any references, if relevant.
- If no docs exist:
- Create a stub for documentation including bullet points for how to use the feature, code snippets (including from happy path tests), etc.
-->
<!-- Important: Did you make any backward incompatible changes? If yes, then you must write a migration guide! -->
## TODOs
Please ensure all of these TODOs are completed before asking for a review.
- [ ] Ensure the branch is named correctly with the issue number. e.g: `feature/new-vpc-endpoints-955` or `bug/missing-count-param-434`.
- [ ] Update the docs.
- [ ] Keep the changes backward compatible where possible.
- [ ] Run the pre-commit checks successfully.
- [ ] Run the relevant tests successfully.
- [ ] Ensure any 3rd party code adheres with our [license policy](https://www.notion.so/gruntwork/Gruntwork-licenses-and-open-source-usage-policy-f7dece1f780341c7b69c1763f22b1378) or delete this line if its not applicable.
## Related Issues
<!--
Link to related issues, and issues fixed or partially addressed by this PR.
e.g. Fixes #1234
e.g. Addresses #1234
e.g. Related to #1234
-->
EOF
}
# Ensure the GitHub template directories exist
mkdir -p .github
mkdir -p .github/ISSUE_TEMPLATE
# if the repo does not contain a bug_report.md file, then create one or replace the existing one
if [[ ! -f ".github/ISSUE_TEMPLATE/bug_report.md" ]]; then
echo "Could not find file at .github/ISSUE_TEMPLATE/bug_report.md, so adding one..."
create_bug_issue_template
else
echo "Found file at .github/ISSUE_TEMPLATE/bug_report.md, so replacing it..."
rm .github/ISSUE_TEMPLATE/bug_report.md
create_bug_issue_template
fi
# if the repo does not contain a feature_request.md file, then create one or replace the existing one
if [[ ! -f ".github/ISSUE_TEMPLATE/feature_request.md" ]]; then
echo "Could not find file at .github/ISSUE_TEMPLATE/feature_request.md, so adding one..."
create_feature_issue_template
else
echo "Found file at .github/ISSUE_TEMPLATE/feature_request.md, so replacing it..."
rm .github/ISSUE_TEMPLATE/feature_request.md
create_feature_issue_template
fi
# if the repo does not contain a pull_request_template.md file, then create one or replace the existing one
if [[ ! -f ".github/pull_request_template.md" ]]; then
echo "Could not find file at .github/pull_request_template.md, so adding one..."
create_pr_template
else
echo "Found file at .github/pull_request_template.md, so replacing it..."
rm .github/pull_request_template.md
create_pr_template
fi