Skip to content

Add papertrail action #4

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

Merged
merged 3 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ GPG key.
### git-sign

Use this action to create signed git artifacts:
```markdown

```yaml
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦‍♂️ Thanks!

- name: "Create signed commit"
uses: mongodb/drivers-github-tools/garasign/git-sign@main
with:
Expand Down Expand Up @@ -41,7 +42,7 @@ option can be set to a truthy value to avoid unnecessary logins to artifactory.

This action is used to create detached signatures for files:

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

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

```markdown
```yaml
- name: "Create detached signature"
uses: mongodb/drivers-github-tools/garasign/gpg-sign@main
with:
Expand All @@ -69,3 +70,23 @@ You can also supply multiple space-separated filenames to sign a list of files:
artifactory_username: ${{ secrets.ARTIFACTORY_USER }}
artifactory_password: ${{ secrets.ARTIFACTORY_PASSWORD }}
```

## Reporting tools

The following tools are meant to aid in generating Software Security Development Lifecycle
reports associated with a product release.

### Papertrail

This action will create a record of authorized publication on distribution channels.
By default it will create a "papertrail.txt" file in the current directory.

```yaml
- name: "Create papertrail report"
uses: mongodb/drivers-github-tools/papertrail@main
with:
product_name: Mongo Python Driver
release_version: ${{ github.ref_name }}
filenames: $DIST_FILES
token: ${{ github.token }}
```
42 changes: 42 additions & 0 deletions papertrail/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: "Papertrail Report"
description: "Generate report for authorized publication on distribution channels"
inputs:
product_name:
description: "Name of product"
required: true
release_version:
description: "The release version. If not provided, the github.ref_name variable will be used"
required: false
filenames:
description: "Artifact filenames to include in the report, space-separated"
required: true
token:
description: "The GitHub token for the action"
required: true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use default: ${{ github.token }} here or does that not work?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not from within an action, "Note: This context property is set by the Actions runner, and is only available within the execution steps of a job."

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. No problem then 👍

output:
description: "The output filename"
default: "papertail.txt"

runs:
using: composite
steps:
- name: "Prepare report"
shell: bash
run: |
export GH_TOKEN=${{ inputs.token }}
NAME=$(gh api users/${{ github.actor }} --jq '.name')
export PAPERTRAIL="${{ inputs.output }}"
export VERSION="${{ github.ref_name }}"
if [ -n "${{ inputs.release_version }}" ]; then
export VERSION="${{ inputs.release_version }}"
fi
echo "Product: ${{ inputs.product_name }}" > $PAPERTRAIL
echo "Version: $VERSION" >> $PAPERTRAIL
echo "Releaser: $NAME" >> $PAPERTRAIL
echo "Build Source: GitHub Actions"
echo "Build Number: ${{ github.run_id }}"
for filename in"${{ inputs.filenames }}"; do
SHA=$(shasum -a 256 $filename | awk '{print $1;}')
echo "Filename: $filename" >> $PAPERTRAIL
echo "Shasum: $SHA" >> $PAPERTRAIL
done
Loading