Skip to content

Commit fea06c3

Browse files
authored
feat: stack visualization in PR comment (#65)
1 parent 66853b4 commit fea06c3

File tree

11 files changed

+557
-394
lines changed

11 files changed

+557
-394
lines changed

README.md

Lines changed: 56 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
</picture>
77
</p>
88

9-
# Git Town Action V1
9+
# Git Town Action v1
1010

1111
This action visualizes your stacked changes when proposing pull requests on GitHub:
1212

@@ -96,48 +96,25 @@ be able to use it again to update the visualization:
9696
[ ] Baz
9797
```
9898

99-
## Manual Configuration
99+
## Customization
100100

101-
If you are using Git Town v11 and below, or are setting up the action for a repository
102-
that doesn't have a `.git-branches.toml`, you will need to tell the action what the
103-
main branch and perennial branches are for your repository.
101+
### Visualization Location
104102

105-
### Main Branch
103+
The location of the stack visualization can be customized using the `location` input.
104+
Valid options for this input include:
106105

107-
The main branch is the default parent branch for new feature branches, and can be
108-
specified using the `main-branch` input:
106+
- `description`: This is the default option. The stack visualization will appear within the
107+
pull request description. This will require granting `pull-requests: write` permissions to the
108+
action.
109+
- `comment`: The stack visualization will appear in a separate comment. No additional permissions
110+
are required for this option.
109111

110112
```yaml
111113
- uses: git-town/action@v1
112114
with:
113-
main-branch: 'main'
115+
location: comment
114116
```
115117
116-
The action will default to your repository's default branch, which it fetches via
117-
the GitHub REST API.
118-
119-
### Perennial Branches
120-
121-
Perennial branches are long lived branches and are never shipped.
122-
123-
There are two ways to specify perennial branches: explicitly or via regex. This can
124-
be done with the `perennial-branches` and `perennial-regex` inputs respectively:
125-
126-
```yaml
127-
- uses: git-town/action@v1
128-
with:
129-
perennial-branches: |
130-
dev
131-
staging
132-
prod
133-
perennial-regex: '^release-.*$'
134-
```
135-
136-
Both inputs can be used at the same time. The action will merge the perennial
137-
branches given into a single, de-duplicated list.
138-
139-
## Customization
140-
141118
### Skip Single Stacks
142119
143120
If you don't want the stack visualization to appear on pull requests which are **not** part
@@ -160,12 +137,12 @@ and closed pull requests. However, this can increase the runtime of the action f
160137
larger/older repositories.
161138

162139
If you're experiencing long runtimes, the `history-limit` input can be configured to
163-
limit the total number of closed pull requests fetched by the action:
140+
limit the total number of pull requests fetched by the action:
164141

165142
```yaml
166143
- uses: git-town/action@v1
167144
with:
168-
history-limit: '500' # Only fetch the latest 500 closed pull requests
145+
history-limit: 500 # Only fetch the latest 500 pull requests
169146
```
170147

171148
> [!WARNING]
@@ -195,6 +172,46 @@ it into the actions's `github-token` input to grant it sufficient permissions:
195172
github-token: ${{ secrets.GIT_TOWN_PAT }} # 👈 Add this to `git-town.yml`
196173
```
197174

175+
## Manual Configuration
176+
177+
If you are using Git Town v11 and below, or are setting up the action for a repository
178+
that doesn't have a `.git-branches.toml`, you will need to tell the action what the
179+
main branch and perennial branches are for your repository.
180+
181+
### Main Branch
182+
183+
The main branch is the default parent branch for new feature branches, and can be
184+
specified using the `main-branch` input:
185+
186+
```yaml
187+
- uses: git-town/action@v1
188+
with:
189+
main-branch: main
190+
```
191+
192+
The action will default to your repository's default branch, which it fetches via
193+
the GitHub REST API.
194+
195+
### Perennial Branches
196+
197+
Perennial branches are long lived branches and are never shipped.
198+
199+
There are two ways to specify perennial branches: explicitly or via regex. This can
200+
be done with the `perennial-branches` and `perennial-regex` inputs respectively:
201+
202+
```yaml
203+
- uses: git-town/action@v1
204+
with:
205+
perennial-branches: |
206+
dev
207+
staging
208+
prod
209+
perennial-regex: '^release-.*$'
210+
```
211+
212+
Both inputs can be used at the same time. The action will merge the perennial
213+
branches given into a single, de-duplicated list.
214+
198215
## Reference
199216

200217
```yaml
@@ -211,6 +228,9 @@ inputs:
211228
perennial-regex:
212229
required: false
213230
default: ''
231+
location:
232+
required: false
233+
default: 'description'
214234
skip-single-stacks:
215235
required: false
216236
default: false
@@ -219,7 +239,6 @@ inputs:
219239
default: '0'
220240
```
221241

222-
223242
## License
224243

225244
The scripts and documentation in this project are released under the [MIT License](LICENSE).

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ inputs:
1818
perennial-regex:
1919
required: false
2020
default: ''
21+
location:
22+
required: false
23+
default: 'description'
2124
skip-single-stacks:
2225
required: false
2326
default: false

0 commit comments

Comments
 (0)