From f7d34a451be222b051ae71ad2aabf1e3a5ac77bb Mon Sep 17 00:00:00 2001 From: Bitnami Bot Date: Thu, 23 Nov 2023 13:19:35 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=84=20synced=20local=20'.github/workfl?= =?UTF-8?q?ows/'=20with=20remote=20'workflows/'=20(#1249)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: bitnami-bot --- .github/workflows/comments.yml | 62 +++------------------- .github/workflows/migration.yml | 17 +++++++ .github/workflows/move-closed-issues.yml | 26 +++------- .github/workflows/pr-reviews.yml | 15 ++++++ .github/workflows/reasign.yml | 18 +++++++ .github/workflows/triage.yml | 65 +++--------------------- 6 files changed, 69 insertions(+), 134 deletions(-) create mode 100644 .github/workflows/migration.yml create mode 100644 .github/workflows/pr-reviews.yml create mode 100644 .github/workflows/reasign.yml diff --git a/.github/workflows/comments.yml b/.github/workflows/comments.yml index 7eeb7c4..47acfac 100644 --- a/.github/workflows/comments.yml +++ b/.github/workflows/comments.yml @@ -7,60 +7,10 @@ on: types: - created # Remove all permissions by default -permissions: {} -# Avoid concurrency over the same issue -concurrency: - group: card-movement-${{ github.event.issue.number }} +permissions: + pull-requests: write + issues: write jobs: - comments_handler: - runs-on: ubuntu-latest - permissions: - contents: read - repository-projects: write - issues: read - pull-requests: read - steps: - - name: Repo checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - - name: Load .env file - uses: xom9ikk/dotenv@de1ff27d319507880e6621e4d47424c677d95f68 - with: - path: .github/workflows/ - - name: Move into From Build Maintenance - uses: peter-evans/create-or-update-project-card@dfa240db6fe287ceb681e45d6728c1af70452c58 - # The comment was created by bitnami-bot in a pull_request created by bitnami-bot - if: ${{ github.actor == 'bitnami-bot' && github.event.issue.user.login == 'bitnami-bot' && github.event.issue.pull_request != null }} - with: - project-name: Support - column-name: Build Maintenance - # Required to trigger moving-cards.yml workflow (clean labels and assign people to work on it) - token: "${{ secrets.BITNAMI_BOT_TOKEN }}" - - name: Move into Pending - uses: peter-evans/create-or-update-project-card@dfa240db6fe287ceb681e45d6728c1af70452c58 - if: | - (github.actor != 'bitnami-bot' || github.event.issue.user.login != 'bitnami-bot' || github.event.issue.pull_request == null) && - contains(fromJson(env.BITNAMI_TEAM), github.actor) && - (!contains(github.event.issue.labels.*.name, 'bitnami')) - with: - project-name: Support - column-name: Pending - - name: Move into In Progress - uses: peter-evans/create-or-update-project-card@dfa240db6fe287ceb681e45d6728c1af70452c58 - if: | - (github.actor != 'bitnami-bot' || github.event.issue.user.login != 'bitnami-bot' || github.event.issue.pull_request == null) && - (!contains(fromJson(env.BITNAMI_TEAM), github.actor)) && - contains(github.event.issue.labels.*.name, 'in-progress') - with: - project-name: Support - column-name: In progress - - name: Move into Triage - uses: peter-evans/create-or-update-project-card@dfa240db6fe287ceb681e45d6728c1af70452c58 - if: | - (github.actor != 'bitnami-bot' || github.event.issue.user.login != 'bitnami-bot' || github.event.issue.pull_request == null) && - (!contains(fromJson(env.BITNAMI_TEAM), github.actor)) && - (!contains(github.event.issue.labels.*.name, 'in-progress')) - with: - project-name: Support - column-name: Triage - # Needs reasignation of the task - token: "${{ secrets.BITNAMI_BOT_TOKEN }}" + call-comments-workflow: + uses: bitnami/support/.github/workflows/comment-created.yml@main + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/migration.yml b/.github/workflows/migration.yml new file mode 100644 index 0000000..ae86cb4 --- /dev/null +++ b/.github/workflows/migration.yml @@ -0,0 +1,17 @@ +# Copyright VMware, Inc. +# SPDX-License-Identifier: APACHE-2.0 + +name: '[Support] Cards migration' +on: [ workflow_dispatch ] +permissions: {} +jobs: + call-migration-workflow: + uses: bitnami/support/.github/workflows/migrate-reusable.yml@main + with: + organization: bitnami + legacy_project_board_name: Support + new_project_number: 4 + repo: ${{ github.event.repository.name }} + secrets: + # This token should have access to both projects and at least read:project permissions + token: ${{ secrets.MIGRATION_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/move-closed-issues.yml b/.github/workflows/move-closed-issues.yml index 589ff23..76664ce 100644 --- a/.github/workflows/move-closed-issues.yml +++ b/.github/workflows/move-closed-issues.yml @@ -9,24 +9,10 @@ on: pull_request_target: types: - closed -# Remove all permissions by default. Actions are performed by Bitnami Bot -permissions: {} -# Avoid concurrency over the same issue -concurrency: - group: card-movement-${{ github.event_name != 'issues' && github.event.number || github.event.issue.number }} +permissions: + issues: write + pull-requests: write jobs: - send_to_solved: - runs-on: ubuntu-latest - steps: - - name: Send to the Solved column - id: send-solved - uses: peter-evans/create-or-update-project-card@dfa240db6fe287ceb681e45d6728c1af70452c58 - # Send to solve only the issues and PRs created by users or the automated PRs with human review required - if: | - (github.event.issue != null && github.event.issue.user.login != 'bitnami-bot') || - (github.event.issue == null && (github.event.pull_request.user.login != 'bitnami-bot' || contains(github.event.pull_request.labels.*.name, 'review-required'))) - with: - project-name: Support - column-name: 'Solved' - token: "${{ secrets.BITNAMI_BOT_TOKEN }}" - issue-number: ${{ github.event_name != 'issues' && github.event.number || github.event.issue.number }} + call-move-closed-workflow: + uses: bitnami/support/.github/workflows/item-closed.yml@main + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/pr-reviews.yml b/.github/workflows/pr-reviews.yml new file mode 100644 index 0000000..f971664 --- /dev/null +++ b/.github/workflows/pr-reviews.yml @@ -0,0 +1,15 @@ +# Copyright VMware, Inc. +# SPDX-License-Identifier: APACHE-2.0 + +name: '[Support] Review based card movements' +on: + pull_request_target: + types: + - review_requested + - synchronize +# Remove all permissions by default. +permissions: {} +jobs: + call-pr-review-workflow: + uses: bitnami/support/.github/workflows/pr-review-requested-sync.yml@main + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/reasign.yml b/.github/workflows/reasign.yml new file mode 100644 index 0000000..529942b --- /dev/null +++ b/.github/workflows/reasign.yml @@ -0,0 +1,18 @@ +# Copyright VMware, Inc. +# SPDX-License-Identifier: APACHE-2.0 + +name: '[Support] Review based card movements' +on: + pull_request: + types: + - labeled + issues: + types: + - labeled +permissions: + pull-requests: write + issues: write +jobs: + call-reasign-workflow: + uses: bitnami/support/.github/workflows/item-labeled.yml@main + secrets: inherit \ No newline at end of file diff --git a/.github/workflows/triage.yml b/.github/workflows/triage.yml index df75bc2..8a86133 100644 --- a/.github/workflows/triage.yml +++ b/.github/workflows/triage.yml @@ -12,62 +12,11 @@ on: types: - reopened - opened -# Remove all permissions by default -permissions: {} -# Avoid concurrency over the same issue -concurrency: - group: card-movement-${{ github.event_name != 'issues' && github.event.number || github.event.issue.number }} +permissions: + contents: read + pull-requests: write + issues: write jobs: - # For any opened or reopened issue, should be sent into Triage - send_to_board: - name: Organize triage - runs-on: ubuntu-latest - # Please note that projects cards are created/moved with Bitnami Bot - permissions: - contents: read - steps: - - name: Repo checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - with: - fetch-depth: 1 - - name: Load .env file - uses: xom9ikk/dotenv@de1ff27d319507880e6621e4d47424c677d95f68 - with: - path: .github/workflows/ - - name: Get author - id: get-issue - run: | - author="${{ github.event.issue != null && github.event.issue.user.login || github.event.pull_request.user.login }}" - number="${{ github.event_name != 'issues' && github.event.number || github.event.issue.number }}" - type="${{ github.event_name != 'issues' && 'pull_request' || 'issue' }}" - echo "author=${author}" >> $GITHUB_OUTPUT - echo "number=${number}" >> $GITHUB_OUTPUT - echo "type=${type}" >> $GITHUB_OUTPUT - - name: Send to the board - if: ${{steps.get-issue.outputs.author != 'bitnami-bot' || steps.get-issue.outputs.type != 'pull_request'}} - uses: peter-evans/create-or-update-project-card@dfa240db6fe287ceb681e45d6728c1af70452c58 - with: - project-name: Support - # If the author comes from Bitnami, send it to Bitnami. Otherwise, all to Triage - column-name: ${{ (contains(fromJson(env.BITNAMI_TEAM), steps.get-issue.outputs.author)) && 'From Bitnami' || 'Triage' }} - token: "${{ secrets.BITNAMI_BOT_TOKEN }}" - issue-number: ${{ steps.get-issue.outputs.number }} - labeling: - name: Set labels for Automated PRs - runs-on: ubuntu-latest - permissions: - pull-requests: write - if: ${{ github.event_name != 'issues' && github.event.pull_request.user.login == 'bitnami-bot' }} - # The project API is not efficient and requires several requests to create the project card. For that reason we decided to create - # a card for the automated PRs only when it is needed. - steps: - - name: From Bitnami labeling - uses: fmulero/labeler@f49bf680252fc8ac12cbebb6e0ed8ea19d0712da - with: - add-labels: 'automated, auto-merge' - - name: Verify labeling - uses: fmulero/labeler@f49bf680252fc8ac12cbebb6e0ed8ea19d0712da - with: - # Bitnami bot token is required to trigger CI workflows - repo-token: ${{ secrets.BITNAMI_BOT_TOKEN }} - add-labels: verify + call-triage-workflow: + uses: bitnami/support/.github/workflows/item-opened.yml@main + secrets: inherit \ No newline at end of file