diff options
author | Markus Wolf <KnisterPeter@users.noreply.github.com> | 2022-07-12 13:36:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-12 13:36:53 +0200 |
commit | 409446211fe99420d5d3761b04f491f8ef52412d (patch) | |
tree | f934454f8f857edcbe86b7b03b6f7e2b396077be /pkg/model | |
parent | only perform chown operation for non root users (#1250) (diff) | |
download | forgejo-act-409446211fe99420d5d3761b04f491f8ef52412d.tar.xz forgejo-act-409446211fe99420d5d3761b04f491f8ef52412d.zip |
fix: the number in the github event is of type number (#1252)
* fix: the number in the github event is of type number
The go %s formattig option outputs the type if the given
input value is not of type string.
* test: update test data as well
* fix: use floats
Diffstat (limited to 'pkg/model')
-rw-r--r-- | pkg/model/github_context.go | 2 | ||||
-rw-r--r-- | pkg/model/github_context_test.go | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/pkg/model/github_context.go b/pkg/model/github_context.go index 577cab5..e9918a8 100644 --- a/pkg/model/github_context.go +++ b/pkg/model/github_context.go @@ -98,7 +98,7 @@ func (ghc *GithubContext) SetRefAndSha(ctx context.Context, defaultBranch string ghc.Ref = ghc.BaseRef ghc.Sha = asString(nestedMapLookup(ghc.Event, "pull_request", "base", "sha")) case "pull_request", "pull_request_review", "pull_request_review_comment": - ghc.Ref = fmt.Sprintf("refs/pull/%s/merge", ghc.Event["number"]) + ghc.Ref = fmt.Sprintf("refs/pull/%.0f/merge", ghc.Event["number"]) case "deployment", "deployment_status": ghc.Ref = asString(nestedMapLookup(ghc.Event, "deployment", "ref")) ghc.Sha = asString(nestedMapLookup(ghc.Event, "deployment", "sha")) diff --git a/pkg/model/github_context_test.go b/pkg/model/github_context_test.go index f321f53..5cffcde 100644 --- a/pkg/model/github_context_test.go +++ b/pkg/model/github_context_test.go @@ -46,7 +46,7 @@ func TestSetRefAndSha(t *testing.T) { { eventName: "pull_request", event: map[string]interface{}{ - "number": "1234", + "number": 1234., }, ref: "refs/pull/1234/merge", sha: "1234fakesha", |