Skip to content

Commit 0eb3d02

Browse files
committed
Add aggregate action
1 parent 4a2b29a commit 0eb3d02

File tree

7 files changed

+172
-48
lines changed

7 files changed

+172
-48
lines changed

.github/workflows/test-terms-of-service-acceptance-run.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ jobs:
99
permissions:
1010
contents: write
1111
pull-requests: write
12-
actions: write
13-
statuses: write
1412
steps:
1513
- name: Checkout
1614
uses: actions/checkout@v4
@@ -19,3 +17,5 @@ jobs:
1917
with:
2018
tos-location: 'https://foo.bar/tos.html'
2119
white-list: '*'
20+
signature-branch: ${{ github.event.repository.default_branch }}
21+
signature-location: '.github/develocity-tos.json'

README.md

Lines changed: 91 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ _Note:_
3535
Some parameters need to be adjusted here:
3636
- The workflow name (here `Build`) triggered when a pull-request is submitted
3737
- The build workflow filename (here `build.yml`) has to be adjusted to the filename of the workflow using `maven-build-scan/save`
38+
- The location of the Develocity Terms of Service (here `https://foo.bar/tos.html`)
3839
- The Develocity URL (here `https://<MY_DEVELOCITY_URL>`)
3940
- The secret name holding the Develocity access key (here `<DEVELOCITY_ACCESS_KEY>`)
4041

@@ -56,45 +57,35 @@ jobs:
5657
contents: write
5758
pull-requests: write
5859
steps:
59-
- name: Load data
60-
id: load
61-
uses: gradle/github-actions/maven-build-scan/load@v1.0
60+
- name: Publish Build Scan
61+
uses: gradle/github-actions/maven-build-scan@v1.0
6262
with:
6363
build-workflow-filename: 'build.yml'
64-
- name: Verify Terms of Service acceptance
65-
uses: gradle/github-actions/terms-of-service-acceptance/run@v1.0
66-
with:
6764
tos-location: 'https://foo.bar/tos.html'
68-
pr-number: ${{ steps.load.outputs.pr-number }}
69-
- name: Publish Maven Build Scans
70-
uses: gradle/github-actions/maven-build-scan/publish@v1.0
71-
with:
7265
develocity-url: 'https://<MY_DEVELOCITY_URL>'
7366
develocity-access-key: ${{ secrets.<DEVELOCITY_ACCESS_KEY> }}
74-
pr-number: ${{ steps.load.outputs.pr-number }}
7567
```
7668
7769
### Implementation details
7870
79-
#### terms-of-service-acceptance/run
71+
#### maven-build-scan
8072
81-
A composite action to verify that Develocity Terms of Service have been accepted.
73+
This composite action is a meta action to simplify the logic on consumer side.
8274
83-
This action checks if the user submitting a pull-request has accepted the Terms of Service.
84-
If the user has previously accepted the terms, then the action succeeds.
85-
If not, a comment is made on the pull-request asking the user to accept and the action fails. The user can then accept the Terms of Service by responding with a specific comment on the pull-request.
86-
87-
See the [cla-assistant-lite documentation](https://github.com/marketplace/actions/cla-assistant-lite) for more details.
75+
The action will download any saved Build Scan® and publish them to Develocity after having checked that the Terms of Service were accepted.
8876
8977
**Dependencies**:
9078
91-
- [cla-assistant-lite](https://github.com/marketplace/actions/cla-assistant-lite)
79+
- `maven-build-scan/load`
80+
- `terms-of-service-acceptance/run`
81+
- `maven-build-scan/publish`
9282

9383
**Event Triggers**:
9484

9585
This action should be configured to respond to the following event triggers:
9686
- `workflow_run`: to check if the user has previously accepted the Terms of Service before publishing a Build Scan®.
9787
- `issue_comment`: to check if any new pull-request comment is accepting the Terms of Service.
88+
These event allows access to the repository secrets (_Develocity Access Key_) which is required to publish a Build Scan® to Gradle Enterprise when authentication is enabled.
9889

9990
**Permissions**:
10091

@@ -106,8 +97,11 @@ The following permissions are required for this action to operate:
10697

10798
| Name | Description | Default |
10899
|------------------------------------------|------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------|
100+
| `build-workflow-filename` | Filename of the workflow using `maven-build-scan/save` (called upon pull-request submission) | |
109101
| `tos-location` | Terms Of Service location (URL) | |
110-
| `pr-number` | pull-request number | |
102+
| `develocity-url` | Develocity URL | |
103+
| `develocity-access-key` | *Optional*: Develocity access key | |
104+
| `develocity-allow-untrusted` | *Optional*: Develocity allow-untrusted flag | `false` |
111105
| `signature-branch` | *Optional*: Git branch where the signature file will be stored | `${{ github.event.repository.default_branch }}` |
112106
| `signature-location` | *Optional*: Signature file location | `.github/develocity-tos.json` |
113107
| `pr-comment-tos-acceptance-missing` | *Optional*: pull-request comment added when Terms of Service have not previously been accepted | `Please accept [Develocity Terms Of Service]({0}) to get your pull-request Build Scan published by commenting this pull-request with the following message:` |
@@ -120,16 +114,19 @@ The following permissions are required for this action to operate:
120114

121115
_Note:_
122116
Some parameters need to be adjusted here:
123-
- The pull-request number (here `steps.load.outputs.pr-number`) has to be adjusted to the value set in the context
117+
- The build workflow filename (here `build.yml`) has to be adjusted to the filename of the workflow using `maven-build-scan/save`
118+
- The location of the Develocity Terms of Service (here `https://foo.bar/tos.html`)
119+
- The Develocity URL (here `https://<MY_DEVELOCITY_URL>`)
120+
- The secret name holding the Develocity access key (here `<DEVELOCITY_ACCESS_KEY>`)
124121

