Skip to content

Commit 8cb8a43

Browse files
committed
simplify positive test case; update readme and run 'make readme'.
1 parent 7282a78 commit 8cb8a43

File tree

6 files changed

+188
-52
lines changed

6 files changed

+188
-52
lines changed

.github/workflows/test-negative.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ jobs:
5959
uses: peter-evans/find-comment@v3
6060
id: fc
6161
with:
62+
continue-on-error: true
6263
issue-number: ${{ fromJSON(steps.action.outputs.result).comments[0].pull_request }}
6364
body-includes: ${{ needs.create-release.outputs.tag }}
6465

.github/workflows/test-positive.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,6 @@ jobs:
6262
issue-number: ${{ fromJSON(steps.action.outputs.result).comments[0].pull_request }}
6363
body-includes: ${{ needs.create-release.outputs.tag }}
6464

65-
- name: Succeed if comment was found
66-
if: ${{ always() && steps.fc.outputs.comment-id != 0 }}
67-
run: |
68-
exit 0
69-
70-
- name: Fail if comment was not found
71-
if: ${{ always() && steps.fc.outputs.comment-id == 0 }}
72-
run: |
73-
exit 1
74-
7565
teardown:
7666
runs-on: ubuntu-latest
7767
needs: [create-release, assert]

README.md

Lines changed: 148 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
2525
-->
2626

27-
Comments on a (merged) PR when it is included in a GitHub release.
27+
Comments on a PR when it is included in a GitHub release.
2828

2929

3030
---
@@ -42,21 +42,9 @@ Comments on a (merged) PR when it is included in a GitHub release.
4242

4343
## Introduction
4444

45-
This composite action comments on a (merged) Pull Request when it is included in a GitHub release.
46-
47-
48-
49-
## Usage
50-
51-
52-
53-
> [!IMPORTANT]
54-
> In Cloud Posse's examples, we avoid pinning GitHub Actions to specific versions to prevent discrepancies between the documentation
55-
> and the latest released versions. However, for your own projects, we strongly advise pinning each GitHub Action to the exact version
56-
> you're using. This practice ensures the stability of your workflows. Additionally, we recommend implementing a systematic
57-
> approach for updating versions to avoid unexpected changes.
58-
45+
This action comments on a PR when it has commits associated with a release.
5946

47+
This action should typically be called in a worklow with the `on.release` trigger:
6048

