Skip to content

Commit

Permalink
Add GitHub Actions nodejs file
Browse files Browse the repository at this point in the history
  • Loading branch information
adriaandotcom committed Mar 20, 2021
1 parent 021d509 commit 9909fb5
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Node CI Main

on:
pull_request:
types: [opened, synchronize]
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- uses: actions/setup-node@v2
with:
node-version: "14"

- uses: actions/checkout@v2
if: github.event_name == 'pull_request'
with:
ref: ${{ github.head_ref }}

- uses: actions/checkout@v2
if: github.ref == 'refs/heads/master'

- name: Prettier Action on PR
if: github.event_name == 'pull_request'
uses: creyD/prettier_action@v3.0
with:
prettier_version: ^2.1.1
commit_message: "Run prettier via GitHub Action"
file_pattern: "."
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Prettier Action on main
if: github.ref == 'refs/heads/main'
uses: creyD/prettier_action@v3.0
with:
prettier_version: ^2.1.1
commit_message: "Run prettier via GitHub Action"
file_pattern: "."
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: harmon758/postgresql-action@v1
with:
postgresql version: "latest"

- name: npm install, and test
run: |
npm install
npm test
env:
CI: true
NODE_ENV: test
PG_CONNECTION_STRING: "postgres://postgres@localhost"

0 comments on commit 9909fb5

Please sign in to comment.