Skip to content

Commit

Permalink
Add GitHub workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfbecker committed Sep 29, 2021
1 parent 5f82659 commit c364bc5
Show file tree
Hide file tree
Showing 5 changed files with 136 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/build-handbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build

on:
- push

jobs:
geojson:
name: Teammate locations file is valid
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- name: install geojsonhint
run: yarn add @mapbox/[email protected]
- name: geojsonhint
run: node_modules/.bin/geojsonhint < ./handbook/company/team/locations.geojson
# Put everything under one job to not clutter the GitHub status checks list.
handbook:
runs-on: ubuntu-latest
name: Handbook builds correctly
steps:
- uses: actions/checkout@v2

# set up correct version of node
- id: nvmrc
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc)
- uses: actions/setup-node@v2
with:
node-version: '${{ steps.nvmrc.outputs.NODE_VERSION }}'

- run: yarn
name: Install dependencies
- run: yarn typecheck
name: Type-check code with TypeScript compiler
- run: yarn eslint
name: Lint code with ESLint
- run: yarn build
name: Build handbook with NextJS
17 changes: 17 additions & 0 deletions .github/workflows/codenotify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Codenotify

on:
pull_request_target:
types: [opened, synchronize, ready_for_review]

jobs:
codenotify:
runs-on: ubuntu-latest
name: Notify teammates listed in CODENOTIFY files of the changes
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: sourcegraph/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.CODENOTIFY_GITHUB_TOKEN }}
47 changes: 47 additions & 0 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Prettier

# This action works with pull requests and pushes
on:
- push

jobs:
prettier:
runs-on: ubuntu-latest
name: Format all files nicely
steps:
- name: Checkout
uses: actions/checkout@v2
with:
# Make sure the actual branch is checked out when running on pull requests
ref: ${{ github.head_ref }}
persist-credentials: false

# Set up correct version of node from .nvmrc (upgraded by Renovate)
- name: Read .nvmrc
id: nvmrc
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc)

- uses: actions/setup-node@v2
with:
node-version: '${{ steps.nvmrc.outputs.NODE_VERSION }}'
cache: yarn

# Make sure @sourcegraph/prettierrc is installed
- run: yarn

- name: Read prettier version
id: prettier_version
uses: notiz-dev/github-action-json-property@release
with:
path: package.json
prop_path: devDependencies.prettier

- name: Prettier
uses: creyD/[email protected]
with:
# Take prettier version from package.json to stay in sync and support upgrades through Renovate
prettier_version: ${{steps.prettier_version.outputs.prop}}
prettier_options: --write **/*.{js,css,scss,ts,tsx,md,html,yml,yaml,json}
commit_message: squash! Prettier
env:
GITHUB_TOKEN: ${{ secrets.PRETTIER_ACTION_GITHUB_TOKEN }}
33 changes: 33 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Stale pull requests

on:
schedule:
- cron: '30 0,6,12,18 * * 1-5'

jobs:
stale:
name: Notify authors or close stale pull requests
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v4
with:
days-before-pr-stale: 14
days-before-pr-close: 7
days-before-issue-close: -1
days-before-issue-stale: -1
stale-pr-label: stale
exempt-pr-labels: bot,pinned
operations-per-run: 60
stale-pr-message: |
Hey there! It looks like this pull request has been sitting for a long time. Keep in mind that when you make a pull request, the change doesn't actually go live until you **merge** the pull request. This needs to be done by you (the pull request author) as soon as you feel like you got the appropriate amount of review/approvals that make you confident with the change. For example: adding yourself to the team page doesn't require anyone's review and you can merge directly, while when proposing a change to your team's processes you'll probably want to get your team's review (and need to request review from your team explicitly, so they get notified).
Please see whether you want to **merge** this pull request, **close** it and discard the change, or **remind** the people you would like review from.
You can find more help on our [Editing the handbook](https://about.sourcegraph.com/handbook/editing) handbook page.
Thank you! \\(^-^)/
close-pr-message: |
Since there were no updates in the past 7 days, this pull request is being automatically closed.
If this is a mistake, you can simply click the **Reopen** button to reopen the pull request.
Thank you! \\(^-^)/
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"debug": "NODE_OPTIONS='--inspect' next dev",
"build": "next build",
"start": "next start",
"typecheck": "tsc -p .",
"prettier": "prettier '**/{*.{js?(on),ts?(x),md,scss},.*.js?(on)}' --write --list-different",
"prettier-check": "yarn -s run prettier --write=false",
"eslint": "eslint 'src/**/*.{ts,tsx}'",
Expand Down

0 comments on commit c364bc5

Please sign in to comment.