Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test fine PR #3

Closed
wants to merge 8 commits into from
Closed
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
8 changes: 6 additions & 2 deletions .github/workflows/psltool_pr_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ name: psltool PR check
on:
pull_request:

permissions: {}
permissions:
pull-requests: write
issues: write

jobs:
validate:
Expand All @@ -17,4 +19,6 @@ jobs:
- name: run validations
run: |
cd tools
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 }}
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 }}
4 changes: 4 additions & 0 deletions public_suffix_list.dat
Original file line number Diff line number Diff line change
Expand Up @@ -14885,6 +14885,10 @@ io.noc.ruhr-uni-bochum.de
спб.рус
я.рус

// Sakura Frp : https://www.natfrp.com
// Submitted by Bobo Liu <[email protected]>
example.com

// Russian Academy of Sciences
// Submitted by Tech Support <[email protected]>
ras.ru
Expand Down
3 changes: 3 additions & 0 deletions tools/internal/github/pr.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ func (c *Repo) apiClient() *github.Client {
if c.client == nil {
c.client = github.NewClient(nil)
if token := os.Getenv("GITHUB_TOKEN"); token != "" {
fmt.Println("using token")
c.client = c.client.WithAuthToken(token)
} else {
fmt.Println("no token set")
}
}
return c.client
Expand Down
10 changes: 4 additions & 6 deletions tools/psltool/psltool.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,12 +261,10 @@ func runCheckPR(env *command.Env, prStr string) error {
errs = append(errs, ErrReformat)
}

// Label the PR base on our errors
if len(errs) > 0 {
labels := errorsToLabels(errs)
if err := client.LabelPullRequest(env.Context(), pr, labels); err != nil {
return fmt.Errorf("failed to set labels on PR: %w", err)
}
// Label the PR base on our errors, i hate github forks
labels := errorsToLabels(errs)
if err := client.LabelPullRequest(env.Context(), pr, labels); err != nil {
return fmt.Errorf("failed to set labels on PR: %w", err)
}

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