name: add-to-dev-prod-project

on:
  issues:
    types: [opened, labeled]
  pull_request:
    types: [opened, labeled]

jobs:
  add-to-dev-prod-project:
    if: contains(github.event.issue.labels.*.name, '@dev-productivity')
    runs-on: ubuntu-latest
    steps:
      - name: Get project data
        run: |
          gh api graphql -f query='
            query($org: String!, $number: Int!) {
              organization(login: $org){
                projectNext(number: $number) {
                  id
                  fields(first:20) {
                    nodes {
                      id
                      name
                      settings
                    }
                  }
                }
              }
            }' -f org=gradle -F number=17 > project_data.json

          echo 'PROJECT_ID='$(jq '.data.organization.projectNext.id' project_data.json) >> $GITHUB_ENV
      - name: Add issue/PR to project
        run: |
          gh api graphql -f query='
            mutation($project:ID!, $pr:ID!) {
              addProjectNextItem(input: {projectId: $project, contentId: $pr}) {
                projectNextItem {
                  id
                }
              }
            }' -f project=$PROJECT_ID -f pr=${{ github.event.pull_request.node_id }}

Add a workflow to auto-add @dev-prod issue/PR to projects
Add a workflow to auto-add @dev-prod issue/PR to projects
