Skip to content

Commit 84e5cc5

Browse files
committed
Merge branch 'main' into release
2 parents 67b7d5d + 8c34132 commit 84e5cc5

File tree

4 files changed

+495
-34
lines changed

4 files changed

+495
-34
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ on:
1919
# deploy:
2020
# steps:
2121

22-
- uses: urcomputeringpal/label-mutex@main
22+
- uses: urcomputeringpal/label-mutex@v0.3.0
2323
id: label-mutex
2424
env:
2525
AWS_DEFAULT_REGION: us-east-1
@@ -54,7 +54,7 @@ on:
5454
# unlock:
5555
# steps:
5656

57-
- uses: urcomputeringpal/label-mutex@v0.0.1
57+
- uses: urcomputeringpal/label-mutex@v0.3.0
5858
id: label-mutex
5959
env:
6060
AWS_DEFAULT_REGION: us-east-1

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ outputs:
3030
runs:
3131
using: docker
3232
# image: Dockerfile
33-
image: 'docker://urcomputeringpal/label-mutex:v0.2.0'
33+
image: 'docker://urcomputeringpal/label-mutex:v0.3.0'

labelMutex.go

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
package main
22

33
import (
4-
"bytes"
54
"context"
65
"encoding/json"
76
"errors"
87
"fmt"
9-
"io"
108
"log"
119
"net/http"
1210

@@ -66,19 +64,10 @@ func (lm *LabelMutex) process() error {
6664
if lm.eventName == "pull_request" {
6765
return lm.processPR()
6866
}
69-
if lm.eventName == "push" {
70-
return lm.processPush()
71-
}
72-
return fmt.Errorf("Unknown event %s", lm.eventName)
67+
return lm.processOther()
7368
}
7469

75-
func (lm *LabelMutex) processPush() error {
76-
var push github.PushEvent
77-
bytes := lm.clearJSONRepoOrgField(bytes.NewReader(lm.event))
78-
err := json.Unmarshal(bytes, &push)
79-
if err != nil {
80-
return err
81-
}
70+
func (lm *LabelMutex) processOther() error {
8271
value, err := lm.uriLocker.Read()
8372
if err == dynalock.ErrKeyNotFound {
8473
lm.locked = false
@@ -95,24 +84,6 @@ func (lm *LabelMutex) processPush() error {
9584
return nil
9685
}
9786

98-
func (lm *LabelMutex) clearJSONRepoOrgField(reader io.Reader) []byte {
99-
// workaround for https://github.com/google/go-github/issues/131
100-
var o map[string]interface{}
101-
dec := json.NewDecoder(reader)
102-
dec.UseNumber()
103-
dec.Decode(&o)
104-
if o != nil {
105-
repo := o["repository"]
106-
if repo != nil {
107-
if repo, ok := repo.(map[string]interface{}); ok {
108-
delete(repo, "organization")
109-
}
110-
}
111-
}
112-
b, _ := json.MarshalIndent(o, "", " ")
113-
return b
114-
}
115-
11687
func (lm *LabelMutex) processPR() error {
11788
var resultErr *multierror.Error
11889
var pr github.PullRequestEvent

0 commit comments

Comments
 (0)