From ad896ed36f71d4ff54cbfd6314f51c5121dfe18e Mon Sep 17 00:00:00 2001 From: "dependjinbot[bot]" <71271483+dependjinbot[bot]@users.noreply.github.com> Date: Mon, 22 May 2023 14:03:21 +0000 Subject: [PATCH] Bump Endjin.PRAutoflow from 0.0.0 to 0.1.8 in .github/workflows (#69) * Committing changes * Committing changes * Committing changes * Committing changes --------- Co-authored-by: dependjinbot --- .github/workflows/auto_release.yml | 21 ++++++----- .../dependabot_approve_and_label.yml | 37 +++++++++++++++++-- 2 files changed, 45 insertions(+), 13 deletions(-) diff --git a/.github/workflows/auto_release.yml b/.github/workflows/auto_release.yml index 66833ae..d5701b5 100644 --- a/.github/workflows/auto_release.yml +++ b/.github/workflows/auto_release.yml @@ -111,20 +111,21 @@ jobs: const pulls = await github.rest.search.issuesAndPullRequests({ q: `is:pr repo:${repoWithOwner} is:merged`, }); - allPrs = pulls.data.items.map(p=>`#${p.number} '${p.title}' in ${p.repository_url}`); + const allPrs = pulls.data.items.map(p=>`#${p.number} '${p.title}' in ${p.repository_url}`); core.info(`allPrs: ${JSON.stringify(allPrs)}`); - releasePendingPrDetails = pulls.data.items. - filter(function (x) { return x.labels.map(l=>l.name).includes('pending_release') }). - map(p=>`#${p.number} '${p.title}' in ${p.repository_url}`); + const releasePendingPrs = pulls.data.items. + filter(function (x) { return x.labels.map(l=>l.name).includes('pending_release') }). + filter(function (x) { return !x.labels.map(l=>l.name).includes('no_release') }); + + const releasePendingPrDetails = releasePendingPrs.map(p=>`#${p.number} '${p.title}' in ${p.repository_url}`); core.info(`releasePendingPrDetails: ${JSON.stringify(releasePendingPrDetails)}`); - const release_pending_prs = pulls.data.items. - filter(function (x) { return x.labels.map(l=>l.name).includes('pending_release') }). - map(p=>p.number); - core.info(`release_pending_prs: ${JSON.stringify(release_pending_prs)}`); - core.setOutput('is_release_pending', (release_pending_prs.length > 0)); - return JSON.stringify(release_pending_prs); + const releasePendingPrNumbers = releasePendingPrs.map(p=>p.number); + core.info(`release_pending_prs: ${JSON.stringify(releasePendingPrNumbers)}`); + + core.setOutput('is_release_pending', (releasePendingPrNumbers.length > 0)); + return JSON.stringify(releasePendingPrNumbers); result-encoding: string - name: Display release_pending_pr_list diff --git a/.github/workflows/dependabot_approve_and_label.yml b/.github/workflows/dependabot_approve_and_label.yml index a6de80c..ae1838d 100644 --- a/.github/workflows/dependabot_approve_and_label.yml +++ b/.github/workflows/dependabot_approve_and_label.yml @@ -90,9 +90,37 @@ jobs: body: "Bumps '${{needs.evaluate_dependabot_pr.outputs.dependency_name}}' from ${{needs.evaluate_dependabot_pr.outputs.version_from}} to ${{needs.evaluate_dependabot_pr.outputs.version_to}}" }) + check_for_norelease_label: + runs-on: ubuntu-latest + outputs: + no_release: ${{ steps.check_for_norelease_label.outputs.result }} + steps: + - name: Check for 'no_release' label on PR + id: check_for_norelease_label + uses: actions/github-script@v6 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const labels = await github.rest.issues.listLabelsOnIssue({ + owner: context.payload.repository.owner.login, + repo: context.payload.repository.name, + issue_number: context.payload.number + }); + core.info("labels: " + JSON.stringify(labels.data)) + if ( labels.data.map(l => l.name).includes("no_release") ) { + core.info("Label found") + return true + } + return false + - name: Display 'no_release' status + run: | + echo "no_release: ${{ steps.check_for_norelease_label.outputs.result }}" + label_auto_merge: runs-on: ubuntu-latest - needs: evaluate_dependabot_pr + needs: + - evaluate_dependabot_pr + - check_for_norelease_label name: 'Automerge & Label' steps: # Get a token for a different identity so any auto-merge that happens in the next step is @@ -117,8 +145,11 @@ jobs: GITHUB_TOKEN: '${{ steps.generate_token.outputs.token }}' - name: 'Label non-dependabot PRs and auto-releasable dependabot PRs with "pending_release"' if: | - (github.actor != 'dependabot[bot]' && github.actor != 'dependjinbot[bot]') || - needs.evaluate_dependabot_pr.outputs.is_auto_release_candidate == 'True' + needs.check_for_norelease_label.outputs.no_release == 'false' && + ( + (github.actor != 'dependabot[bot]' && github.actor != 'dependjinbot[bot]') || + needs.evaluate_dependabot_pr.outputs.is_auto_release_candidate == 'True' + ) uses: actions/github-script@v6 with: github-token: '${{ secrets.GITHUB_TOKEN }}'