mirror of
https://github.com/ipfs/awesome-ipfs.git
synced 2024-12-26 15:59:33 -05:00
Merge pull request #1 from SgtPooki/feature/add-danger
feat: use danger to post awesome_bot results on PRs
This commit is contained in:
commit
d989cd951b
21
.github/workflows/pull_requests.yml
vendored
21
.github/workflows/pull_requests.yml
vendored
@ -30,3 +30,24 @@ jobs:
|
||||
uses: ad-m/github-push-action@v0.6.0
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
run-danger:
|
||||
runs-on: ubuntu-latest
|
||||
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 13
|
||||
- name: Set up Ruby 3.1.2
|
||||
- uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 3.1.2
|
||||
- name: Install and run awesome_bot
|
||||
# It's okay for awesome_bot to fail. Danger will post a comment on the PR if it fails.
|
||||
run: |
|
||||
gem install awesome_bot
|
||||
awesome_bot --allow 429 --allow-redirect --allow-dupe --allow-ssl -w ipfs.io README.md || echo
|
||||
- name: Run danger
|
||||
run: npx --yes danger ci
|
||||
env:
|
||||
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
33
dangerfile.js
Normal file
33
dangerfile.js
Normal file
@ -0,0 +1,33 @@
|
||||
const { danger, markdown, fail, warn, message } = require('danger')
|
||||
const awesomeBotResults = require('./ab-results-README.md-markdown-table.json')
|
||||
|
||||
// declare const danger: DangerDSLType
|
||||
// declare function warn(message: string, file?: string, line?: number): void
|
||||
// declare function fail(params: string): void
|
||||
// declare function message(message: string): void
|
||||
|
||||
// This is a simple example of a Dangerfile.
|
||||
// You can run this Dangerfile via `danger pr
|
||||
|
||||
const docs = danger.git.fileMatch('**/*.md')
|
||||
const app = danger.git.fileMatch('src/**/*.ts')
|
||||
const tests = danger.git.fileMatch('*/__tests__/*')
|
||||
const yamlData = danger.git.fileMatch('data/**')
|
||||
// const awesome_bot = danger.git.fileMatch('ab-results-README.md-markdown-table.json')
|
||||
|
||||
if (awesomeBotResults.error) {
|
||||
fail(awesomeBotResults.title)
|
||||
markdown(awesomeBotResults.message)
|
||||
}
|
||||
|
||||
if (yamlData.edited) {
|
||||
message('YAML data files were edited')
|
||||
}
|
||||
|
||||
if (docs.edited) {
|
||||
message('Thanks - We :heart: our [documentarians](http://www.writethedocs.org/)!')
|
||||
}
|
||||
|
||||
if (app.modified && !tests.modified) {
|
||||
warn('You have app changes without tests.')
|
||||
}
|
Loading…
Reference in New Issue
Block a user