Skip to content

Commit c87d6df

Browse files
authored
Merge pull request #1 from coursedog/update-notion-github-action
feat: adds GitHub action to update notion
2 parents 0a4f9d8 + ad4e12e commit c87d6df

File tree

10 files changed

+2224
-0
lines changed

10 files changed

+2224
-0
lines changed

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true

.eslintrc.js

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
module.exports = {
2+
env: {
3+
browser: true,
4+
commonjs: true,
5+
es2021: true,
6+
},
7+
extends: 'eslint:recommended',
8+
parserOptions: {
9+
ecmaVersion: 13,
10+
},
11+
globals: {
12+
process: 'readonly',
13+
},
14+
rules: {
15+
'no-extend-native': [ 'error', { exceptions: [ 'Array' ] } ],
16+
'no-global-assign': [ 'error', { exceptions: [ 'self' ] } ],
17+
'generator-star-spacing': 'off',
18+
// eslint-disable-next-line no-undef
19+
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
20+
'no-trailing-spaces': [ 'error', { skipBlankLines: true } ],
21+
'array-bracket-spacing': [ 'error', 'always' ],
22+
'arrow-body-style': [ 'warn', 'as-needed' ],
23+
'standard/no-callback-literal': 0,
24+
'comma-dangle': [
25+
'warn',
26+
{
27+
arrays: 'always-multiline',
28+
objects: 'always-multiline',
29+
imports: 'never',
30+
exports: 'never',
31+
functions: 'ignore',
32+
},
33+
],
34+
'curly': [ 'warn', 'multi-line' ],
35+
'eol-last': [ 'error', 'always' ],
36+
'indent': [ 'error', 2, { SwitchCase: 1, VariableDeclarator: 1 } ],
37+
'max-len': [
38+
'warn',
39+
{
40+
code: 140,
41+
ignoreComments: true,
42+
ignoreTrailingComments: true,
43+
ignoreStrings: true,
44+
ignorePattern: '.+=".+"',
45+
},
46+
],
47+
'no-multiple-empty-lines': [ 'error', { max: 1, maxEOF: 1 } ],
48+
'no-prototype-builtins': 0,
49+
'object-curly-spacing': [ 'error', 'always' ],
50+
'object-property-newline': [ 'error', { allowAllPropertiesOnSameLine: true } ],
51+
'padded-blocks': 'off',
52+
'prefer-const': [ 'error', { destructuring : 'all' } ],
53+
'prefer-template': 'error',
54+
'quote-props': [ 'error', 'consistent-as-needed' ],
55+
'quotes': [
56+
'error',
57+
'single',
58+
{
59+
avoidEscape: true,
60+
// TODO: Remove this rule and autofix,
61+
// as we don't need useless template literals
62+
allowTemplateLiterals: true,
63+
},
64+
],
65+
'semi': [ 'error', 'never', { beforeStatementContinuationChars: 'never' } ],
66+
'space-before-function-paren': [ 'warn', 'always' ],
67+
'spaced-comment': [
68+
'error',
69+
'always',
70+
{
71+
block: {
72+
markers: [ '!' ],
73+
},
74+
},
75+
],
76+
},
77+
}

