leap-stc / LEAP_template_feedstock

A Prototype feedstock that implements independent metadata and data updates using pangeo forge
Apache License 2.0
1 stars 2 forks source link

Restrict users who are able to dispatch deployment #17

Open jbusecke opened 3 months ago

jbusecke commented 3 months ago

Still needs some discussion, but In general do we want to allow every recipe creator to potentiall fire off giant dataflow jobs?

here is a suggestion by chatgpt how we could potentially limit this to certain people/teams

name: Controlled Workflow Dispatch

on:
  workflow_dispatch:

jobs:
  check_permission:
    runs-on: ubuntu-latest
    steps:
      - name: Check if user is authorized
        run: |
          if [[ "$GITHUB_ACTOR" != "authorized_user1" && "$GITHUB_ACTOR" != "authorized_user2" ]]; then
            echo "You are not authorized to trigger this workflow."
            exit 1
          fi

  main_job:
    needs: check_permission
    runs-on: ubuntu-latest
    steps:
      - name: Execute Main Steps
        run: echo "Running main steps..."