Skip to content

Commit

Permalink
feat(inputs): add new vars TRIAGE_EVENT_ACTION and TRIAGE_EVENT_NAME
Browse files Browse the repository at this point in the history
work in preparation for solution 1

. #3
  • Loading branch information
jon-nfc committed Aug 15, 2024
1 parent ace6aa9 commit 9d60c37
Showing 1 changed file with 42 additions and 29 deletions.
71 changes: 42 additions & 29 deletions .github/workflows/project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,16 @@ on:
required: true
description: What project to triage issues/pr for
type: string
TRIAGE_EVENT_ACTION:
required: false
default: "${{ github.event.action }}"
description: Event action that triggered to workflow
type: string
TRIAGE_EVENT_NAME:
required: false
default: "${{ github.event_name }}"
description: Name of event that triggered to workflow
type: string
secrets:
WORKFLOW_TOKEN:
description: Token used to with permission to the project
Expand All @@ -32,43 +42,46 @@ jobs:
echo "[Debug] github.event.pull_request.author_association=${{ github.event.pull_request.author_association }}";
echo "[Debug] github.triggering_actor=${{ github.triggering_actor }}";
echo "[Debug] inputs.TRIAGE_EVENT_ACTION=${{ inputs.TRIAGE_EVENT_ACTION }}";
echo "[Debug] inputs.TRIAGE_EVENT_NAME=${{ inputs.TRIAGE_EVENT_NAME }}";
project-add:
name: Add
if: ${{(
(
github.event_name == 'issues'
inputs.TRIAGE_EVENT_NAME == 'issues'
&&
(
github.event.action == 'opened'
inputs.TRIAGE_EVENT_ACTION == 'opened'
||
github.event.action == 'reopened'
inputs.TRIAGE_EVENT_ACTION == 'reopened'
||
github.event.action == 'labeled'
inputs.TRIAGE_EVENT_ACTION == 'labeled'
||
github.event.action == 'milestoned'
inputs.TRIAGE_EVENT_ACTION == 'milestoned'
||
github.event.action == 'demilestoned'
inputs.TRIAGE_EVENT_ACTION == 'demilestoned'
||
github.event.action == 'closed'
inputs.TRIAGE_EVENT_ACTION == 'closed'
||
github.event.action == 'assigned'
inputs.TRIAGE_EVENT_ACTION == 'assigned'
)
)
||
(
github.event_name == 'pull_request'
inputs.TRIAGE_EVENT_NAME == 'pull_request'
&&
(
github.event.action == 'opened'
inputs.TRIAGE_EVENT_ACTION == 'opened'
||
github.event.action == 'edited'
inputs.TRIAGE_EVENT_ACTION == 'edited'
||
github.event.action == 'assigned'
inputs.TRIAGE_EVENT_ACTION == 'assigned'
||
github.event.action == 'reopened'
inputs.TRIAGE_EVENT_ACTION == 'reopened'
||
github.event.action == 'closed'
inputs.TRIAGE_EVENT_ACTION == 'closed'
)
)
)}}
Expand All @@ -85,7 +98,7 @@ jobs:
project-remove:
name: Remove
if: ${{(
github.event_name == 'issues' && github.event.action == 'transferred'
inputs.TRIAGE_EVENT_NAME == 'issues' && inputs.TRIAGE_EVENT_ACTION == 'transferred'
)}}
runs-on: ubuntu-latest
steps:
Expand All @@ -99,9 +112,9 @@ jobs:
project-fields:
name: Field Values
if: ${{(
(github.event_name == 'issues' && github.event.action != 'transferred')
(inputs.TRIAGE_EVENT_NAME == 'issues' && inputs.TRIAGE_EVENT_ACTION != 'transferred')
||
(github.event_name == 'pull_request')
(inputs.TRIAGE_EVENT_NAME == 'pull_request')
)}}
needs:
- project-add
Expand Down Expand Up @@ -155,9 +168,9 @@ jobs:
name: Set Start Date
if: ${{(
(
(github.event_name == 'issues' && github.event.action == 'assigned')
(inputs.TRIAGE_EVENT_NAME == 'issues' && inputs.TRIAGE_EVENT_ACTION == 'assigned')
||
github.event_name == 'pull_request'
inputs.TRIAGE_EVENT_NAME == 'pull_request'
)
&&
needs.project-fields.outputs.project-start-date == ''
Expand Down Expand Up @@ -193,7 +206,7 @@ jobs:


- name: Set Status Planning
if: ${{ github.event_name == 'issues' && github.event.action == 'milestoned' }}
if: ${{ inputs.TRIAGE_EVENT_NAME == 'issues' && inputs.TRIAGE_EVENT_ACTION == 'milestoned' }}
uses: EndBug/project-fields@v2
with:
operation: set
Expand All @@ -205,9 +218,9 @@ jobs:

- name: Set Status In Progress
if: ${{(
(github.event_name == 'issues' && github.event.action == 'assigned')
(inputs.TRIAGE_EVENT_NAME == 'issues' && inputs.TRIAGE_EVENT_ACTION == 'assigned')
||
github.event_name == 'pull_request' && github.event.action != 'closed'
inputs.TRIAGE_EVENT_NAME == 'pull_request' && inputs.TRIAGE_EVENT_ACTION != 'closed'
)}}
uses: EndBug/project-fields@v2
with:
Expand All @@ -219,7 +232,7 @@ jobs:


- name: Set Status done
if: ${{ github.event.action == 'closed' }}
if: ${{ inputs.TRIAGE_EVENT_ACTION == 'closed' }}
uses: EndBug/project-fields@v2
with:
operation: set
Expand All @@ -232,9 +245,9 @@ jobs:
- name: Clear Status
if: ${{(
(
(github.event_name == 'issues' && github.event.action == 'reopened')
(inputs.TRIAGE_EVENT_NAME == 'issues' && inputs.TRIAGE_EVENT_ACTION == 'reopened')
||
(github.event_name == 'issues' && github.event.action == 'demilestoned')
(inputs.TRIAGE_EVENT_NAME == 'issues' && inputs.TRIAGE_EVENT_ACTION == 'demilestoned')
)
&&
needs.project_fields.project-status != 'Ready to Commence'
Expand All @@ -254,9 +267,9 @@ jobs:
needs.project-fields.outputs.project-start-date != ''
&&
(
github.event.action == 'closed'
inputs.TRIAGE_EVENT_ACTION == 'closed'
||
github.event.action == 'reopened'
inputs.TRIAGE_EVENT_ACTION == 'reopened'
)
)}}
needs:
Expand All @@ -267,7 +280,7 @@ jobs:

- name: Set End date
if: ${{(
github.event.action == 'closed'
inputs.TRIAGE_EVENT_ACTION == 'closed'
&&
needs.project-fields.outputs.project-end-date == ''
)}}
Expand All @@ -282,7 +295,7 @@ jobs:

- name: Clear End Date
if: ${{(
github.event_name == 'issues' && github.event.action == 'reopened'
inputs.TRIAGE_EVENT_NAME == 'issues' && inputs.TRIAGE_EVENT_ACTION == 'reopened'
)}}
uses: EndBug/project-fields@v2
with:
Expand Down

0 comments on commit 9d60c37

Please sign in to comment.