From 57d992b4044b553ab6e12730d0c60afcd8239aec Mon Sep 17 00:00:00 2001 From: Joshua Sangmeister <33004050+jsangmeister@users.noreply.github.com> Date: Wed, 2 Aug 2023 13:35:04 +0200 Subject: [PATCH] Extend project automation --- .github/workflows/project-automation.yml | 32 +++++++++++++++++++ .github/workflows/project-issue-closed.yml | 14 ++++++++ .github/workflows/project-issue-opened.yml | 15 +++++++++ .../workflows/project-pull-request-closed.yml | 14 ++++++++ .../workflows/project-pull-request-opened.yml | 15 +++++++++ .../project-pull-request-review-requested.yml | 14 ++++++++ .github/workflows/set-project.yml | 23 ------------- 7 files changed, 104 insertions(+), 23 deletions(-) create mode 100644 .github/workflows/project-automation.yml create mode 100644 .github/workflows/project-issue-closed.yml create mode 100644 .github/workflows/project-issue-opened.yml create mode 100644 .github/workflows/project-pull-request-closed.yml create mode 100644 .github/workflows/project-pull-request-opened.yml create mode 100644 .github/workflows/project-pull-request-review-requested.yml delete mode 100644 .github/workflows/set-project.yml diff --git a/.github/workflows/project-automation.yml b/.github/workflows/project-automation.yml new file mode 100644 index 0000000..5eb9e0a --- /dev/null +++ b/.github/workflows/project-automation.yml @@ -0,0 +1,32 @@ +name: Project automation +on: + workflow_call: + inputs: + resource_node_id: + required: true + type: string + status_value: + required: true + type: string + secrets: + AUTOMATION_APP_ID: + required: true + AUTOMATION_APP_INSTALLATION_ID: + required: true + AUTOMATION_APP_PRIVATE_KEY: + required: true + +jobs: + workflow_call: + name: Set status + runs-on: ubuntu-latest + steps: + - uses: leonsteinhaeuser/project-beta-automations@v2.1.0 + with: + gh_app_ID: ${{ secrets.AUTOMATION_APP_ID }} + gh_app_installation_ID: ${{ secrets.AUTOMATION_APP_INSTALLATION_ID }} + gh_app_secret_key: ${{ secrets.AUTOMATION_APP_PRIVATE_KEY }} + organization: OpenSlides + project_id: 2 + resource_node_id: ${{ inputs.resource_node_id }} + status_value: ${{ inputs.status_value }} diff --git a/.github/workflows/project-issue-closed.yml b/.github/workflows/project-issue-closed.yml new file mode 100644 index 0000000..eb6199d --- /dev/null +++ b/.github/workflows/project-issue-closed.yml @@ -0,0 +1,14 @@ +name: Project automation +on: + issues: + types: + - closed + +jobs: + issue_closed: + name: Issue closed + uses: ./.github/workflows/project-automation.yml + secrets: inherit + with: + resource_node_id: ${{ github.event.issue.node_id }} + status_value: "Done" diff --git a/.github/workflows/project-issue-opened.yml b/.github/workflows/project-issue-opened.yml new file mode 100644 index 0000000..068a5f0 --- /dev/null +++ b/.github/workflows/project-issue-opened.yml @@ -0,0 +1,15 @@ +name: Project automation +on: + issues: + types: + - opened + - reopened + +jobs: + issue_opened: + name: Issue opened + uses: ./.github/workflows/project-automation.yml + secrets: inherit + with: + resource_node_id: ${{ github.event.issue.node_id }} + status_value: "Backlog" diff --git a/.github/workflows/project-pull-request-closed.yml b/.github/workflows/project-pull-request-closed.yml new file mode 100644 index 0000000..c09de8b --- /dev/null +++ b/.github/workflows/project-pull-request-closed.yml @@ -0,0 +1,14 @@ +name: Project automation +on: + pull_request_target: + types: + - closed + +jobs: + pull_request_closed: + name: Pull request closed + uses: ./.github/workflows/project-automation.yml + secrets: inherit + with: + resource_node_id: ${{ github.event.pull_request.node_id }} + status_value: "Done" diff --git a/.github/workflows/project-pull-request-opened.yml b/.github/workflows/project-pull-request-opened.yml new file mode 100644 index 0000000..55901d1 --- /dev/null +++ b/.github/workflows/project-pull-request-opened.yml @@ -0,0 +1,15 @@ +name: Project automation +on: + pull_request_target: + types: + - opened + - reopened + +jobs: + pull_request_opened: + name: Pull request opened + uses: ./.github/workflows/project-automation.yml + secrets: inherit + with: + resource_node_id: ${{ github.event.pull_request.node_id }} + status_value: "Work in progress" diff --git a/.github/workflows/project-pull-request-review-requested.yml b/.github/workflows/project-pull-request-review-requested.yml new file mode 100644 index 0000000..698edd6 --- /dev/null +++ b/.github/workflows/project-pull-request-review-requested.yml @@ -0,0 +1,14 @@ +name: Project automation +on: + pull_request_target: + types: + - review_requested + +jobs: + pull_request_review_requested: + name: Pull request review requested + uses: ./.github/workflows/project-automation.yml + secrets: inherit + with: + resource_node_id: ${{ github.event.pull_request.node_id }} + status_value: "Review in progress" diff --git a/.github/workflows/set-project.yml b/.github/workflows/set-project.yml deleted file mode 100644 index dcc5055..0000000 --- a/.github/workflows/set-project.yml +++ /dev/null @@ -1,23 +0,0 @@ ---- -name: Set project -on: - issues: - types: [opened] - pull_request_target: - types: [opened] - -jobs: - set-project: - name: 'Set project' - runs-on: ubuntu-latest - steps: - - uses: tibdex/github-app-token@v1 - id: generate-token - with: - app_id: ${{ secrets.AUTOMATION_APP_ID }} - private_key: ${{ secrets.AUTOMATION_APP_PRIVATE_KEY }} - - - uses: actions/add-to-project@v0.5.0 - with: - project-url: https://github.com/orgs/OpenSlides/projects/2 - github-token: ${{ steps.generate-token.outputs.token }}