-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!: Add comment to PR #85
Conversation
46ccf86
to
79af995
Compare
0fc6281
to
7211424
Compare
7211424
to
6abda63
Compare
Extends on #20. If the action has been started via a pull request, add a comment to the pull request with links to deploy the build. BREAKING CHANGE: New `githubToken` input required. This token must have `pull_request: write` permission.
6abda63
to
cfa8da6
Compare
const signature = | ||
'_From [guardian/actions-riff-raff](https://github.com/guardian/actions-riff-raff)._'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is used to locate a previous comment to update.
817fc9e
to
4d9f2af
Compare
Check if running on a pull request once.
4d9f2af
to
8583175
Compare
Pass the PR number as an argument to `commentOnPullRequest`, pushing logic for other events to the call site. This makes things more logical to read too.
d2dae0d
to
2054af6
Compare
2054af6
to
34464fc
Compare
Previously if `githubToken` was not supplied we'd fail at the point of commenting. This change fails at the start.
### `commentingStage` | ||
_Default: CODE_ | ||
|
||
When commenting on a pull request, which stage should be used. Typically a pre-production stage. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not convinced this is the best variable name. Alternatives welcomed!
@akash1810 is this still intended to be the case? Unfortunately it doesn't seem to be working with the recent PRs I've seen. For instance, in this PR: https://github.com/guardian/ophan/pull/6106, there are 8 comments made by
It's quite noisy- this happens on every single PR on Ophan - and it would be great if all these could be in the same comment, rather than 8 separate comments! |
@rtyley the action is behaving as intended - a comment is added for each Riff-Raff project an artifact has been built for. In the case of Ophan, there are 8 unique projects being built, hence 8 comments. Folding this into a single comment sounds great! Indeed it has come up previously. Looking at https://github.com/guardian/riffraff-platform/blob/main/packages/common/src/access.ts, there are quite a few repositories that produce more than 1 artifact, which could help prioritise implementing this. Let's create an issue for this? |
What does this change?
In #20 a job summary was added with Riff-Raff information.
This change takes this a little further, adding a comment to the pull request with links to deploy the project in Riff-Raff. Only one comment will be made. As new builds are created, the comment is updated.
This change adds two new inputs:
githubToken
is a GitHub token with permissions to comment on a pull request.commentingStage
which stage to deploy to. Default ofCODE
.How to test
Use the action!
guardian/actions-riff-raff
to get PR comments service-catalogue#487 would be a typical usage, only settinggithubToken
.guardian/actions-riff-raff
to get PR comments cdk-playground#399 setscommentingStage
toPROD
as the app only has one stage.Have we considered potential risks?
This should be released as a breaking change as a new required input
githubToken
is added.Images
Draft release notes
v3.0.0
BREAKING CHANGES
A new required input
githubToken
has been added. This needs to be scoped withpull-requests: write
permission.Before (v2)
After (v3)