diff --git a/.github/workflows/project-automation-helper.yml b/.github/workflows/project-automation-helper.yml deleted file mode 100644 index 7a70ebe9c..000000000 --- a/.github/workflows/project-automation-helper.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Project automation helper -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: - 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-automation.yml b/.github/workflows/project-automation.yml index b11960f12..5eb9e0a34 100644 --- a/.github/workflows/project-automation.yml +++ b/.github/workflows/project-automation.yml @@ -1,60 +1,32 @@ name: Project automation on: - issues: - types: - - opened - - reopened - - closed - pull_request_target: - types: - - opened - - reopened - - review_requested - - closed - pull_request_review: - types: - - submitted + 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: - issue_opened: - if: github.event_name == 'issues' && (github.event.action == 'opened' || github.event.action == 'reopened') - uses: ./.github/workflows/project-automation-helper.yml - secrets: inherit - with: - resource_node_id: ${{ github.event.issue.node_id }} - status_value: "Planning" - pull_request_opened: - if: github.event_name == 'pull_request_target' && (github.event.action == 'opened' || github.event.action == 'reopened') - uses: ./.github/workflows/project-automation-helper.yml - secrets: inherit - with: - resource_node_id: ${{ github.event.pull_request.node_id }} - status_value: "Work in progress" - pull_request_review_requested: - if: github.event_name == 'pull_request_target' && github.event.action == 'review_requested' - uses: ./.github/workflows/project-automation-helper.yml - secrets: inherit - with: - resource_node_id: ${{ github.event.pull_request.node_id }} - status_value: "Review in progress" - pull_request_changes_requested: - if: github.event_name == 'pull_request_review' && github.event.review.state == 'changes_requested' - uses: ./.github/workflows/project-automation-helper.yml - secrets: inherit - with: - resource_node_id: ${{ github.event.pull_request.node_id }} - status_value: "Work in progress" - pull_request_approved: - if: github.event_name == 'pull_request_review' && github.event.review.state == 'approved' - uses: ./.github/workflows/project-automation-helper.yml - secrets: inherit - with: - resource_node_id: ${{ github.event.pull_request.node_id }} - status_value: "Reviewer approved" - pull_request_or_issue_closed: - if: github.event.action == 'closed' - uses: ./.github/workflows/project-automation-helper.yml - secrets: inherit - with: - resource_node_id: ${{ github.event.pull_request.node_id }} - status_value: "Done" + 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 000000000..eb6199dff --- /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 000000000..6aa609c15 --- /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: "Planning" diff --git a/.github/workflows/project-pull-request-approved.yml b/.github/workflows/project-pull-request-approved.yml new file mode 100644 index 000000000..ad63986c0 --- /dev/null +++ b/.github/workflows/project-pull-request-approved.yml @@ -0,0 +1,15 @@ +name: Project automation +on: + pull_request_review: + types: + - submitted + +jobs: + pull_request_approved: + name: Pull request approved + if: github.event.review.state == 'approved' + uses: ./.github/workflows/project-automation.yml + secrets: inherit + with: + resource_node_id: ${{ github.event.pull_request.node_id }} + status_value: "Reviewer approved" diff --git a/.github/workflows/project-pull-request-changes-requested.yml b/.github/workflows/project-pull-request-changes-requested.yml new file mode 100644 index 000000000..2086b8635 --- /dev/null +++ b/.github/workflows/project-pull-request-changes-requested.yml @@ -0,0 +1,15 @@ +name: Project automation +on: + pull_request_review: + types: + - submitted + +jobs: + pull_request_changes_requested: + name: Pull request changes requested + if: github.event.review.state == 'changes_requested' + 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-closed.yml b/.github/workflows/project-pull-request-closed.yml new file mode 100644 index 000000000..c09de8b02 --- /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 000000000..55901d10f --- /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 000000000..698edd6bb --- /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"