Skip to content

Exclude posts given their IDs to users with specific roles. #7

Exclude posts given their IDs to users with specific roles.

Exclude posts given their IDs to users with specific roles. #7

name: Issue & PR Automation
on:
issues:
types:
- opened
- reopened
pull_request_target:
types:
- opened
- reopened
- review_requested
env:
PRIMARY_CODEOWNER: '@ideadude'
PROJECT_ORG: gocodebox
PROJECT_ID: 18
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/project-beta-automations@v2.1.0
with:
gh_token: ${{ secrets.ORG_WORKFLOWS }}
organization: ${{ env.PROJECT_ORG }}
project_id: ${{ env.PROJECT_ID }}
resource_node_id: ${{ github.event.issue.node_id }}
status_value: "Awaiting Triage"
# - uses: hmarr/debug-action@v2
####################################
# Assign to the project's CODEOWNER.
####################################
issue-assig:
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@v2
- name: Check CODEOWNERS file existence
id: codeowners_file_exists
uses: andstor/file-existence-action@v2
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@v1
with:
repo-token: ${{ secrets.ORG_WORKFLOWS }}
assignees: ${{ env.PRIMARY_CODEOWNER }}
#####################################
# Add PRs to the Development project.
#####################################
pr-to-board:
name: Move Pull Request to the Project Board
runs-on: ubuntu-latest
if: ( 'pull_request_target' == github.event_name && ( 'opened' == github.event.action || 'reopened' == github.event.action || 'review_requested' == github.event.action ) )
steps:
- name: Mark PR as Awaiting Review
uses: leonsteinhaeuser/project-beta-automations@v2.1.0
with:
gh_token: ${{ secrets.ORG_WORKFLOWS }}
organization: ${{ env.PROJECT_ORG }}
project_id: ${{ env.PROJECT_ID }}
resource_node_id: ${{ github.event.pull_request.node_id }}
status_value: "Awaiting Review"