.github/workflows/eslint.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# This is a basic workflow to help you get started with Actions
2+
name: Lint
3+
4+
# Controls when the action will run. Triggers the workflow on push or pull request
5+
# events but on dev and staging branches
6+
on:
7+
pull_request:
8+
branches:
9+
- main
10+
- 'feature/**'
11+
- 'features/**'
12+
push:
13+
branches:
14+
- main
15+
16+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
17+
jobs:
18+
prepare:
19+
name: Prepare & Cleanup Previous Runs
20+
if: always()
21+
runs-on: ubuntu-latest
22+
outputs:
23+
commit_message: ${{ steps.get_message.outputs.commit_message }}
24+
25+
steps:
26+
- uses: actions/checkout@v1
27+
- uses: rokroskar/workflow-run-cleanup-action@v0.2.2
28+
env:
29+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
30+
- id: get_message
31+
name: Set Commit Message
32+
run: echo ::set-output name=commit_message::$(git log --format=%B -n 1 ${{ github.event.after }})
33+
- name: Show Commit Message
34+
run: echo "${{ steps.get_message.outputs.commit_message }}"
35+
36+
lint-and-units:
37+
name: ESLint
38+
needs: prepare
39+
timeout-minutes: 45
40+
if: (github.event.pull_request.draft == false) && !startsWith(github.head_ref, 'tech') && !startsWith(github.head_ref, 'doc') && !contains(needs.prepare.outputs.commit_message, '[skip ci]')
41+
# The type of runner that the job will run on
42+
runs-on: ubuntu-18.04
43+
steps:
44+
- name: Show Commit Message
45+
run: echo "${{ needs.prepare.outputs.commit_message }}"
46+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
47+
- uses: actions/checkout@v2
48+
- name: Use Node.js
49+
uses: actions/setup-node@v1
50+
with:
51+
node-version: '16.x'
52+
- name: Run ESLint
53+
if: always()
54+
run: npm run lint
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Update Notion Statuses
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- dev
8+
- staging
9+
10+
jobs:
11+
notion_update_job:
12+
runs-on: ubuntu-latest
13+
name: Update Notion Task
14+
steps:
15+
# To use this repository's private action,
16+
# you must check out the repository
17+
- name: Checkout
18+
uses: actions/checkout@v2
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v1
22+
with:
23+
node-version: '16.x'
24+
- run: npm ci
25+
26+
- name: Update Notion Task
27+
uses: ./update_notion # Uses an action in the root directory
28+
id: update_notion
29+
with:
30+
NOTION_API_KEY: ${{ secrets.NOTION_API_KEY }}
31+
NOTION_DATABASE_TOKEN: ${{ secrets.NOTION_DATABASE_TOKEN }}

.gitignore

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
.pnpm-debug.log*
9+
10+
# Diagnostic reports (https://nodejs.org/api/report.html)
11+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
12+
13+
# Runtime data
14+
pids
15+
*.pid
16+
*.seed
17+
*.pid.lock
18+
19+
# Directory for instrumented libs generated by jscoverage/JSCover
20+
lib-cov
21+
22+
# Coverage directory used by tools like istanbul
23+
coverage
24+
*.lcov
25+
26+
# nyc test coverage
27+
.nyc_output
28+
29+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
30+
.grunt
31+
32+
# Bower dependency directory (https://bower.io/)
33+
bower_components
34+
35+
# node-waf configuration
36+
.lock-wscript
37+
38+
# Compiled binary addons (https://nodejs.org/api/addons.html)
39+
build/Release
40+
41+
# Dependency directories
42+
node_modules/
43+
jspm_packages/
44+
45+
# Snowpack dependency directory (https://snowpack.dev/)
46+
web_modules/
47+
48+
# TypeScript cache
49+
*.tsbuildinfo
50+
51+
# Optional npm cache directory
52+
.npm
53+
54+
# Optional eslint cache
55+
.eslintcache
56+
57+
# Optional stylelint cache
58+
.stylelintcache
59+
60+
# Microbundle cache
61+
.rpt2_cache/
62+
.rts2_cache_cjs/
63+
.rts2_cache_es/
64+
.rts2_cache_umd/
65+
66+
# Optional REPL history
67+
.node_repl_history
68+
69+
# Output of 'npm pack'
70+
*.tgz
71+
72+
# Yarn Integrity file
73+
.yarn-integrity
74+
75+
# dotenv environment variables file
76+
.env.development.local
77+
.env.test.local
78+
.env.production.local
79+
.env.local
80+
81+
# parcel-bundler cache (https://parceljs.org/)
82+
.cache
83+
.parcel-cache
84+
85+
# Next.js build output
86+
.next
87+
out
88+
89+
# Nuxt.js build / generate output
90+
.nuxt
91+
dist
92+
93+
# Gatsby files
94+
.cache/
95+
# Comment in the public line in if your project uses Gatsby and not Next.js
96+
# https://nextjs.org/blog/next-9-1#public-directory-support
97+
# public
98+
99+
# vuepress build output
100+
.vuepress/dist
101+
102+
# vuepress v2.x temp and cache directory
103+
.temp
104+
.cache
105+
106+
# Serverless directories
107+
.serverless/
108+
109+
# FuseBox cache
110+
.fusebox/
111+
112+
# DynamoDB Local files
113+
.dynamodb/
114+
115+
# TernJS port file
116+
.tern-port
117+
118+
# Stores VSCode versions used for testing VSCode extensions
119+
.vscode-test
120+
121+
# yarn v2
122+
.yarn/cache
123+
.yarn/unplugged
124+
.yarn/build-state.yml
125+
.yarn/install-state.gz
126+
.pnp.*

0 commit comments

Comments
 (0)