Skip to content

Commit

Permalink
Revert "set label on PR based on check result (#2353)" (#2372)
Browse files Browse the repository at this point in the history
This reverts commit fa6eb4d.
  • Loading branch information
simon-friedberger authored Jan 23, 2025
1 parent 47264b5 commit 3bf13d1
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 128 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/psltool_pr_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ name: psltool PR check
on:
pull_request:

permissions:
pull-requests: write
permissions: {}

jobs:
validate:
Expand All @@ -18,6 +17,4 @@ jobs:
- name: run validations
run: |
cd tools
go run ./psltool check-pr --gh-owner ${{ github.event.repository.owner.login }} --gh-repo ${{ github.event.repository.name }} --online-checks ${{ github.event.pull_request.number }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
go run ./psltool fmt -d ../public_suffix_list.dat && go run ./psltool check-pr --gh-owner ${{ github.event.repository.owner.login }} --gh-repo ${{ github.event.repository.name }} --online-checks ${{ github.event.pull_request.number }}
8 changes: 5 additions & 3 deletions tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ require (
github.com/creachadair/command v0.1.13
github.com/creachadair/flax v0.0.0-20240525192034-44db93b3a8ad
github.com/creachadair/mds v0.15.2
github.com/creachadair/taskgroup v0.9.0
github.com/google/go-github/v67 v67.0.0
github.com/google/go-github/v63 v63.0.0
github.com/natefinch/atomic v1.0.1
)

require github.com/google/go-querystring v1.1.0 // indirect
require (
github.com/creachadair/taskgroup v0.9.0 // indirect
github.com/google/go-querystring v1.1.0 // indirect
)
6 changes: 2 additions & 4 deletions tools/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@ github.com/creachadair/mds v0.15.2 h1:es1qGKgRGSaztpvrSQcZ0B9I6NsHYJ1Sa9naD/3OfC
github.com/creachadair/mds v0.15.2/go.mod h1:4vrFYUzTXMJpMBU+OA292I6IUxKWCCfZkgXg+/kBZMo=
github.com/creachadair/taskgroup v0.9.0 h1:kzXSea5C7R5DtnKFBOTEW3hvmCkiVnRkODMVDMgSS6k=
github.com/creachadair/taskgroup v0.9.0/go.mod h1:+1hJc8zL1rQkxcMVqEYJ0UPGtwl6Iz1+fd4zcOLtt+A=
github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=
github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-github/v67 v67.0.0 h1:g11NDAmfaBaCO8qYdI9fsmbaRipHNWRIU/2YGvlh4rg=
github.com/google/go-github/v67 v67.0.0/go.mod h1:zH3K7BxjFndr9QSeFibx4lTKkYS3K9nDanoI1NjaOtY=
github.com/google/go-github/v63 v63.0.0 h1:13xwK/wk9alSokujB9lJkuzdmQuVn2QCPeck76wR3nE=
github.com/google/go-github/v63 v63.0.0/go.mod h1:IqbcrgUmIcEaioWrGYei/09o+ge5vhffGOcxrO0AfmA=
github.com/google/go-querystring v1.1.0 h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=
github.com/google/go-querystring v1.1.0/go.mod h1:Kcdr2DB4koayq7X8pmAG4sNG59So17icRSOU623lUBU=
github.com/natefinch/atomic v1.0.1 h1:ZPYKxkqQOx3KZ+RsbnP/YsgvxWQPGxjC0oBt2AhwV0A=
Expand Down
10 changes: 1 addition & 9 deletions tools/internal/github/pr.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"os"
"time"

"github.com/google/go-github/v67/github"
"github.com/google/go-github/v63/github"
)

// Client is a GitHub API client that performs PSL-specific
Expand Down Expand Up @@ -185,11 +185,3 @@ func (c *Repo) PSLForHash(ctx context.Context, hash string) ([]byte, error) {
}
return []byte(ret), nil
}

func (c *Repo) LabelPullRequest(ctx context.Context, prNum int, labels []string) error {
ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
defer cancel()

_, _, err := c.apiClient().Issues.ReplaceLabelsForIssue(ctx, c.owner(), c.repo(), prNum, labels)
return err
}
100 changes: 0 additions & 100 deletions tools/psltool/errors.go

This file was deleted.

8 changes: 1 addition & 7 deletions tools/psltool/psltool.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,13 +258,7 @@ func runCheckPR(env *command.Env, prStr string) error {

clean := after.MarshalPSL()
if !bytes.Equal(withPR, clean) {
errs = append(errs, ErrReformat)
}

// Label the PR base on our errors
labels := errorsToLabels(errs)
if err := client.LabelPullRequest(env.Context(), pr, labels); err != nil {
return fmt.Errorf("failed to set labels on PR: %w", err)
errs = append(errs, errors.New("file needs reformatting, run 'psltool fmt' to fix"))
}

// Print the blocks marked changed, so a human can check that
Expand Down

0 comments on commit 3bf13d1

Please sign in to comment.