aRustyDev / aRustyDev/gh

feat(action): attestation/generate-digest - Generate SHA256 digest for subject

Open
#25 2 comments 0 reactions 1 assignee Claimed by @aRustyDev View on GitHub
enhancement new-action
Dominant language
Shell
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

## Parent Epic
Part of #22 (Atomic Release Pipeline Actions)

## Priority
P0 - Core attestation functionality used by all workflows

## Description

Create a composite action that generates a SHA256 digest for an attestation subject.

Supports both file content and string content for flexible attestation subjects.

## Inputs

| Input | Required | Default | Description |
|-------|----------|---------|-------------|
| `content` | Yes | - | Content to hash (file path or string) |
| `type` | No | `string` | Content type: "file" or "string" |

## Outputs

| Output | Description |
|--------|-------------|
| `digest` | SHA256 digest in format "sha256:..." |

## Usage Example

```yaml
# Hash a string
- uses: arustydev/gha/actions/attestation/generate-digest@v1
id: digest
with:
content: '{"workflow": "atomize", "artifacts": ["chart-a", "chart-b"]}'
type: string

# Hash a file
- uses: arustydev/gha/actions/attestation/generate-digest@v1
id: file-digest
with:
content: charts/my-chart/Chart.yaml
type: file

- run: echo "Digest: ${{ steps.digest.outputs.digest }}"
```

## Source Reference

`helm-charts/.github/scripts/attestation-lib.sh`:
- `generate_subject_digest()` (lines 360-376)

## Implementation Notes

- Use sha256sum for hashing
- Validate file exists when type=file
- Output format must be "sha256:"

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.