add attestation-id and attestation-url outputs (#181)
Signed-off-by: Brian DeHamer <[email protected]>
This commit is contained in:
@@ -44,7 +44,7 @@ attest:
|
|||||||
1. Add the following to your workflow after your artifact has been built:
|
1. Add the following to your workflow after your artifact has been built:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: actions/attest@v1
|
- uses: actions/attest@v2
|
||||||
with:
|
with:
|
||||||
subject-path: '<PATH TO ARTIFACT>'
|
subject-path: '<PATH TO ARTIFACT>'
|
||||||
predicate-type: '<PREDICATE URI>'
|
predicate-type: '<PREDICATE URI>'
|
||||||
@@ -61,7 +61,7 @@ attest:
|
|||||||
See [action.yml](action.yml)
|
See [action.yml](action.yml)
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: actions/attest@v1
|
- uses: actions/attest@v2
|
||||||
with:
|
with:
|
||||||
# Path to the artifact serving as the subject of the attestation. Must
|
# Path to the artifact serving as the subject of the attestation. Must
|
||||||
# specify exactly one of "subject-path" or "subject-digest". May contain
|
# specify exactly one of "subject-path" or "subject-digest". May contain
|
||||||
@@ -109,9 +109,11 @@ See [action.yml](action.yml)
|
|||||||
|
|
||||||
<!-- markdownlint-disable MD013 -->
|
<!-- markdownlint-disable MD013 -->
|
||||||
|
|
||||||
| Name | Description | Example |
|
| Name | Description | Example |
|
||||||
| ------------- | -------------------------------------------------------------- | ----------------------- |
|
| ----------------- | -------------------------------------------------------------- | ------------------------------------------------ |
|
||||||
| `bundle-path` | Absolute path to the file containing the generated attestation | `/tmp/attestation.json` |
|
| `attestation-id` | GitHub ID for the attestation | `123456` |
|
||||||
|
| `attestation-url` | Absolute path to the file containing the generated attestation | `https://github.com/foo/bar/attestations/123456` |
|
||||||
|
| `bundle-path` | Absolute path to the file containing the generated attestation | `/tmp/attestation.json` |
|
||||||
|
|
||||||
<!-- markdownlint-enable MD013 -->
|
<!-- markdownlint-enable MD013 -->
|
||||||
|
|
||||||
@@ -157,7 +159,7 @@ jobs:
|
|||||||
- name: Build artifact
|
- name: Build artifact
|
||||||
run: make my-app
|
run: make my-app
|
||||||
- name: Attest
|
- name: Attest
|
||||||
uses: actions/attest@v1
|
uses: actions/attest@v2
|
||||||
with:
|
with:
|
||||||
subject-path: '${{ github.workspace }}/my-app'
|
subject-path: '${{ github.workspace }}/my-app'
|
||||||
predicate-type: 'https://example.com/predicate/v1'
|
predicate-type: 'https://example.com/predicate/v1'
|
||||||
@@ -170,7 +172,7 @@ If you are generating multiple artifacts, you can attest all of them at the same
|
|||||||
time by using a wildcard in the `subject-path` input.
|
time by using a wildcard in the `subject-path` input.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: actions/attest@v1
|
- uses: actions/attest@v2
|
||||||
with:
|
with:
|
||||||
subject-path: 'dist/**/my-bin-*'
|
subject-path: 'dist/**/my-bin-*'
|
||||||
predicate-type: 'https://example.com/predicate/v1'
|
predicate-type: 'https://example.com/predicate/v1'
|
||||||
@@ -184,13 +186,13 @@ Alternatively, you can explicitly list multiple subjects with either a comma or
|
|||||||
newline delimited list:
|
newline delimited list:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: actions/attest@v1
|
- uses: actions/attest@v2
|
||||||
with:
|
with:
|
||||||
subject-path: 'dist/foo, dist/bar'
|
subject-path: 'dist/foo, dist/bar'
|
||||||
```
|
```
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- uses: actions/attest@v1
|
- uses: actions/attest@v2
|
||||||
with:
|
with:
|
||||||
subject-path: |
|
subject-path: |
|
||||||
dist/foo
|
dist/foo
|
||||||
@@ -247,7 +249,7 @@ jobs:
|
|||||||
push: true
|
push: true
|
||||||
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||||
- name: Attest
|
- name: Attest
|
||||||
uses: actions/attest@v1
|
uses: actions/attest@v2
|
||||||
id: attest
|
id: attest
|
||||||
with:
|
with:
|
||||||
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||||
|
|||||||
@@ -199,6 +199,16 @@ describe('action', () => {
|
|||||||
'bundle-path',
|
'bundle-path',
|
||||||
expect.stringMatching('attestation.json')
|
expect.stringMatching('attestation.json')
|
||||||
)
|
)
|
||||||
|
expect(setOutputMock).toHaveBeenNthCalledWith(
|
||||||
|
2,
|
||||||
|
'attestation-id',
|
||||||
|
expect.stringMatching(attestationID)
|
||||||
|
)
|
||||||
|
expect(setOutputMock).toHaveBeenNthCalledWith(
|
||||||
|
3,
|
||||||
|
'attestation-url',
|
||||||
|
expect.stringContaining(`foo/bar/attestations/${attestationID}`)
|
||||||
|
)
|
||||||
expect(setFailedMock).not.toHaveBeenCalled()
|
expect(setFailedMock).not.toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -285,6 +295,16 @@ describe('action', () => {
|
|||||||
'bundle-path',
|
'bundle-path',
|
||||||
expect.stringMatching('attestation.json')
|
expect.stringMatching('attestation.json')
|
||||||
)
|
)
|
||||||
|
expect(setOutputMock).toHaveBeenNthCalledWith(
|
||||||
|
2,
|
||||||
|
'attestation-id',
|
||||||
|
expect.stringMatching(attestationID)
|
||||||
|
)
|
||||||
|
expect(setOutputMock).toHaveBeenNthCalledWith(
|
||||||
|
3,
|
||||||
|
'attestation-url',
|
||||||
|
expect.stringContaining(`foo/bar/attestations/${attestationID}`)
|
||||||
|
)
|
||||||
expect(setFailedMock).not.toHaveBeenCalled()
|
expect(setFailedMock).not.toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -61,6 +61,10 @@ inputs:
|
|||||||
outputs:
|
outputs:
|
||||||
bundle-path:
|
bundle-path:
|
||||||
description: 'The path to the file containing the attestation bundle.'
|
description: 'The path to the file containing the attestation bundle.'
|
||||||
|
attestation-id:
|
||||||
|
description: 'The ID of the attestation.'
|
||||||
|
attestation-url:
|
||||||
|
description: 'The URL for the attestation summary.'
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: node20
|
using: node20
|
||||||
|
|||||||
+4
@@ -70970,6 +70970,10 @@ async function run(inputs) {
|
|||||||
encoding: 'utf-8',
|
encoding: 'utf-8',
|
||||||
flag: 'a'
|
flag: 'a'
|
||||||
});
|
});
|
||||||
|
if (att.attestationID) {
|
||||||
|
core.setOutput('attestation-id', att.attestationID);
|
||||||
|
core.setOutput('attestation-url', attestationURL(att.attestationID));
|
||||||
|
}
|
||||||
if (inputs.showSummary) {
|
if (inputs.showSummary) {
|
||||||
logSummary(att);
|
logSummary(att);
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "actions/attest",
|
"name": "actions/attest",
|
||||||
"version": "2.0.1",
|
"version": "2.1.0",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "actions/attest",
|
"name": "actions/attest",
|
||||||
"version": "2.0.1",
|
"version": "2.1.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/attest": "^1.5.0",
|
"@actions/attest": "^1.5.0",
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "actions/attest",
|
"name": "actions/attest",
|
||||||
"description": "Generate signed attestations for workflow artifacts",
|
"description": "Generate signed attestations for workflow artifacts",
|
||||||
"version": "2.0.1",
|
"version": "2.1.0",
|
||||||
"author": "",
|
"author": "",
|
||||||
"private": true,
|
"private": true,
|
||||||
"homepage": "https://github.com/actions/attest",
|
"homepage": "https://github.com/actions/attest",
|
||||||
|
|||||||
@@ -79,6 +79,11 @@ export async function run(inputs: RunInputs): Promise<void> {
|
|||||||
flag: 'a'
|
flag: 'a'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
if (att.attestationID) {
|
||||||
|
core.setOutput('attestation-id', att.attestationID)
|
||||||
|
core.setOutput('attestation-url', attestationURL(att.attestationID))
|
||||||
|
}
|
||||||
|
|
||||||
if (inputs.showSummary) {
|
if (inputs.showSummary) {
|
||||||
logSummary(att)
|
logSummary(att)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user