Skip to content

chore: create #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 10, 2024
Merged
Show file tree
Hide file tree
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
Empty file added .github/workflows/.gitkeep
Empty file.
287 changes: 287 additions & 0 deletions .github/workflows/project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,287 @@
---

name: Project


on:
workflow_call:
inputs:
PROJECT_URL:
required: true
description: What project to triage issues/pr for
type: string
secrets:
WORKFLOW_TOKEN:
description: Token used to with permission to the project
required: true


jobs:


debug:
name: Debug
runs-on: ubuntu-latest
steps:

- name: Add To Project
run: |
echo "[Debug] github.event_name=${{ github.event_name }}";
echo "[Debug] github.event.action=${{ github.event.action }}";


project-add:
name: Add
if: ${{(
(
github.event_name == 'issues'
&&
(
github.event.action == 'opened'
||
github.event.action == 'reopened'
||
github.event.action == 'labeled'
||
github.event.action == 'milestoned'
||
github.event.action == 'demilestoned'
||
github.event.action == 'closed'
||
github.event.action == 'assigned'
)
)
||
(
github.event_name == 'pull_request'
&&
(
github.event.action == 'opened'
||
github.event.action == 'edited'
||
github.event.action == 'assigned'
||
github.event.action == 'reopened'
||
github.event.action == 'closed'
)
)
)}}
runs-on: ubuntu-latest
steps:

- uses: actions/add-to-project@244f685bbc3b7adfa8466e08b698b5577571133e # v1.0.2
with:
project-url: ${{ inputs.PROJECT_URL }}
github-token: ${{ secrets.WORKFLOW_TOKEN }}



project-remove:
name: Remove
if: ${{(
github.event_name == 'issues' && github.event.action == 'transferred'
)}}
runs-on: ubuntu-latest
steps:

- name: Remove From Project
run: |
echo todo;



project-fields:
name: Field Values
if: ${{(
(github.event_name == 'issues' && github.event.action != 'transferred')
||
(github.event_name == 'pull_request')
)}}
needs:
- project-add
runs-on: ubuntu-latest
outputs:
project-start-date: ${{ steps.start-date.outputs.values }}
project-end-date: ${{ steps.end-date.outputs.values }}
project-status: ${{ steps.status.outputs.values }}
date-value: ${{ steps.date-value.outputs.date }}
steps:

- name: Generate Date Value
id: date-value
shell: bash
run: |
echo date=$(date '+%Y-%m-%d') > $GITHUB_OUTPUT


- name: Fetch Start Date
uses: EndBug/project-fields@v2
id: start-date
with:
operation: get
fields: Start date
github_token: ${{ secrets.WORKFLOW_TOKEN }}
project_url: ${{ inputs.PROJECT_URL }}


- name: Fetch End Date
uses: EndBug/project-fields@v2
id: end-date
with:
operation: get
fields: End date
github_token: ${{ secrets.WORKFLOW_TOKEN }}
project_url: ${{ inputs.PROJECT_URL }}


- name: Fetch Status
uses: EndBug/project-fields@v2
id: status
with:
operation: get
fields: Status
github_token: ${{ secrets.WORKFLOW_TOKEN }}
project_url: ${{ inputs.PROJECT_URL }}



project-set-start-date:
name: Set Start Date
if: ${{(
(
(github.event_name == 'issues' && github.event.action == 'assigned')
||
github.event_name == 'pull_request'
)
&&
needs.project-fields.outputs.project-start-date == ''
)}}
needs:
- project-fields
runs-on: ubuntu-latest
steps:

- name: Set Start Date
if: ${{ needs.project-fields.outputs.project-start-date == '' }}
uses: EndBug/project-fields@v2
with:
operation: set
fields: Start date
github_token: ${{ secrets.WORKFLOW_TOKEN }}
project_url: ${{ inputs.PROJECT_URL }}
values: ${{ needs.project-fields.outputs.date-value }}



project-set-status:
name: Set Status
if: ${{(
needs.project-fields.outputs.project-status != 'Awaiting Feedback'
&&
needs.project-fields.outputs.project-status != 'In progress'
)}}
needs:
- project-fields
runs-on: ubuntu-latest
steps:


- name: Set Status Planning
if: ${{ github.event_name == 'issues' && github.event.action == 'milestoned' }}
uses: EndBug/project-fields@v2
with:
operation: set
fields: Status
github_token: ${{ secrets.WORKFLOW_TOKEN }}
project_url: ${{ inputs.PROJECT_URL }}
values: 'Planning'


- name: Set Status In Progress
if: ${{(
(github.event_name == 'issues' && github.event.action == 'assigned')
||
github.event_name == 'pull_request' && github.event.action != 'closed'
)}}
uses: EndBug/project-fields@v2
with:
operation: set
fields: Status
github_token: ${{ secrets.WORKFLOW_TOKEN }}
project_url: ${{ inputs.PROJECT_URL }}
values: 'In progress'


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


- name: Clear Status
if: ${{(
(
(github.event_name == 'issues' && github.event.action == 'reopened')
||
(github.event_name == 'issues' && github.event.action == 'demilestoned')
)
&&
needs.project_fields.project-status != 'Ready to Commence'
)}}
uses: EndBug/project-fields@v2
with:
operation: clear
fields: Status
github_token: ${{ secrets.WORKFLOW_TOKEN }}
project_url: ${{ inputs.PROJECT_URL }}



project-set-end-date:
name: Set End Date
if: ${{(
needs.project-fields.outputs.project-start-date != ''
&&
(
github.event.action == 'closed'
||
github.event.action == 'reopened'
)
)}}
needs:
- project-fields
runs-on: ubuntu-latest
steps:


- name: Set End date
if: ${{(
github.event_name == 'issues' && github.event.action == 'closed'
)}}
uses: EndBug/project-fields@v2
with:
operation: set
fields: End date
github_token: ${{ secrets.WORKFLOW_TOKEN }}
project_url: ${{ inputs.PROJECT_URL }}
values: ${{ needs.project-fields.outputs.date-value }}


- name: Clear End Date
if: ${{(
github.event_name == 'issues' && github.event.action == 'reopened'
)}}
uses: EndBug/project-fields@v2
with:
operation: clear
fields: End date
github_token: ${{ secrets.WORKFLOW_TOKEN }}
project_url: ${{ inputs.PROJECT_URL }}
15 changes: 15 additions & 0 deletions .github/workflows/pull_request.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

---

name: Pull Requests


on:
pull_request: {}


jobs:

pull-requests:
name: Pull Request
uses: nofusscomputing/action_pull_requests/.github/workflows/pull-requests.yaml@development
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,42 @@
## No Fuss Computing - GH Action / Workflow for Project Issue/PR Triage

To use this reusable workflow add the following file to path `.github/workflows/project.yaml`

``` yaml

---

name: Project


on:
issues:
types:
- opened
- reopened
- transferred
- milestoned
- demilestoned
- closed
- assigned
pull_request:
types:
- opened
- reopened
- closed



jobs:


project:
name: Project
uses: nofusscomputing/action_project/.github/workflows/project.yaml@development
with:
PROJECT_URL: https://github.com/orgs/nofusscomputing/projects/7
secrets:
WORKFLOW_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}


```
Loading