diff --git a/.github/workflows/comments.yml b/.github/workflows/comments.yml index a2e4ce7e2942..5d1aa23df74d 100644 --- a/.github/workflows/comments.yml +++ b/.github/workflows/comments.yml @@ -1,4 +1,4 @@ -name: '[Support] Organizing cards based on comments' +name: '[Support] Comments based card movements' on: issue_comment: types: @@ -7,6 +7,9 @@ permissions: repository-projects: write issues: write pull-requests: write +# Avoid concurrency over the same issue +concurrency: + group: card-movement-${{ github.event.issue.number }} jobs: comments_handler: runs-on: ubuntu-latest diff --git a/.github/workflows/delete-solved-cards.yml b/.github/workflows/delete-solved-cards.yml new file mode 100644 index 000000000000..e957a0375902 --- /dev/null +++ b/.github/workflows/delete-solved-cards.yml @@ -0,0 +1,39 @@ +name: '[Support] Delete Solved cards' +on: + workflow_dispatch: + schedule: + # Every 2 hours + - cron: '15 0/2 * * *' +permissions: + repository-projects: write +jobs: + delete-cards: + runs-on: ubuntu-latest + steps: + - name: Repo checkout + uses: actions/checkout@v3 + with: + fetch-depth: 1 + - name: Load .env file + uses: xom9ikk/dotenv@v2 + with: + path: .github/workflows/ + - uses: actions/github-script@v6 + with: + script: | + const {data: cards} = await github.rest.projects.listCards({ + column_id: ${{ env.SOLVED_COLUMN_ID }}, + archived_state: 'all', + per_page: 100 + }); + // Remove cards without updates in last week. + const comparedDate = new Date(); + comparedDate.setDate(comparedDate.getDate() - 7); + cards.forEach(card => { + const lastUpdate = new Date(card.updated_at); + if (card.archived || lastUpdate < comparedDate ) { + github.rest.projects.deleteCard({ + card_id: card.id + }); + } + }); diff --git a/.github/workflows/move-closed-issues.yml b/.github/workflows/move-closed-issues.yml index 15dc12b11d0c..0a42da248ef8 100644 --- a/.github/workflows/move-closed-issues.yml +++ b/.github/workflows/move-closed-issues.yml @@ -6,14 +6,30 @@ on: pull_request_target: types: - closed +permissions: + repository-projects: write +# Avoid concurrency over the same issue +concurrency: + group: card-movement-${{ github.event_name != 'issues' && github.event.number || github.event.issue.number }} 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@v2 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 }} \ No newline at end of file + issue-number: ${{ github.event_name != 'issues' && github.event.number || github.event.issue.number }} + - name: Remove cards from automated PRs + if: | + (github.event.issue != null && github.event.issue.user.login == 'bitnami-bot') || + (github.event.issue == null && github.event.pull_request.user.login == 'bitnami-bot') + uses: actions/github-script@v6 + with: + script: | + github.rest.projects.deleteCard({ + card_id: ${{ steps.send-solved.outputs.card-id }} + }); diff --git a/.github/workflows/pr-reviews.yml b/.github/workflows/pr-reviews.yml index 0c293406346c..9f69125a3371 100644 --- a/.github/workflows/pr-reviews.yml +++ b/.github/workflows/pr-reviews.yml @@ -6,8 +6,10 @@ on: - synchronize permissions: repository-projects: write +concurrency: + group: card-movement-${{ github.event.number }} jobs: - comments_handler: + handler: runs-on: ubuntu-latest # This job will ignore: # * Events triggered by bitnami-bot (README commits for example). @@ -15,11 +17,11 @@ jobs: # * PRs with 'bitnami' label. if: | github.actor != 'bitnami-bot' && github.event.pull_request.user.login != 'bitnami-bot' && - (!contains(github.event.pull_request.labels.*.name, 'bitnami')) + (!contains(github.event.pull_request.labels.*.name, 'bitnami')) && (!contains(github.event.pull_request.labels.*.name, 'triage')) steps: - name: Move into In Progress uses: peter-evans/create-or-update-project-card@v2 with: project-name: Support column-name: In progress - issue-number: ${{ github.event.pull_request.number }} + issue-number: ${{ github.event.number }} diff --git a/.github/workflows/triage.yml b/.github/workflows/triage.yml index 743d03188d96..8505ee9c5a71 100644 --- a/.github/workflows/triage.yml +++ b/.github/workflows/triage.yml @@ -9,6 +9,9 @@ on: types: - reopened - opened +# Avoid concurrency over the same issue +concurrency: + group: card-movement-${{ github.event_name != 'issues' && github.event.number || github.event.issue.number }} jobs: # For any opened or reopened issue, should be sent into Triage send_to_board: @@ -27,12 +30,14 @@ jobs: 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 }}" echo "author=${author}" >> $GITHUB_OUTPUT + echo "number=${number}" >> $GITHUB_OUTPUT - name: Send to the board uses: peter-evans/create-or-update-project-card@v2 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)) && 'Triage' || 'From Bitnami' }} + column-name: ${{ (contains(fromJson(env.BITNAMI_TEAM), steps.get-issue.outputs.author)) && 'From Bitnami' || 'Triage' }} token: "${{ secrets.BITNAMI_BOT_TOKEN }}" - issue-number: ${{ github.event_name != 'issues' && github.event.number || github.event.issue.number }} + issue-number: ${{ steps.get-issue.outputs.number }} \ No newline at end of file