Skip to content

Commit

Permalink
ci: add dangerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
darioblanco committed May 23, 2022
1 parent dfecb2a commit 9901223
Show file tree
Hide file tree
Showing 12 changed files with 8,216 additions and 4,033 deletions.
6 changes: 6 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ module.exports = {
project: './tsconfig.eslint.json',
},
rules: {
'prettier/prettier': [
'error',
{
endOfLine: 'auto',
},
],
'unicorn/prefer-module': 'off',
},
};
39 changes: 39 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: PR
on:
pull_request:
types:
- opened
- edited
- ready_for_review
- reopened
- synchronize
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: 18.0.0
- name: Checkout current git repository
uses: actions/checkout@v2
- name: Install yarn dependencies
run: yarn install --immutable
- name: Run Danger
run: yarn danger ci
env:
GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN_OPEN_SOURCE }}
label:
runs-on: ubuntu-latest
steps:
- name: Label PR based on branch name
if: github.event.action == 'opened'
uses: ffittschen/pr-branch-labeler@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Label PR based on pushed file paths
uses: actions/labeler@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
configuration-path: .github/pr-path-labeler.yml
sync-labels: false
16 changes: 16 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,18 @@ on:
version:
description: The version to publish
required: true
env:
BOT_EMAIL: [email protected]
BOT_NAME: parcellab-dev-bot
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout current git repository
uses: actions/checkout@v2
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of REPO_ACCESS_TOKEN_OPEN_SOURCE.
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
- name: Install yarn dependencies
run: yarn install --immutable
- name: Use Node.js
Expand Down Expand Up @@ -42,6 +48,16 @@ jobs:
with:
cmd: |
yq e '.version = "${{ steps.load_version.outputs.version }}"' -i package.json -j
- name: Commit new package.json version
run: |
git config --global user.email "${{ env.BOT_EMAIL }}"
git config --global user.name "${{ env.BOT_NAME }}"
git commit -m "chore: set version ${{ steps.load_version.outputs.version }} [skip ci]" -a
- name: Push changes to current git repository
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.REPO_ACCESS_TOKEN_OPEN_SOURCE }}
branch: main
- name: Publish NPM package
uses: JS-DevTools/npm-publish@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ jobs:
uses: darioblanco/release-wizard@main
with:
draft: true
token: ${{ github.token }}
token: ${{ secrets.REPO_ACCESS_TOKEN }}
withV: true
pushTag: false
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"arcanis.vscode-zipfs",
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode"
]
}
13 changes: 13 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"search.exclude": {
"**/.yarn": true,
"**/.pnp.*": true
},
"editor.codeActionsOnSave": {
"source.fixAll": true,
"source.fixAll.eslint": true
},
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"typescript.enablePromptUseWorkspaceTsdk": true
}
Binary file added .yarn/install-state.gz
Binary file not shown.
780 changes: 780 additions & 0 deletions .yarn/releases/yarn-4.0.0-rc.6.cjs

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.0.0-rc.6.cjs
12 changes: 12 additions & 0 deletions dangerfile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import parcellab from '@parcellab/danger-plugin';

// eslint-disable-next-line @typescript-eslint/no-floating-promises
(async function dangerReport() {
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
await parcellab({
branchSize: {
maxCommits: 20,
maxFiles: 20,
},
});
})();
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,12 @@
"url": "https://github.com/parcelLab/eslint-config.git"
},
"devDependencies": {
"@parcellab/danger-plugin": "^0.0.9",
"@types/eslint": "^8.4.2",
"@types/jest": "^27.5.0",
"@typescript-eslint/eslint-plugin": "^5.23.0",
"child_process": "^1.0.2",
"danger": "^11.0.7",
"eslint": "^8.15.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
Expand All @@ -57,8 +59,8 @@
"eslint-plugin-testing-library": "^5.5.0",
"eslint-plugin-unicorn": "^42.0.0",
"husky": "^8.0.1",
"lint-staged": "^12.4.1",
"jest": "^28.1.0",
"lint-staged": "^12.4.1",
"prettier": "^2.6.2",
"pretty-quick": "^3.1.3",
"ts-jest": "^28.0.2",
Expand Down Expand Up @@ -102,16 +104,15 @@
"eslint-plugin-react": {
"optional": true
},
"eslint-plugin-storybook": {
"eslint-plugin-react-hooks": {
"optional": true
},
"eslint-plugin-testing-library": {
"eslint-plugin-storybook": {
"optional": true
},
"eslint-plugin-react-hooks": {
"eslint-plugin-testing-library": {
"optional": true
}

},
"scripts": {
"clean": "rimraf --no-glob ./dist ./coverage ./tsconfig.tsbuildinfo ./.eslintcache",
Expand All @@ -122,5 +123,6 @@
"typecheck": "tsc --project tsconfig.json --noEmit"
},
"author": "[email protected]",
"license": "MIT"
"license": "MIT",
"packageManager": "[email protected]"
}
Loading

0 comments on commit 9901223

Please sign in to comment.