diff --git a/.github/workflows/psltool_pr_check.yml b/.github/workflows/psltool_pr_check.yml index 276e3a0478..dba08ac39f 100644 --- a/.github/workflows/psltool_pr_check.yml +++ b/.github/workflows/psltool_pr_check.yml @@ -3,7 +3,9 @@ name: psltool PR check on: pull_request: -permissions: {} +permissions: + pull-requests: write + issues: write jobs: validate: @@ -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 }} diff --git a/public_suffix_list.dat b/public_suffix_list.dat index 54dcc4a511..933e870c86 100644 --- a/public_suffix_list.dat +++ b/public_suffix_list.dat @@ -14885,6 +14885,10 @@ io.noc.ruhr-uni-bochum.de спб.рус я.рус +// Sakura Frp : https://www.natfrp.com +// Submitted by Bobo Liu +example.com + // Russian Academy of Sciences // Submitted by Tech Support ras.ru diff --git a/tools/internal/github/pr.go b/tools/internal/github/pr.go index ad16706f52..5bbd53ea43 100644 --- a/tools/internal/github/pr.go +++ b/tools/internal/github/pr.go @@ -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 diff --git a/tools/psltool/psltool.go b/tools/psltool/psltool.go index b859e3c0be..f036f22d38 100644 --- a/tools/psltool/psltool.go +++ b/tools/psltool/psltool.go @@ -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