Skip to content

Commit

Permalink
Committing changes (#192)
Browse files Browse the repository at this point in the history
Co-authored-by: dependjinbot <[email protected]>
  • Loading branch information
dependjinbot[bot] and dependjinbot authored May 22, 2023
1 parent b79180f commit eb5c20a
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 13 deletions.
21 changes: 11 additions & 10 deletions .github/workflows/auto_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
37 changes: 34 additions & 3 deletions .github/workflows/dependabot_approve_and_label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}'
Expand Down

0 comments on commit eb5c20a

Please sign in to comment.