Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
129 changes: 100 additions & 29 deletions .github/workflows/project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,26 @@ 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
TRIAGE_ITEM_NUMBER:
required: false
default: 0
description: Number of the item that triggered the workflow (issue/PR)
type: number
TRIAGE_ITEM_URL:
required: false
default: "none"
description: URL of the item that triggered the workflow (issue/PR)
type: string
secrets:
WORKFLOW_TOKEN:
description: Token used to with permission to the project
Expand All @@ -32,43 +52,80 @@ 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 }}";


prepare:
name: Preparation
runs-on: ubuntu-latest
outputs:
triage_item_url: ${{ steps.triage_item_url.outputs.triage_item_url }}
steps:


- name: Build Item URL
id: triage_item_url
shell: bash
run: |

if [ "${{ inputs.TRIAGE_ITEM_URL }}" == "none" ]; then

if [ "${{inputs.TRIAGE_EVENT_NAME }}" == 'pull_request' ]; then

echo "triage_item_url=https://github.com/${{ github.repository }}/pull/${{ github.event.pull_request.number }}" > $GITHUB_OUTPUT;

else

echo "triage_item_url=https://github.com/${{ github.repository }}/issues/${{ github.event.issue.number }}" > $GITHUB_OUTPUT;

fi;

else

echo "triage_item_url=${{ inputs.TRIAGE_ITEM_URL }}" > $GITHUB_OUTPUT;

fi;


project-add:
name: Add
needs:
- prepare
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 +142,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,11 +156,12 @@ 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:
- prepare
- project-add
runs-on: ubuntu-latest
outputs:
Expand All @@ -128,6 +186,7 @@ jobs:
fields: Start date
github_token: ${{ secrets.WORKFLOW_TOKEN }}
project_url: ${{ inputs.PROJECT_URL }}
resource_url: ${{ needs.prepare.outputs.triage_item_url }}


- name: Fetch End Date
Expand All @@ -138,6 +197,7 @@ jobs:
fields: End date
github_token: ${{ secrets.WORKFLOW_TOKEN }}
project_url: ${{ inputs.PROJECT_URL }}
resource_url: ${{ needs.prepare.outputs.triage_item_url }}


- name: Fetch Status
Expand All @@ -148,21 +208,23 @@ jobs:
fields: Status
github_token: ${{ secrets.WORKFLOW_TOKEN }}
project_url: ${{ inputs.PROJECT_URL }}
resource_url: ${{ needs.prepare.outputs.triage_item_url }}



project-set-start-date:
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 == ''
)}}
needs:
- prepare
- project-fields
runs-on: ubuntu-latest
steps:
Expand All @@ -175,6 +237,7 @@ jobs:
fields: Start date
github_token: ${{ secrets.WORKFLOW_TOKEN }}
project_url: ${{ inputs.PROJECT_URL }}
resource_url: ${{ needs.prepare.outputs.triage_item_url }}
values: ${{ needs.project-fields.outputs.date-value }}


Expand All @@ -187,54 +250,58 @@ jobs:
needs.project-fields.outputs.project-status != 'In progress'
)}}
needs:
- prepare
- project-fields
runs-on: ubuntu-latest
steps:


- 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
fields: Status
github_token: ${{ secrets.WORKFLOW_TOKEN }}
project_url: ${{ inputs.PROJECT_URL }}
resource_url: ${{ needs.prepare.outputs.triage_item_url }}
values: 'Planning'


- 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:
operation: set
fields: Status
github_token: ${{ secrets.WORKFLOW_TOKEN }}
project_url: ${{ inputs.PROJECT_URL }}
resource_url: ${{ needs.prepare.outputs.triage_item_url }}
values: 'In progress'


- name: Set Status done
if: ${{ github.event.action == 'closed' }}
if: ${{ inputs.TRIAGE_EVENT_ACTION == 'closed' }}
uses: EndBug/project-fields@v2
with:
operation: set
fields: Status
github_token: ${{ secrets.WORKFLOW_TOKEN }}
project_url: ${{ inputs.PROJECT_URL }}
resource_url: ${{ needs.prepare.outputs.triage_item_url }}
values: 'Done'


- 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 @@ -245,6 +312,7 @@ jobs:
fields: Status
github_token: ${{ secrets.WORKFLOW_TOKEN }}
project_url: ${{ inputs.PROJECT_URL }}
resource_url: ${{ needs.prepare.outputs.triage_item_url }}



Expand All @@ -254,20 +322,21 @@ 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:
- prepare
- project-fields
runs-on: ubuntu-latest
steps:


- name: Set End date
if: ${{(
github.event.action == 'closed'
inputs.TRIAGE_EVENT_ACTION == 'closed'
&&
needs.project-fields.outputs.project-end-date == ''
)}}
Expand All @@ -277,16 +346,18 @@ jobs:
fields: End date
github_token: ${{ secrets.WORKFLOW_TOKEN }}
project_url: ${{ inputs.PROJECT_URL }}
resource_url: ${{ needs.prepare.outputs.triage_item_url }}
values: ${{ needs.project-fields.outputs.date-value }}


- 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:
operation: clear
fields: End date
github_token: ${{ secrets.WORKFLOW_TOKEN }}
project_url: ${{ inputs.PROJECT_URL }}
resource_url: ${{ needs.prepare.outputs.triage_item_url }}