125122
```yaml
126-
[...]
127-
- name: Verify Terms of Service acceptance
128-
uses: gradle/github-actions/terms-of-service-acceptance/run@v1.0
123+
- name: Publish Build Scan
124+
uses: gradle/github-actions/maven-build-scan@v1.0
129125
with:
126+
build-workflow-filename: 'build.yml'
130127
tos-location: 'https://foo.bar/tos.html'
131-
pr-number: ${{ steps.load.outputs.pr-number }}
132-
[...]
128+
develocity-url: 'https://<MY_DEVELOCITY_URL>'
129+
develocity-access-key: ${{ secrets.<DEVELOCITY_ACCESS_KEY> }}
133130
```
134131

135132
#### maven-build-scan/save
@@ -181,14 +178,14 @@ This action should be configured to respond to the following event trigger (see
181178
- `workflow_run`: to run after the pull-request workflow.
182179
- `issue_comment`: to run after the pull-request is commented.
183180

184-
The action fails for any other event trigger, or if the comment is different than `recheck` or `I have read Develocity Terms Of Service and I hereby accept the Terms` (can be overridden).
181+
The action fails for any other event trigger, or if the comment is different than `recheck` or `I have read Develocity Terms Of Service and I hereby accept the Terms` (can be overridden).
185182

186183
**Action inputs**:
187184

188-
| Name | Description | Default |
189-
|-------------------------------------|----------------------------------------------------------------------------------------------|-------------------------------------------------------------------------|
190-
| `build-workflow-filename` | Filename of the workflow using `maven-build-scan/save` (called upon pull-request submission) | |
191-
| `pr-comment-tos-acceptance-request` | *Optional*: pull-request comment to accept the Terms of Service | `I have read Develocity Terms Of Service and I hereby accept the Terms` |
185+
| Name | Description | Default |
186+
|-------------------------------------|----------------------------------------------------------------------------------------------|---------|
187+
| `build-workflow-filename` | Filename of the workflow using `maven-build-scan/save` (called upon pull-request submission) | |
188+
| `pr-comment-tos-acceptance-request` | pull-request comment to accept the Terms of Service | |
192189

193190
**Action outputs**:
194191

@@ -212,6 +209,62 @@ Some parameters need to be adjusted here:
212209
[...]
213210
```
214211

212+
#### terms-of-service-acceptance/run
213+
214+
A composite action to verify that Develocity Terms of Service have been accepted.
215+
216+
This action checks if the user submitting a pull-request has accepted the Terms of Service.
217+
If the user has previously accepted the terms, then the action succeeds.
218+
If not, a comment is made on the pull-request asking the user to accept and the action fails. The user can then accept the Terms of Service by responding with a specific comment on the pull-request.
219+
220+
See the [cla-assistant-lite documentation](https://github.com/marketplace/actions/cla-assistant-lite) for more details.
221+
222+
**Dependencies**:
223+
224+
- [cla-assistant-lite](https://github.com/marketplace/actions/cla-assistant-lite)
225+
226+
**Event Triggers**:
227+
228+
This action should be configured to respond to the following event triggers:
229+
- `workflow_run`: to check if the user has previously accepted the Terms of Service before publishing a Build Scan®.
230+
- `issue_comment`: to check if any new pull-request comment is accepting the Terms of Service.
231+
232+
**Permissions**:
233+
234+
The following permissions are required for this action to operate:
235+
- `contents: write`: to create/edit the signature file
236+
- `pull-requests: write`: to comment the pull-request
237+
238+
**Action inputs**:
239+
240+
| Name | Description | Default |
241+
|------------------------------------------|------------------------------------------------------------------------------------|---------|
242+
| `tos-location` | Terms Of Service location (URL) | |
243+
| `pr-number` | pull-request number | |
244+
| `signature-branch` | Git branch where the signature file will be stored | |
245+
| `signature-location` | Signature file location | |
246+
| `pr-comment-tos-acceptance-missing` | pull-request comment added when Terms of Service have not previously been accepted | |
247+
| `pr-comment-tos-acceptance-request` | pull-request comment to accept the Terms of Service | |
248+
| `pr-comment-tos-acceptance-confirmation` | pull-request comment added when Terms of Service are accepted | |
249+
| `white-list` | CSV List of users not required to accept the Terms of Service | |
250+
| `github-token` | Github token | |
251+
252+
**Usage**:
253+
254+
_Note:_
255+
Some parameters need to be adjusted here:
256+
- The pull-request number (here `steps.load.outputs.pr-number`) has to be adjusted to the value set in the context
257+
258+
```yaml
259+
[...]
260+
- name: Verify Terms of Service acceptance
261+
uses: gradle/github-actions/terms-of-service-acceptance/run@v1.0
262+
with:
263+
tos-location: 'https://foo.bar/tos.html'
264+
pr-number: ${{ steps.load.outputs.pr-number }}
265+
[...]
266+
```
267+
215268
#### maven-build-scan/publish
216269

217270
This action will publish all Maven Build Scans® that have been saved as workflow artifacts by the `maven-build-scan/save` action.
@@ -242,13 +295,13 @@ The following permissions are required for this action to operate:
242295

243296
**Action inputs**:
244297

245-
| Name | Description | Default |
246-
|--------------------------------|---------------------------------------------|-----------------------|
247-
| `develocity-url` | Develocity URL | |
248-
| `pr-number` | pull-request number | |
249-
| `develocity-access-key` | *Optional*: Develocity access key | |
250-
| `develocity-allow-untrusted` | *Optional*: Develocity allow-untrusted flag | `false` |
251-
| `github-token` | *Optional*: Github token | `${{ github.token }}` |
298+
| Name | Description | Default |
299+
|--------------------------------|------------------------------------|-----------------------|
300+
| `develocity-url` | Develocity URL | |
301+
| `pr-number` | pull-request number | |
302+
| `develocity-allow-untrusted` | Develocity allow-untrusted flag | |
303+
| `develocity-access-key` | *Optional*: Develocity access key | |
304+
| `github-token` | *Optional*: Github token | `${{ github.token }}` |
252305

253306
**Usage**:
254307

doc/architecture.png

5.51 KB
Loading

maven-build-scan/action.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Publish Maven Build Scan
2+
description: Publish Maven Build Scan
3+
4+
inputs:
5+
build-workflow-filename:
6+
description: 'Filename of the workflow where the maven-build-scan/save action was triggered'
7+
required: true
8+
develocity-url:
9+
description: 'Develocity URL'
10+
required: true
11+
develocity-access-key:
12+
description: 'Develocity access key'
13+
required: false
14+
tos-location:
15+
description: 'Terms of Service location as an URL (https://foo.com/tos.html) or a Github repository file (/<owner>/<repo>/blob/<branch>/tos.html)'
16+
required: true
17+
develocity-allow-untrusted:
18+
description: 'Develocity allow-untrusted flag'
19+
default: 'false'
20+
pr-comment-tos-acceptance-missing:
21+
description: 'pull-request comment added when Terms of Service are not accepted ({0} in the value will be replaced by tos-location input)'
22+
default: 'Please accept [Develocity Terms of Service]({0}) to get your pull-request Build Scan published by commenting this pull-request with the following message:'
23+
pr-comment-tos-acceptance-request:
24+
description: 'pull-request comment to accept the Terms of Service'
25+
default: 'I have read Develocity Terms of Service and I hereby accept the Terms'
26+
pr-comment-tos-acceptance-validation:
27+
description: 'pull-request comment added when Terms of Service are accepted'
28+
default: 'All Contributors have accepted Develocity Terms of Service.'
29+
signature-branch:
30+
description: 'Git branch where the signature file will be stored'
31+
default: ${{ github.event.repository.default_branch }}
32+
signature-location:
33+
description: 'Signature file location'
34+
default: '.github/develocity-tos.json'
35+
white-list:
36+
description: 'CSV List of users not required to accept the Terms of Service'
37+
default: ''
38+
github-token:
39+
description: 'The token used for Github API requests'
40+
default: ${{ github.token }}
41+
required: false
42+
43+
runs:
44+
using: composite
45+
steps:
46+
- name: Load data
47+
id: load
48+
uses: gradle/github-actions/maven-build-scan/load@v0.1
49+
with:
50+
build-workflow-filename: ${{ inputs.build-workflow-filename }}
51+
pr-comment-tos-acceptance-request: ${{ inputs.pr-comment-tos-acceptance-request }}
52+
- name: Verify Terms of Service acceptance
53+
uses: gradle/github-actions/terms-of-service-acceptance/run@v0.1
54+
with:
55+
tos-location: ${{ inputs.tos-location }}
56+
pr-number: ${{ steps.load.outputs.pr-number }}
57+
pr-comment-tos-acceptance-missing: ${{ inputs.pr-comment-tos-acceptance-missing }}
58+
pr-comment-tos-acceptance-request: ${{ inputs.pr-comment-tos-acceptance-request }}
59+
pr-comment-tos-acceptance-validation: ${{ inputs.pr-comment-tos-acceptance-validation }}
60+
signature-branch: ${{ inputs.signature-branch }}
61+
signature-location: ${{ inputs.signature-location }}
62+
white-list: ${{ inputs.white-list }}
63+
github-token: ${{ inputs.github-token }}
64+
- name: Publish Maven Build Scans
65+
uses: gradle/github-actions/maven-build-scan/publish@v0.1
66+
with:
67+
develocity-url: ${{ inputs.develocity-url }}
68+
develocity-access-key: ${{ inputs.develocity-access-key }}
69+
pr-number: ${{ steps.load.outputs.pr-number }}
70+
develocity-allow-untrusted: ${{ inputs.develocity-allow-untrusted }}
71+
github-token: ${{ inputs.github-token }}

maven-build-scan/load/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ inputs:
77
required: true
88
pr-comment-tos-acceptance-request:
99
description: 'pull-request comment to accept the Terms of Service'
10-
default: 'I have read Develocity Terms of Service and I hereby accept the Terms'
10+
required: true
1111

1212
outputs:
1313
pr-number:

maven-build-scan/publish/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ inputs:
1010
required: false
1111
develocity-allow-untrusted:
1212
description: 'Develocity allow-untrusted flag'
13-
default: 'false'
13+
required: true
1414
github-token:
1515
description: 'The token used for Github API requests'
1616
default: ${{ github.token }}

0 commit comments

Comments
 (0)