把 download 加入 robots.txt 防止爬虫往死里爬 #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check Pull Request | |
on: | |
pull_request: | |
# | |
jobs: | |
request: | |
permissions: | |
issues: write | |
pull-requests: write | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Action Checkout | |
uses: actions/checkout@v3 | |
- | |
name: Setup Golang | |
uses: actions/setup-go@v4 | |
with: | |
go-version-file: ./go.mod | |
cache-dependency-path: ./go.sum | |
- | |
name: Go Generate | |
run: go generate . | |
- | |
name: Go Format | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const child_process = require('child_process') | |
const patch = await new Promise((resolve, reject) => child_process.exec('gofmt -d .', (error, stdout, stderr) => { | |
if (stderr) { | |
console.error(stderr) | |
} | |
if (error) { | |
reject(error) | |
return | |
} | |
resolve(stdout) | |
})) | |
if (patch) { | |
await github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: "<details><summary><h2>Change for better format</h2></summary>\n\n````````diff\n" + patch + "\n````````\n\n</details>", | |
}) | |
} | |
- | |
name: Go Vet | |
run: go vet ./... | |
- | |
name: Go Test | |
run: go test -v ./... |