6149
```yaml
6250
name: PR Comment on Release
@@ -79,11 +67,155 @@ This composite action comments on a (merged) Pull Request when it is included in
7967
uses: cloudposse-github-actions/pr-comment-on-release
8068
id: pr-comment-on-release
8169
with:
82-
retries: 5 # Override number of retries
70+
# Optional: only comment on PRs when the release matches a certain regex (default: ".*")
71+
include_regex: "^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$"
8372
```
8473
74+
This action returns a JSON-encoded string, which contains information on the comments it created (if any):
75+
76+
```jsonc
77+
{
78+
"comments": [
79+
"pull_request": 1, // the PR #
80+
"comment_id": 12345 // the comment ID
81+
]
82+
}
83+
```
84+
85+
86+
87+
88+
89+
90+
91+
92+
93+
94+
## Related Projects
95+
96+
Check out these related projects.
97+
98+
99+
100+
## References
101+
102+
For additional context, refer to some of these links.
103+
104+
- [cloudposse-github-actions](https://github.com/cloudposse-github-actions) - Reusable workflows for different types of projects
105+
- [pr-comment-on-release](https://github.com/cloudposse-github-actions/pr-comment-on-release) - Example application with complicated release workflow
106+
107+
108+
## ✨ Contributing
109+
110+
This project is under active development, and we encourage contributions from our community.
111+
Many thanks to our outstanding contributors:
112+
113+
<a href="https://github.com/cloudposse-github-actions/pr-comment-on-release/graphs/contributors">
114+
<img src="https://contrib.rocks/image?repo=cloudposse-github-actions/pr-comment-on-release&max=24" />
115+
</a>
85116

117+
### 🐛 Bug Reports & Feature Requests
86118

119+
Please use the [issue tracker](https://github.com/cloudposse-github-actions/pr-comment-on-release/issues) to report any bugs or file feature requests.
120+
121+
### 💻 Developing
122+
123+
If you are interested in being a contributor and want to get involved in developing this project or help out with Cloud Posse's other projects, we would love to hear from you!
124+
Hit us up in [Slack](https://cpco.io/slack?utm_source=github&utm_medium=readme&utm_campaign=cloudposse-github-actions/pr-comment-on-release&utm_content=slack), in the `#cloudposse` channel.
125+
126+
In general, PRs are welcome. We follow the typical "fork-and-pull" Git workflow.
127+
1. Review our [Code of Conduct](https://github.com/cloudposse-github-actions/pr-comment-on-release/?tab=coc-ov-file#code-of-conduct) and [Contributor Guidelines](https://github.com/cloudposse/.github/blob/main/CONTRIBUTING.md).
128+
2. **Fork** the repo on GitHub
129+
3. **Clone** the project to your own machine
130+
4. **Commit** changes to your own branch
131+
5. **Push** your work back up to your fork
132+
6. Submit a **Pull Request** so that we can review your changes
133+
134+
**NOTE:** Be sure to merge the latest changes from "upstream" before making a pull request!
135+
136+
### 🌎 Slack Community
137+
138+
Join our [Open Source Community](https://cpco.io/slack?utm_source=github&utm_medium=readme&utm_campaign=cloudposse-github-actions/pr-comment-on-release&utm_content=slack) on Slack. It's **FREE** for everyone! Our "SweetOps" community is where you get to talk with others who share a similar vision for how to rollout and manage infrastructure. This is the best place to talk shop, ask questions, solicit feedback, and work together as a community to build totally *sweet* infrastructure.
139+
140+
### 📰 Newsletter
141+
142+
Sign up for [our newsletter](https://cpco.io/newsletter?utm_source=github&utm_medium=readme&utm_campaign=cloudposse-github-actions/pr-comment-on-release&utm_content=newsletter) and join 3,000+ DevOps engineers, CTOs, and founders who get insider access to the latest DevOps trends, so you can always stay in the know.
143+
Dropped straight into your Inbox every week — and usually a 5-minute read.
144+
145+
### 📆 Office Hours <a href="https://cloudposse.com/office-hours?utm_source=github&utm_medium=readme&utm_campaign=cloudposse-github-actions/pr-comment-on-release&utm_content=office_hours"><img src="https://img.cloudposse.com/fit-in/200x200/https://cloudposse.com/wp-content/uploads/2019/08/Powered-by-Zoom.png" align="right" /></a>
146+
147+
[Join us every Wednesday via Zoom](https://cloudposse.com/office-hours?utm_source=github&utm_medium=readme&utm_campaign=cloudposse-github-actions/pr-comment-on-release&utm_content=office_hours) for your weekly dose of insider DevOps trends, AWS news and GitHub Action insights, all sourced from our SweetOps community, plus a _live Q&A_ that you can’t find anywhere else.
148+
It's **FREE** for everyone!
149+
150+
## About
151+
152+
This project is maintained by <a href="https://cpco.io/homepage?utm_source=github&utm_medium=readme&utm_campaign=cloudposse-github-actions/pr-comment-on-release&utm_content=">Cloud Posse, LLC</a>.
153+
<a href="https://cpco.io/homepage?utm_source=github&utm_medium=readme&utm_campaign=cloudposse-github-actions/pr-comment-on-release&utm_content="><img src="https://cloudposse.com/logo-300x69.svg" align="right" /></a>
154+
155+
We are a [**DevOps Accelerator**](https://cpco.io/commercial-support?utm_source=github&utm_medium=readme&utm_campaign=cloudposse-github-actions/pr-comment-on-release&utm_content=commercial_support) for funded startups and enterprises.
156+
Use our ready-to-go terraform architecture blueprints for AWS & GitHub Actions to get up and running quickly.
157+
We build it with you. You own everything. Your team wins. Plus, we stick around until you succeed.
158+
159+
<a href="https://cpco.io/commercial-support?utm_source=github&utm_medium=readme&utm_campaign=cloudposse-github-actions/pr-comment-on-release&utm_content=commercial_support"><img alt="Learn More" src="https://img.shields.io/badge/learn%20more-success.svg?style=for-the-badge"/></a>
160+
161+
*Your team can operate like a pro today.*
162+
163+
Ensure that your team succeeds by using our proven process and turnkey blueprints. Plus, we stick around until you succeed.
164+
165+
<details>
166+
<summary>📚 <strong>See What's Included</strong></summary>
167+
168+
- **Reference Architecture.** You'll get everything you need from the ground up built using 100% infrastructure as code.
169+
- **Deployment Strategy.** You'll have a battle-tested deployment strategy using GitHub Actions that's automated and repeatable.
170+
- **Site Reliability Engineering.** You'll have total visibility into your apps and microservices.
171+
- **Security Baseline.** You'll have built-in governance with accountability and audit logs for all changes.
172+
- **GitOps.** You'll be able to operate your infrastructure via Pull Requests.
173+
- **Training.** You'll receive hands-on training so your team can operate what we build.
174+
- **Questions.** You'll have a direct line of communication between our teams via a Shared Slack channel.
175+
- **Troubleshooting.** You'll get help to triage when things aren't working.
176+
- **Code Reviews.** You'll receive constructive feedback on Pull Requests.
177+
- **Bug Fixes.** We'll rapidly work with you to fix any bugs in our projects.
178+
</details>
179+
180+
<a href="https://cloudposse.com/readme/commercial-support/link?utm_source=github&utm_medium=readme&utm_campaign=cloudposse-github-actions/pr-comment-on-release&utm_content=readme_commercial_support_link"><img src="https://cloudposse.com/readme/commercial-support/img"/></a>
181+
## License
182+
183+
<a href="https://opensource.org/licenses/Apache-2.0"><img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg?style=for-the-badge" alt="License"></a>
184+
185+
<details>
186+
<summary>Preamble to the Apache License, Version 2.0</summary>
187+
<br/>
188+
<br/>
189+
190+
Complete license is available in the [`LICENSE`](LICENSE) file.
191+
192+
```text
193+
Licensed to the Apache Software Foundation (ASF) under one
194+
or more contributor license agreements. See the NOTICE file
195+
distributed with this work for additional information
196+
regarding copyright ownership. The ASF licenses this file
197+
to you under the Apache License, Version 2.0 (the
198+
"License"); you may not use this file except in compliance
199+
with the License. You may obtain a copy of the License at
200+
201+
https://www.apache.org/licenses/LICENSE-2.0
202+
203+
Unless required by applicable law or agreed to in writing,
204+
software distributed under the License is distributed on an
205+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
206+
KIND, either express or implied. See the License for the
207+
specific language governing permissions and limitations
208+
under the License.
209+
```
210+
</details>
211+
212+
## Trademarks
213+
214+
All other trademarks referenced herein are the property of their respective owners.
215+
---
216+
Copyright © 2017-2025 [Cloud Posse, LLC](https://cpco.io/copyright)
87217

88218

219+
<a href="https://cloudposse.com/readme/footer/link?utm_source=github&utm_medium=readme&utm_campaign=cloudposse-github-actions/pr-comment-on-release&utm_content=readme_footer_link"><img alt="README footer" src="https://cloudposse.com/readme/footer/img"/></a>
89220

221+
<img alt="Beacon" width="0" src="https://ga-beacon.cloudposse.com/UA-76589703-4/cloudposse-github-actions/pr-comment-on-release?pixel&cs=github&cm=readme&an=pr-comment-on-release"/>

README.yaml

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,13 @@ badges:
3232
related: []
3333

3434
# Short description of this project
35-
description: Comments on a (merged) PR when it is included in a GitHub release.
35+
description: Comments on a PR when it is included in a GitHub release.
3636

3737
introduction: |-
38-
This composite action comments on a (merged) Pull Request when it is included in a GitHub release.
38+
This action comments on a PR when it has commits associated with a release.
3939
40-
references:
41-
- name: "cloudposse-github-actions"
42-
description: "Reusable workflows for different types of projects"
43-
url: "https://github.com/cloudposse-github-actions"
44-
- name: "pr-comment-on-release"
45-
description: "Example application with complicated release workflow"
46-
url: "https://github.com/cloudposse-github-actions/pr-comment-on-release"
40+
This action should typically be called in a worklow with the `on.release` trigger:
4741
48-
# How to use this project
49-
usage: |-
5042
```yaml
5143
name: PR Comment on Release
5244
@@ -68,10 +60,30 @@ usage: |-
6860
uses: cloudposse-github-actions/pr-comment-on-release
6961
id: pr-comment-on-release
7062
with:
71-
retries: 5 # Override number of retries
63+
# Optional: only comment on PRs when the release matches a certain regex (default: ".*")
64+
include_regex: "^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$"
65+
```
66+
67+
This action returns a JSON-encoded string, which contains information on the comments it created (if any):
68+
69+
```jsonc
70+
{
71+
"comments": [
72+
"pull_request": 1, // the PR #
73+
"comment_id": 12345 // the comment ID
74+
]
75+
}
7276
```
7377
74-
include:
78+
references:
79+
- name: "cloudposse-github-actions"
80+
description: "Reusable workflows for different types of projects"
81+
url: "https://github.com/cloudposse-github-actions"
82+
- name: "pr-comment-on-release"
83+
description: "Example application with complicated release workflow"
84+
url: "https://github.com/cloudposse-github-actions/pr-comment-on-release"
85+
86+
includes:
7587
- "docs/github-action.md"
7688

7789
# Contributors to this project

action.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,24 @@
11
name: "PR Comment on Release"
2-
description: |
3-
Comments on a PR when it is included in a GitHub release.
4-
5-
This action should typically be called in a worklow with the `on.release` trigger.
2+
description: "Comments on a PR when it is included in a GitHub release."
63
74
branding:
8-
icon: "file"
5+
icon: "git-pull-request"
96
color: "white"
107
inputs:
118
retries:
129
required: false
13-
description: "Number of retries"
14-
default: "3"
10+
description: "Number of retries."
11+
default: "0"
1512
include_regex:
1613
required: false
17-
description: |
18-
Only include releases whose tag name matches this regular expression.
19-
This regular expression should not include delimeters. i.e. instead of `/.*/g`, supply only `.*`.
14+
description: "Only include releases whose tag name matches this regular expression. This regular expression should not include delimeters. i.e. instead of `/.*/g`, supply only `.*`."
2015
default: ".*"
2116
tag:
2217
required: false
2318
description: "The git tag used to determine the release. If omitted, the release will be determined from `github.event.release.id`."
24-
default: ""
2519
outputs:
2620
result:
27-
description: "A JSON-encoded list of objects detailing the ID of each PR and the comment created by this action."
21+
description: "A JSON-encoded string, which contains information on the comments it created (if any)."
2822
value: ${{ steps.pr-comment-on-release.outputs.result }}
2923
runs:
3024
using: "composite"

docs/github-action.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@
44

55
| Name | Description | Default | Required |
66
|------|-------------|---------|----------|
7-
| retries | Number of retries | 3 | false |
7+
| include\_regex | Only include releases whose tag name matches this regular expression. This regular expression should not include delimeters. i.e. instead of `/.\*/g`, supply only `.\*`. | .\* | false |
8+
| retries | Number of retries. | 0 | false |
9+
| tag | The git tag used to determine the release. If omitted, the release will be determined from `github.event.release.id`. | N/A | false |
810

911

12+
## Outputs
13+
14+
| Name | Description |
15+
|------|-------------|
16+
| result | A JSON-encoded string, which contains information on the comments it created (if any). |
1017
<!-- markdownlint-restore -->

0 commit comments

Comments
 (0)