Skip to content

Commit 2b14da5

Browse files
committed
adds validation for output_file and updates doc
1 parent a694200 commit 2b14da5

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

actions/socket-export-sbom/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ A good use case is including this sbom as part of a public repo's release artifa
66

77
## Inputs
88

9-
| Name | Type | Description | Default Value | Required |
10-
| ------------------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | -------- |
11-
| `socket_api_token` | `string` | GitHub token used to authenticate with `gh`. Requires permission to query for protected branches and delete branches (`contents: write`) and pull requests (`pull_requests: read`) | `none` | true |
12-
| `output_file` | `string` | Name of the file to save the socket sbom on the runner. | `"spdx.json"` | false |
9+
| Name | Type | Description | Default Value | Required |
10+
| ------------------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | -------- |
11+
| `socket_api_token` | `string` | GitHub token used to authenticate with `gh`. Requires permission to query for protected branches and delete branches (`contents: write`) and pull requests (`pull_requests: read`) | `none` | true |
12+
| `socket_base_url` | `string` | Base URL of the socket api endpoint. | `"api.socket.dev/v0"` | true |
13+
| `socket_org_name` | `string` | Name of the socket org. | `"grafana"` | true |
14+
| `output_file` | `string` | Name of the file to save the socket sbom on the runner. | `"spdx.json"` | false |
1315

1416
## Examples
1517

actions/socket-export-sbom/action.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ inputs:
1414
required: true
1515
default: "grafana"
1616
output_file:
17-
description: "Output file path for the SBOM"
17+
description: "Name of the file to save the sbom"
1818
required: false
1919

2020
runs:
2121
using: "composite"
2222
steps:
2323
- name: Setup Go
24-
uses: actions/setup-go@v5
24+
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
2525
with:
2626
go-version: "1.25.4"
2727

@@ -33,13 +33,18 @@ runs:
3333
echo "name=$REPO_NAME" >> $GITHUB_OUTPUT
3434
3535
- name: Export SPDX SBOM from Socket.dev
36-
shell: sh
37-
working-directory: ./socket-sbom
36+
shell: bash
3837
env:
3938
SOCKET_API_TOKEN: ${{ inputs.socket_api_token }}
4039
SOCKET_BASE_URL: ${{ inputs.socket_base_url }}
4140
SOCKET_ORG: ${{ inputs.socket_org }}
4241
REPO_NAME: ${{ steps.repo-name.outputs.name }}
4342
OUTPUT_FILE: ${{ inputs.output_file }}
43+
ACTION_PATH: ${{ github.action_path }}
4444
run: |
45+
# Extract basename if output_file is provided (handles both filenames and paths)
46+
if [[ -n "$OUTPUT_FILE" ]]; then
47+
OUTPUT_FILE=$(basename "$OUTPUT_FILE")
48+
fi
4549
go run main.go $REPO_NAME $OUTPUT_FILE
50+
echo "ACTION_PATH/$OUTPUT_FILE" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)