Skip to content

Members Legacy Cleanup #8

Members Legacy Cleanup

Members Legacy Cleanup #8

###
#
# This workflow file is deployed into this repository via the "Sync Project Automation Organization File" workflow
#
# Direct edits to this file are at risk of being overwritten by the next sync. All edits should be made
# to the source file.
#
# @see Sync workflow {@link https://github.com/caseproof/org-admin/blob/main/.github/workflows/workflow-project-automation-sync.yml}
# @see Workflow template {@link https://github.com/caseproof/org-admin/blob/main/.github/workflow-templates/project-automation.yml}
#
###
name: Project Automation
on:
issues:
types:
- opened
- reopened
env:
PROJECT_ORG: caseproof
PRIMARY_CODEOWNER: "@cartpauj"
PROJECT_ID: 8
ISSUE_MANAGE_PAT: ${{ secrets.MP_ISSUE_MANAGE_PAT_1 }}
jobs:
#######################################
# Add issue to the Development project.
#######################################
issue-to-project:
name: Move Issue to Project Board
runs-on: ubuntu-latest
if: ( 'issues' == github.event_name && ( 'opened' == github.event.action || 'reopened' == github.event.action ) )
steps:
- name: Add Issue to Project
uses: leonsteinhaeuser/[email protected]
with:
gh_token: ${{ env.ISSUE_MANAGE_PAT }}
organization: ${{ env.PROJECT_ORG }}
project_id: ${{ env.PROJECT_ID }}
resource_node_id: ${{ github.event.issue.node_id }}
status_value: "Awaiting Triage"
#######################################
# Assign issue to the current quarter.
#######################################
issue-to-project-quarter:
name: Assign issue to the current Quarter
runs-on: ubuntu-latest
needs: issue-to-project
if: ( 'issues' == github.event_name && ( 'opened' == github.event.action || 'reopened' == github.event.action ) )
steps:
- name: Assign Issue to Project Quarter
uses: leonsteinhaeuser/[email protected]
with:
gh_token: ${{ env.ISSUE_MANAGE_PAT }}
organization: ${{ env.PROJECT_ORG }}
project_id: ${{ env.PROJECT_ID }}
resource_node_id: ${{ github.event.issue.node_id }}
operation_mode: custom_field
custom_field_values: '[{\"name\": \"Quarter\",\"type\": \"iteration\",\"value\": \"@current\"}]'
####################################
# Assign to the project's CODEOWNER.
####################################
issue-assign:
name: Assign Issue to the Primary CODEOWNER
runs-on: ubuntu-latest
if: ( 'issues' == github.event_name && ( 'opened' == github.event.action || 'reopened' == github.event.action ) && ( null == github.event.issue.assignee ) )
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check CODEOWNERS file existence
id: codeowners_file_exists
uses: andstor/file-existence-action@v3
with:
files: .github/CODEOWNERS
- name: Parse CODEOWNERS file
id: codeowner
if: steps.codeowners_file_exists.outputs.files_exists == 'true'
uses: SvanBoxel/codeowners-action@v1
with:
path: .github/CODEOWNERS
- name: Update PRIMARY_CODEOWNER env var
if: steps.codeowners_file_exists.outputs.files_exists == 'true'
run: |
echo PRIMARY_CODEOWNER=$( echo '${{ steps.codeowner.outputs.codeowners }}' | jq -r '."*"[0]' ) >> $GITHUB_ENV
- name: Strip @ from username
run: |
echo "PRIMARY_CODEOWNER=${PRIMARY_CODEOWNER#?}" >> $GITHUB_ENV
- name: Assign issue
uses: pozil/auto-assign-issue@v2
with:
repo-token: ${{ env.ISSUE_MANAGE_PAT }}
assignees: ${{ env.PRIMARY_CODEOWNER }}