Enable Dependabot version updates #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build & test # on PRs (including forks) and push to develop/main | |
on: | |
pull_request_target: | |
types: [opened, synchronize] | |
push: | |
branches: [develop] | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
steps: | |
# Get user permission of workflow triggering actor, return true or false | |
- name: Get Workflow Actor Permission | |
id: checkAccess | |
# Action used: https://github.com/actions-cool/check-user-permission | |
uses: actions-cool/check-user-permission@v2 | |
with: | |
require: write | |
username: ${{ github.triggering_actor }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# Check user permission from previous step, exit if false | |
- name: Check Workflow Actor Permission | |
if: steps.checkAccess.outputs.require-result == 'false' | |
run: | | |
echo "${{ github.triggering_actor }} does not have permissions to run workflows on this repo." | |
echo "Current permission level is ${{ steps.checkAccess.outputs.user-permission }}" | |
echo "Job originally triggered by ${{ github.actor }}" | |
exit 1 | |
# Checkout PR code | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
# This is dangerous without the first access check | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- name: Cache node_modules | |
uses: actions/cache@v3 | |
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) | |
with: | |
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Use NodeJs | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20.x" | |
- name: Install dependencies | |
run: yarn install --frozen-lockfile --non-interactive | |
- name: Run linting | |
run: yarn lint | |
- name: Build app | |
run: yarn build | |
env: | |
NEXT_PUBLIC_ROLLBAR_ENV: CI | |
NEXT_PUBLIC_FIREBASE_API_KEY: ${{ secrets.NEXT_PUBLIC_FIREBASE_API_KEY }} | |
NEXT_PUBLIC_ROLLBAR_CLIENT_TOKEN: ${{ secrets.NEXT_PUBLIC_ROLLBAR_CLIENT_TOKEN }} | |
NEXT_PUBLIC_STORYBLOK_TOKEN: ${{ secrets.NEXT_PUBLIC_STORYBLOK_TOKEN }} | |
- name: Test app | |
run: yarn test |