From 84269795e4950e16ee371cf8401a64f36ab2f0a6 Mon Sep 17 00:00:00 2001 From: Fran Mulero Date: Mon, 10 Oct 2022 10:08:30 +0200 Subject: [PATCH] [bitnami/charts] Fix movements for staled issues (#12841) * [bitnami/charts] Fix wrong column movements when issues or PRs are staled Signed-off-by: Fran Mulero * Allow run this workflow manually and force the GITHUB_TOKEN always Signed-off-by: Fran Mulero Signed-off-by: Fran Mulero --- .github/workflows/clossing-issues.yml | 5 +---- .github/workflows/comments.yml | 14 ++++++-------- .github/workflows/stale.yml | 25 ++++++++++++++++++++----- 3 files changed, 27 insertions(+), 17 deletions(-) diff --git a/.github/workflows/clossing-issues.yml b/.github/workflows/clossing-issues.yml index 5963c3643..f42813706 100644 --- a/.github/workflows/clossing-issues.yml +++ b/.github/workflows/clossing-issues.yml @@ -3,12 +3,9 @@ on: schedule: # Hourly - cron: '0 * * * *' - permissions: issues: write pull-requests: write - repository-projects: write - jobs: stale: runs-on: ubuntu-latest @@ -19,4 +16,4 @@ jobs: stale-issue-label: 'solved' days-before-stale: 0 days-before-close: 0 - repo-token: "${{ secrets.GITHUB_TOKEN }}" \ No newline at end of file + repo-token: ${{ secrets.BITNAMI_BOT_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/comments.yml b/.github/workflows/comments.yml index 8b994e2e5..31acc33ba 100644 --- a/.github/workflows/comments.yml +++ b/.github/workflows/comments.yml @@ -12,17 +12,15 @@ jobs: runs-on: ubuntu-latest steps: - name: Repo checkout - uses: actions/checkout@v2 - with: - fetch-depth: 1 + uses: actions/checkout@v3 - name: Load .env file uses: xom9ikk/dotenv@v1.0.2 with: path: .github/workflows/ - name: Move into From Build Maintenance uses: peter-evans/create-or-update-project-card@v2 - # The comment was created by bitnami-bot in a pull_request - if: ${{ github.actor == 'bitnami-bot' && github.event.issue.pull_request != null }} + # 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 @@ -31,7 +29,7 @@ jobs: - name: Move into Pending uses: peter-evans/create-or-update-project-card@v2 if: | - (github.actor != 'bitnami-bot' || github.event.issue.pull_request == null) && + (github.actor != 'bitnami-bot' || github.event.issue.user.login != 'bitnami-bot' || github.event.issue.pull_request == null) && (!contains(github.event.issue.labels.*.name, 'bitnami')) && contains(fromJson(env.BITNAMI_TEAM), github.actor) with: project-name: Support @@ -39,7 +37,7 @@ jobs: - name: Move into In Progress uses: peter-evans/create-or-update-project-card@v2 if: | - (github.actor != 'bitnami-bot' || github.event.issue.pull_request == null) && + (github.actor != 'bitnami-bot' || github.event.issue.user.login != 'bitnami-bot' || github.event.issue.pull_request == null) && contains(github.event.issue.labels.*.name, 'in-progress') && (!contains(fromJson(env.BITNAMI_TEAM), github.actor)) with: project-name: Support @@ -47,7 +45,7 @@ jobs: - name: Move into Triage uses: peter-evans/create-or-update-project-card@v2 if: | - (github.actor != 'bitnami-bot' || github.event.issue.pull_request == null) && + (github.actor != 'bitnami-bot' || github.event.issue.user.login != 'bitnami-bot' || github.event.issue.pull_request == null) && ((contains(github.event.issue.labels.*.name, 'triage')) || (contains(github.event.issue.labels.*.name, 'solved'))) && (!contains(fromJson(env.BITNAMI_TEAM), github.actor)) with: project-name: Support diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 5e5756631..40a4e5569 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -1,23 +1,38 @@ name: '[Support] Close stale issues and PRs' on: + workflow_dispatch: schedule: - cron: '0 1 * * *' permissions: issues: write pull-requests: write +# This job won't trigger any additional event. All actions are performed with GITHUB_TOKEN jobs: stale: runs-on: ubuntu-latest steps: - - uses: actions/stale@v3 + # This step will add the stale comment and label for the first 15 days without activity. It won't close any task + - uses: actions/stale@v4 with: - repo-token: ${{ secrets.BITNAMI_BOT_TOKEN }} + repo-token: ${{ secrets.GITHUB_TOKEN }} stale-issue-message: 'This Issue has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thanks for the feedback.' stale-pr-message: 'This Pull Request has been automatically marked as "stale" because it has not had recent activity (for 15 days). It will be closed if no further activity occurs. Thank you for your contribution.' - close-issue-message: 'Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.' - close-pr-message: 'Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Pull Request. Do not hesitate to reopen it later if necessary.' days-before-stale: 15 - days-before-close: 5 + days-before-close: -1 exempt-issue-labels: 'on-hold' exempt-pr-labels: 'on-hold' operations-per-run: 500 + # This step will add the 'solved' label and the last comment before closing the issue or PR. Note that it won't close any issue or PR, they will be closed by the clossing-issues workflow + - uses: actions/stale@v4 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-message: 'Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Issue. Do not hesitate to reopen it later if necessary.' + stale-pr-message: 'Due to the lack of activity in the last 5 days since it was marked as "stale", we proceed to close this Pull Request. Do not hesitate to reopen it later if necessary.' + any-of-labels: 'stale' + stale-issue-label: 'solved' + stale-pr-label: 'solved' + days-before-stale: 5 + days-before-close: -1 + exempt-issue-labels: 'on-hold' + exempt-pr-labels: 'on-hold' + operations-per-run: 200