|
3 | 3 | pull_request_target: |
4 | 4 | types: [assigned, opened, synchronize, reopened] |
5 | 5 | jobs: |
6 | | - golangci: |
7 | | - name: lint |
| 6 | + # This workflow closes invalid PR |
| 7 | + close-pr: |
| 8 | + name: closepr |
| 9 | + # The type of runner that the job will run on |
8 | 10 | runs-on: ubuntu-latest |
9 | | - steps: |
10 | | - - name: Set up Go |
11 | | - uses: actions/setup-go@master |
12 | | - with: |
13 | | - go-version: '1.20' |
14 | | - |
15 | | - - name: Check out code into the Go module directory |
16 | | - uses: actions/checkout@v4 |
17 | | - with: |
18 | | - ref: ${{ github.event.pull_request.head.sha }} |
19 | | - |
20 | | - - name: Tidy Modules |
21 | | - run: go mod tidy |
| 11 | + permissions: write-all |
22 | 12 |
|
23 | | - - name: golangci-lint |
24 | | - uses: golangci/golangci-lint-action@master |
| 13 | + # Steps represent a sequence of tasks that will be executed as part of the job |
| 14 | + steps: |
| 15 | + - name: Close PR if commit message contains ".go" |
| 16 | + if: contains(github.event.pull_request.title, '.go') |
| 17 | + uses: superbrothers/close-pull-request@v3 |
25 | 18 | with: |
26 | | - # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version |
27 | | - version: latest |
28 | | - |
29 | | - # Optional: working directory, useful for monorepos |
30 | | - # working-directory: somedir |
31 | | - |
32 | | - # Optional: golangci-lint command line arguments. |
33 | | - # args: --issues-exit-code=0 |
| 19 | + # Optional. Post a issue comment just before closing a pull request. |
| 20 | + comment: "非法PR. 请`fork`后修改自己的仓库, 而不是向主仓库提交更改. 如果您确信您的PR是为了给主仓库新增功能或修复bug, 请更改默认PR标题. **注意**: 如果您再次触发本提示, 则有可能导致账号被封禁." |
34 | 21 |
|
35 | | - # Optional: show only new issues if it's a pull request. The default value is `false`. |
36 | | - # only-new-issues: true |
37 | | - |
38 | | - # Optional: if set to true then the action don't cache or restore ~/go/pkg. |
39 | | - # skip-pkg-cache: true |
40 | | - |
41 | | - # Optional: if set to true then the action don't cache or restore ~/.cache/go-build. |
42 | | - # skip-build-cache: true |
| 22 | + golangci: |
| 23 | + needs: close-pr |
| 24 | + if: ${{ !contains(github.event.pull_request.title, '.go') }} |
| 25 | + uses: ./.github/workflows/lib_lint.yml |
| 26 | + with: |
| 27 | + ref: ${{ github.event.pull_request.head.sha }} |
| 28 | + commit_back: false |
| 29 | + |
| 30 | + runmain: |
| 31 | + needs: golangci |
| 32 | + if: ${{ !contains(github.event.pull_request.title, '.go') }} |
| 33 | + uses: ./.github/workflows/lib_run.yml |
| 34 | + with: |
| 35 | + ref: ${{ github.event.pull_request.head.sha }} |
0 commit comments