mirror of
https://github.com/ipfs/awesome-ipfs.git
synced 2025-01-28 23:37:09 -05:00
Merge pull request #2 from SgtPooki/feature/pr-test
chore: ensure PRs are handled appropriately
This commit is contained in:
commit
81ee8dbe5c
39
.github/workflows/pull_requests.yml
vendored
39
.github/workflows/pull_requests.yml
vendored
@ -1,5 +1,5 @@
|
||||
|
||||
name: Update README.md when PR is opened, reopened, or on sync
|
||||
name: Pull request workflow
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
@ -7,20 +7,44 @@ on:
|
||||
branches: [ master, main ]
|
||||
|
||||
jobs:
|
||||
# Run linting and tests
|
||||
build-and-lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 13
|
||||
- uses: ipfs/aegir/actions/cache-node-modules@master
|
||||
with:
|
||||
directories: |
|
||||
README.md
|
||||
build: |
|
||||
npm run build:readme
|
||||
cache_name: readme
|
||||
# aegir/actions/cache-node-modules runs build. We don't need to run it again.
|
||||
- run: npm run lint
|
||||
|
||||
update-readme:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build-and-lint
|
||||
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 13
|
||||
- name: Build the readme
|
||||
run: |
|
||||
npm install
|
||||
npm run build:readme
|
||||
- uses: ipfs/aegir/actions/cache-node-modules@master
|
||||
with:
|
||||
directories: |
|
||||
README.md
|
||||
build: |
|
||||
npm run build:readme
|
||||
cache_name: readme
|
||||
- name: Commit updates to README.md
|
||||
run: |
|
||||
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
@ -31,13 +55,18 @@ jobs:
|
||||
if: success()
|
||||
uses: ad-m/github-push-action@v0.6.0
|
||||
with:
|
||||
branch: ${{ github.event.pull_request.head.ref }}
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
run-danger:
|
||||
runs-on: ubuntu-latest
|
||||
needs: update-readme
|
||||
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
|
@ -1,33 +1,30 @@
|
||||
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 githubMetadata = danger.git.fileMatch('.github/**')
|
||||
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) {
|
||||
fail(awesomeBotResults.title)
|
||||
markdown(awesomeBotResults.message)
|
||||
if (githubMetadata.edited) {
|
||||
message('Changes were made within the .github folder.')
|
||||
}
|
||||
|
||||
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) {
|
||||
message('Thanks - We :heart: our [documentarians](http://www.writethedocs.org/)!')
|
||||
if (scripts.edited) {
|
||||
warn('Changes were made to the scripts folder.')
|
||||
}
|
||||
|
||||
if (app.modified && !tests.modified) {
|
||||
warn('You have app changes without tests.')
|
||||
if (src.edited) {
|
||||
warn('Changes were made to the src folder.')
|
||||
}
|
||||
|
11831
package-lock.json
generated
11831
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -25,6 +25,7 @@
|
||||
"browserify": "^16.3.0",
|
||||
"chokidar": "^3.0.2",
|
||||
"cssnano": "^4.1.10",
|
||||
"danger": "^11.1.2",
|
||||
"ecstatic": "^4.1.2",
|
||||
"fs-extra": "^8.1.0",
|
||||
"hugo-bin": "^0.43.6",
|
||||
|
Loading…
x
Reference in New Issue
Block a user