Skip to content

Commit 08c9ab0

Browse files
blink1073alcaeus
andauthored
Add papertrail action (#4)
* Add papertrail action * fix loop * Update papertrail/action.yml Co-authored-by: Andreas Braun <git@alcaeus.org> --------- Co-authored-by: Andreas Braun <git@alcaeus.org>
1 parent e0b549f commit 08c9ab0

File tree

2 files changed

+66
-3
lines changed

2 files changed

+66
-3
lines changed

README.md

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ GPG key.
1313
### git-sign
1414

1515
Use this action to create signed git artifacts:
16-
```markdown
16+
17+
```yaml
1718
- name: "Create signed commit"
1819
uses: mongodb/drivers-github-tools/garasign/git-sign@main
1920
with:
@@ -41,7 +42,7 @@ option can be set to a truthy value to avoid unnecessary logins to artifactory.
4142

4243
This action is used to create detached signatures for files:
4344

44-
```markdown
45+
```yaml
4546
- name: "Create detached signature"
4647
uses: mongodb/drivers-github-tools/garasign/gpg-sign@main
4748
with:
@@ -59,7 +60,7 @@ option can be set to a truthy value to avoid unnecessary logins to artifactory.
5960

6061
You can also supply multiple space-separated filenames to sign a list of files:
6162

62-
```markdown
63+
```yaml
6364
- name: "Create detached signature"
6465
uses: mongodb/drivers-github-tools/garasign/gpg-sign@main
6566
with:
@@ -69,3 +70,23 @@ You can also supply multiple space-separated filenames to sign a list of files:
6970
artifactory_username: ${{ secrets.ARTIFACTORY_USER }}
7071
artifactory_password: ${{ secrets.ARTIFACTORY_PASSWORD }}
7172
```
73+
74+
## Reporting tools
75+
76+
The following tools are meant to aid in generating Software Security Development Lifecycle
77+
reports associated with a product release.
78+
79+
### Papertrail
80+
81+
This action will create a record of authorized publication on distribution channels.
82+
By default it will create a "papertrail.txt" file in the current directory.
83+
84+
```yaml
85+
- name: "Create papertrail report"
86+
uses: mongodb/drivers-github-tools/papertrail@main
87+
with:
88+
product_name: Mongo Python Driver
89+
release_version: ${{ github.ref_name }}
90+
filenames: $DIST_FILES
91+
token: ${{ github.token }}
92+
```

papertrail/action.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: "Papertrail Report"
2+
description: "Generate report for authorized publication on distribution channels"
3+
inputs:
4+
product_name:
5+
description: "Name of product"
6+
required: true
7+
release_version:
8+
description: "The release version. If not provided, the github.ref_name variable will be used"
9+
required: false
10+
filenames:
11+
description: "Artifact filenames to include in the report, space-separated"
12+
required: true
13+
token:
14+
description: "The GitHub token for the action"
15+
required: true
16+
output:
17+
description: "The output filename"
18+
default: "papertail.txt"
19+
20+
runs:
21+
using: composite
22+
steps:
23+
- name: "Prepare report"
24+
shell: bash
25+
run: |
26+
export GH_TOKEN=${{ inputs.token }}
27+
NAME=$(gh api users/${{ github.actor }} --jq '.name')
28+
export PAPERTRAIL="${{ inputs.output }}"
29+
export VERSION="${{ github.ref_name }}"
30+
if [ -n "${{ inputs.release_version }}" ]; then
31+
export VERSION="${{ inputs.release_version }}"
32+
fi
33+
echo "Product: ${{ inputs.product_name }}" > $PAPERTRAIL
34+
echo "Version: $VERSION" >> $PAPERTRAIL
35+
echo "Releaser: $NAME" >> $PAPERTRAIL
36+
echo "Build Source: GitHub Actions"
37+
echo "Build Number: ${{ github.run_id }}"
38+
for filename in"${{ inputs.filenames }}"; do
39+
SHA=$(shasum -a 256 $filename | awk '{print $1;}')
40+
echo "Filename: $filename" >> $PAPERTRAIL
41+
echo "Shasum: $SHA" >> $PAPERTRAIL
42+
done

0 commit comments

Comments
 (0)