Skip to content

Commit 33d6f77

Browse files
authored
chore(runners): use dynamic PR metadata material name (#2712)
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
1 parent bd14af8 commit 33d6f77

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

pkg/attestation/crafter/crafter.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,8 @@ func (c *Crafter) AutoCollectPRMetadata(ctx context.Context, attestationID strin
535535
}
536536

537537
// Create a temporary file for the metadata
538-
tmpFile, err := os.CreateTemp("", "pr-metadata-*.json")
538+
materialName := fmt.Sprintf("pr-metadata-%s", metadata.Number)
539+
tmpFile, err := os.CreateTemp("", fmt.Sprintf("%s.json", materialName))
539540
if err != nil {
540541
return fmt.Errorf("failed to create temp file: %w", err)
541542
}
@@ -549,7 +550,7 @@ func (c *Crafter) AutoCollectPRMetadata(ctx context.Context, attestationID strin
549550
tmpFile.Close()
550551

551552
// Add the material using the crafter with explicit CHAINLOOP_PR_INFO type
552-
if _, err := c.AddMaterialContractFree(ctx, attestationID, schemaapi.CraftingSchema_Material_CHAINLOOP_PR_INFO.String(), "pr-metadata", tmpFile.Name(), casBackend, nil); err != nil {
553+
if _, err := c.AddMaterialContractFree(ctx, attestationID, schemaapi.CraftingSchema_Material_CHAINLOOP_PR_INFO.String(), materialName, tmpFile.Name(), casBackend, nil); err != nil {
553554
return fmt.Errorf("failed to add PR/MR metadata material: %w", err)
554555
}
555556

0 commit comments

Comments
 (0)