Skip to content

Commit 472a102

Browse files
authored
try actions for handling notes (#42)
Signed-off-by: Tom Hennen <[email protected]>
1 parent b6286f4 commit 472a102

File tree

3 files changed

+45
-8
lines changed

3 files changed

+45
-8
lines changed

actions/get_note/action.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Gets data from a git note
2+
description: Gets data from the git note and stores it in the provided path.
3+
inputs:
4+
commit:
5+
description: 'Commit to read note data from'
6+
requried: true
7+
path:
8+
description: 'File with the data to add to the note'
9+
required: true
10+
11+
runs:
12+
using: "Composite"
13+
steps:
14+
- id: read_from_note
15+
run: |
16+
git config user.name "${{ github.actor }}"
17+
git config user.email "${{ github.actor }}@users.noreply.github.com"
18+
git fetch origin "refs/notes/*:refs/notes/*"
19+
git notes show ${{ inputs.commit }} >> ${{ inputs.path }}
20+
shell: bash

actions/store_note/action.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Store data in git notes
2+
description: Stores provided data in a git note for the current commit.
3+
inputs:
4+
path:
5+
description: 'File with the data to add to the note'
6+
required: true
7+
8+
runs:
9+
using: "Composite"
10+
steps:
11+
- id: store_in_note
12+
run: |
13+
git config user.name "${{ github.actor }}"
14+
git config user.email "${{ github.actor }}@users.noreply.github.com"
15+
git fetch origin "refs/notes/*:refs/notes/*"
16+
git notes append -F ${{ inputs.path }}
17+
git push origin "refs/notes/*"
18+
shell: bash

actions/vsa_creator/action.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,13 @@ runs:
3838
echo "## Signed VSA" >> $GITHUB_STEP_SUMMARY
3939
cat ${{ github.workspace }}/metadata/signed_vsa.json >> $GITHUB_STEP_SUMMARY
4040
shell: bash
41-
- id: store_in_note
42-
run: |
43-
git config user.name "${{ github.actor }}"
44-
git config user.email "${{ github.actor }}@users.noreply.github.com"
45-
git fetch origin "refs/notes/*:refs/notes/*"
46-
git notes append -F ${{ github.workspace }}/metadata/signed_vsa.json
47-
git push origin "refs/notes/*"
48-
shell: bash
41+
- uses: slsa-framework/slsa-source-poc/actions/store_note@main
42+
with:
43+
path: ${{ github.workspace }}/metadata/signed_vsa.json
44+
- uses: slsa-framework/slsa-source-poc/actions/get_note@main
45+
with:
46+
commit: ${{ github.event.before }}
47+
path: ${{ github.workspace }}/metadata/previous_note.json
4948
- uses: actions/upload-artifact@v4
5049
if: always()
5150
with:

0 commit comments

Comments
 (0)