Skip to content
This repository was archived by the owner on Nov 30, 2022. It is now read-only.
Merged
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: Run CI
on: [push]
name: CI Checks - Safe
on: [
pull_request
]

jobs:
Autoformat:
Expand Down Expand Up @@ -65,16 +67,3 @@ jobs:
uses: actions/checkout@v2
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- run: make pytest-integration-erasure

Integration-Tests-External:
runs-on: ubuntu-latest
steps:
- run: echo "Running CI for branch ${{ github.ref }}."
- name: Check out repository code
uses: actions/checkout@v2
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- name: Run unit tests that connect to an external db
env:
REDSHIFT_TEST_URI: ${{ secrets.REDSHIFT_TEST_URI }}
SNOWFLAKE_TEST_URI: ${{ secrets.SNOWFLAKE_TEST_URI }}
run: make pytest-external-integration
20 changes: 20 additions & 0 deletions .github/workflows/unsafe_pr_checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: CI Checks - Unsafe
on:
push:
pull_request:
types: [labeled]

jobs:
Integration-Tests-External:
runs-on: ubuntu-latest
if: contains(github.event.pull_request.labels.*.name, 'run unsafe ci checks')
Copy link
Copy Markdown
Contributor Author

@seanpreston seanpreston Nov 19, 2021

Choose a reason for hiding this comment

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

This condition was a bit confusing to me on first pass, so to break down for anyone else:

github.event.pull_request.labels.*.name this statement is applying a filter on the github.event.pull_request.labels var, pull out a list of label names, e.g. ["safe to run", "dont merge", ...].

contains(list, "value") is then check if "value" is an element of list.

It seems simple when you put it that way, but if you don't know about the filter stage, it could look as though github.event.pull_request.labels.*.name evaluates to a string and we're checking if that string contains the PR name (which would be less robust).

https://docs.github.com/en/actions/learn-github-actions/expressions#object-filters

steps:
- run: echo "Running CI for branch ${{ github.ref }}."
- name: Check out repository code
uses: actions/checkout@v2
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
- name: Run unit tests that connect to an external db
env:
REDSHIFT_TEST_URI: ${{ secrets.REDSHIFT_TEST_URI }}
SNOWFLAKE_TEST_URI: ${{ secrets.SNOWFLAKE_TEST_URI }}
run: make pytest-external-integration