Skip to content

Revamp labeling pipeline #1779

Revamp labeling pipeline

Revamp labeling pipeline #1779

name: Show Changed Models
on:
push:
branches: main
pull_request_target:
branches: main
env:
SYSTEM_SNOWFLAKE_USER: ${{ secrets.SYSTEM_SNOWFLAKE_USER }}
SYSTEM_SNOWFLAKE_PASSWORD: ${{ secrets.SYSTEM_SNOWFLAKE_PASSWORD }}
SYSTEM_SNOWFLAKE_ROLE: ${{ secrets.SYSTEM_SNOWFLAKE_ROLE }}
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
jobs:
check-user:
runs-on: ubuntu-latest
outputs:
skip_workflow: ${{ steps.check_user.outputs.skip_workflow }}
steps:
- name: Check out PR
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/github-script@v7
id: check_user
with:
script: |
const { data: collaborators } = await github.rest.repos.listCollaborators({
owner: context.repo.owner,
repo: context.repo.repo,
permission: 'maintain'
});
const maintainers = collaborators.map(maintain => maintain.login);
const skipWorkflow = maintainers.includes(context.actor);
console.log(`User is maintainer of Artemis dbt Repo: ${skipWorkflow}. Skip Action if TRUE`);
core.setOutput("skip_workflow", skipWorkflow ? 'true' : 'false');
build:
runs-on: ubuntu-latest
needs: check-user
if: ${{ needs.check-user.outputs.skip_workflow == 'false' }}
steps:
- uses: actions/setup-python@v2
with:
python-version: "3.11"
- name: Check out PR
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Init dbt
uses: ./.github/actions/init-dbt
- name: Show results of changed models
run: |
dbt deps
source dbt_scripts/show_changed.sh