Skip to content
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ go run . run
- ~~Running steps after cancellation~~ Is now working in 0.6.0
- ~~steps.timeout-minutes not implemented~~ Is now working in 0.6.0
- ~~Service Container are not implemented~~ Is now working in 0.7.0
- Step Summaries are not implemented (only file command is provided)
- ~~Step Summaries are not implemented (only file command is provided)~~ Is now part of 0.13.1
- Annotations are not implemented
- Problem Matcher are not implemented
- Expressions in `with` and `env` (also applies to workflow and job env blocks) keys / directly assign to a mapping expression are not implemented
Expand Down
7 changes: 7 additions & 0 deletions actionsdotnetactcompat/act_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"regexp"
"runtime"
"strings"
"sync"
"time"

"github.com/actions-oss/act-cli/pkg/common"
Expand Down Expand Up @@ -44,6 +45,7 @@ const (
)

type ghaFormatter struct {
m sync.Mutex
rqt *protocol.AgentJobRequestMessage
rc *runner.RunContext
logger *logger.JobLogger
Expand Down Expand Up @@ -95,6 +97,8 @@ func (f *ghaFormatter) EvaluateStep(ctx context.Context, rec *protocol.TimelineR
}

func (f *ghaFormatter) Format(entry *logrus.Entry) ([]byte, error) {
f.m.Lock()
defer f.m.Unlock()
b := &bytes.Buffer{}
var stepID string
stage, hasStage := entry.Data["stage"]
Expand Down Expand Up @@ -216,6 +220,9 @@ func (f *ghaFormatter) Format(entry *logrus.Entry) ([]byte, error) {
msg = arg
case "ignored":
msg = raw
case "summary":
content, _ := entry.Data["content"].(string)
f.logger.UploadStepSummary(f.logger.Current(), content)
}
msg = f.linefeedregex.ReplaceAllString(prefix+strings.Trim(msg, "\r\n"), "\n"+prefix)

Expand Down
12 changes: 12 additions & 0 deletions protocol/logger/job_logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,18 @@ func (logger *JobLogger) MoveNextExt(startNextRecord bool) *protocol.TimelineRec
return nil
}

func (logger *JobLogger) UploadStepSummary(cur *protocol.TimelineRecord, summary string) {
if logger.ResultsConnection != nil && cur != nil && summary != "" {
rs := &results.ResultsService{
Connection: logger.ResultsConnection,
}
ctx, cancel := context.WithTimeout(context.Background(), resultsUploadTimeout)
defer cancel()
_ = rs.UploadResultsStepSummaryAsync(ctx, logger.JobRequest.Plan.PlanID, logger.JobRequest.JobID, cur.ID,
strings.NewReader(summary), int64(len(summary))) // Ignore upload error for async operation
}
}

func (logger *JobLogger) uploadBlock(cur *protocol.TimelineRecord, finalBlock bool) {
if !logger.IsResults && finalBlock && logger.CurrentBuffer.Len() > 0 {
logid, err := logger.Connection.UploadLogFile(
Expand Down
2 changes: 1 addition & 1 deletion protocol/results/contracts.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type GetSignedStepSummaryURLRequest struct {

type GetSignedStepSummaryURLResponse struct {
SummaryURL string `json:"summary_url,omitempty"`
SoftSizeLimit int64 `json:"soft_size_limit,omitempty"`
SoftSizeLimit string `json:"soft_size_limit,omitempty"`
BlobStorageType string `json:"blob_storage_type,omitempty"`
}

Expand Down
4 changes: 3 additions & 1 deletion protocol/results/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"io"
"net/http"
"strconv"
"time"

"github.com/ChristopherHX/github-act-runner/protocol"
Expand Down Expand Up @@ -106,7 +107,8 @@ func (rs *ResultsService) UploadResultsStepSummaryAsync(
if uploadURLResponse.SummaryURL == "" {
return fmt.Errorf("failed to get step log upload url")
}
if fileSize > uploadURLResponse.SoftSizeLimit {
softSizeLimit, _ := strconv.ParseInt(uploadURLResponse.SoftSizeLimit, 10, 64)
if fileSize > softSizeLimit && softSizeLimit > 0 {
return fmt.Errorf(
"file size is larger than the upload url allows, file size: %v, upload url size: %v",
fileSize,
Expand Down
Loading