mirror of
https://github.com/ipfs/awesome-ipfs.git
synced 2024-11-20 11:28:35 -05:00
chore: modify dangerfile and workflow ordering
This commit is contained in:
parent
edf42873af
commit
ad73266f50
2 changed files with 20 additions and 20 deletions
3
.github/workflows/pull_requests.yml
vendored
3
.github/workflows/pull_requests.yml
vendored
|
@ -37,10 +37,13 @@ jobs:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run-danger:
|
run-danger:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
needs: update-readme
|
||||||
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
ref: ${{ github.event.pull_request.head.ref }}
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
|
|
|
@ -1,33 +1,30 @@
|
||||||
const { danger, markdown, fail, warn, message } = require('danger')
|
const { danger, markdown, fail, warn, message } = require('danger')
|
||||||
const awesomeBotResults = require('./ab-results-README.md-markdown-table.json')
|
const awesomeBotResults = require('./ab-results-README.md-markdown-table.json')
|
||||||
|
|
||||||
// declare const danger: DangerDSLType
|
const githubMetadata = danger.git.fileMatch('.github/**')
|
||||||
// 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 yamlData = danger.git.fileMatch('data/**')
|
||||||
// const awesome_bot = danger.git.fileMatch('ab-results-README.md-markdown-table.json')
|
const scripts = danger.git.fileMatch('scripts/**')
|
||||||
|
const src = danger.git.fileMatch('src/**')
|
||||||
|
|
||||||
if (awesomeBotResults.error) {
|
if (githubMetadata.edited) {
|
||||||
fail(awesomeBotResults.title)
|
message('Changes were made within the .github folder.')
|
||||||
markdown(awesomeBotResults.message)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (yamlData.edited) {
|
if (yamlData.edited) {
|
||||||
message('YAML data files were edited')
|
message('YAML data files were edited.')
|
||||||
|
/**
|
||||||
|
* Only display awesomeBot results if the data yaml used to generate the readme have been modified.
|
||||||
|
*/
|
||||||
|
if (awesomeBotResults.error) {
|
||||||
|
fail(awesomeBotResults.title)
|
||||||
|
markdown(awesomeBotResults.message)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (docs.edited) {
|
if (scripts.edited) {
|
||||||
message('Thanks - We :heart: our [documentarians](http://www.writethedocs.org/)!')
|
warn('Changes were made to the scripts folder.')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (app.modified && !tests.modified) {
|
if (src.edited) {
|
||||||
warn('You have app changes without tests.')
|
warn('Changes were made to the src folder.')
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue