Skip to content

feat: adds GitHub action to update notion #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Dec 8, 2021
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
77 changes: 77 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
module.exports = {
env: {
browser: true,
commonjs: true,
es2021: true,
},
extends: 'eslint:recommended',
parserOptions: {
ecmaVersion: 13,
},
globals: {
process: 'readonly',
},
rules: {
'no-extend-native': [ 'error', { exceptions: [ 'Array' ] } ],
'no-global-assign': [ 'error', { exceptions: [ 'self' ] } ],
'generator-star-spacing': 'off',
// eslint-disable-next-line no-undef
'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off',
'no-trailing-spaces': [ 'error', { skipBlankLines: true } ],
'array-bracket-spacing': [ 'error', 'always' ],
'arrow-body-style': [ 'warn', 'as-needed' ],
'standard/no-callback-literal': 0,
'comma-dangle': [
'warn',
{
arrays: 'always-multiline',
objects: 'always-multiline',
imports: 'never',
exports: 'never',
functions: 'ignore',
},
],
'curly': [ 'warn', 'multi-line' ],
'eol-last': [ 'error', 'always' ],
'indent': [ 'error', 2, { SwitchCase: 1, VariableDeclarator: 1 } ],
'max-len': [
'warn',
{
code: 140,
ignoreComments: true,
ignoreTrailingComments: true,
ignoreStrings: true,
ignorePattern: '.+=".+"',
},
],
'no-multiple-empty-lines': [ 'error', { max: 1, maxEOF: 1 } ],
'no-prototype-builtins': 0,
'object-curly-spacing': [ 'error', 'always' ],
'object-property-newline': [ 'error', { allowAllPropertiesOnSameLine: true } ],
'padded-blocks': 'off',
'prefer-const': [ 'error', { destructuring : 'all' } ],
'prefer-template': 'error',
'quote-props': [ 'error', 'consistent-as-needed' ],
'quotes': [
'error',
'single',
{
avoidEscape: true,
// TODO: Remove this rule and autofix,
// as we don't need useless template literals
allowTemplateLiterals: true,
},
],
'semi': [ 'error', 'never', { beforeStatementContinuationChars: 'never' } ],
'space-before-function-paren': [ 'warn', 'always' ],
'spaced-comment': [
'error',
'always',
{
block: {
markers: [ '!' ],
},
},
],
},
}
54 changes: 54 additions & 0 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# This is a basic workflow to help you get started with Actions
name: Lint

# Controls when the action will run. Triggers the workflow on push or pull request
# events but on dev and staging branches
on:
pull_request:
branches:
- main
- 'feature/**'
- 'features/**'
push:
branches:
- main

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
prepare:
name: Prepare & Cleanup Previous Runs
if: always()
runs-on: ubuntu-latest
outputs:
commit_message: ${{ steps.get_message.outputs.commit_message }}

steps:
- uses: actions/checkout@v1
- uses: rokroskar/[email protected]
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- id: get_message
name: Set Commit Message
run: echo ::set-output name=commit_message::$(git log --format=%B -n 1 ${{ github.event.after }})
- name: Show Commit Message
run: echo "${{ steps.get_message.outputs.commit_message }}"

lint-and-units:
name: ESLint
needs: prepare
timeout-minutes: 45
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]')
# The type of runner that the job will run on
runs-on: ubuntu-18.04
steps:
- name: Show Commit Message
run: echo "${{ needs.prepare.outputs.commit_message }}"
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v1
with:
node-version: '16.x'
- name: Run ESLint
if: always()
run: npm run lint
31 changes: 31 additions & 0 deletions .github/workflows/notion_update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Update Notion Statuses

on:
push:
branches:
- main
- dev
- staging

jobs:
notion_update_job:
runs-on: ubuntu-latest
name: Update Notion Task
steps:
# To use this repository's private action,
# you must check out the repository
- name: Checkout
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: '16.x'
- run: npm ci

- name: Update Notion Task
uses: ./update_notion # Uses an action in the root directory
id: update_notion
with:
NOTION_API_KEY: ${{ secrets.NOTION_API_KEY }}
NOTION_DATABASE_TOKEN: ${{ secrets.NOTION_DATABASE_TOKEN }}
126 changes: 126 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# Logs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lot's of defaults there. :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah just copied the default node.js .gitignore. 😅 . Shall I revert it back to a trimmed down minimal gitignore?

logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
Loading