1
0
Fork 0
mirror of https://code.forgejo.org/forgejo/runner.git synced 2025-08-06 17:40:58 +00:00
forgejo-runner/act/common/sha256.go
Earl Warren 53e26e56b1 fix: sum256 the container name so derivations do not overflow (#191)
For instance, the volume name derived from the workflow name may exceed the file system limit when the container name it is derived from is too long.

Fixes forgejo/runner#152

Reviewed-on: https://code.forgejo.org/forgejo/act/pulls/191
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-07-25 09:44:25 +00:00

13 lines
256 B
Go

// Copyright 2025 The Forgejo Authors
// SPDX-License-Identifier: MIT
package common
import (
"crypto/sha256"
"encoding/hex"
)
func Sha256(content string) string {
hashBytes := sha256.Sum256([]byte(content))
return hex.EncodeToString(hashBytes[:])
}