Skip to content

Commit

Permalink
Merge branch 'main' into dependabot-github_actions-actions-dependency…
Browse files Browse the repository at this point in the history
…-review-action-4
  • Loading branch information
github-actions[bot] authored Sep 16, 2024
2 parents 9f55bcd + f7bd793 commit 12ea9bd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
8 changes: 4 additions & 4 deletions .github/scripts/update-prs.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ const updatePrs = async ({ github, context }) => {
per_page: 100
});

const nonDraftPulls = pulls?.data?.filter((pr) => !pr.draft);
const nonDraftAndDependabotPulls = pulls?.data?.filter((pr) => !pr.draft && pr.user.login !== "dependabot[bot]");
let updatedBranches = 0;

if (nonDraftPulls?.length > 0) {
for (const pr of nonDraftPulls) {
if (nonDraftAndDependabotPulls?.length > 0) {
for (const pr of nonDraftAndDependabotPulls) {
try {
await github.rest.pulls.updateBranch({
owner,
Expand All @@ -28,7 +28,7 @@ const updatePrs = async ({ github, context }) => {
}
}

return `Updated branches: ${updatedBranches}/${nonDraftPulls.length}`;
return `Updated branches: ${updatedBranches}/${nonDraftAndDependabotPulls.length}`;
};

export default updatePrs;
42 changes: 21 additions & 21 deletions .github/workflows/update-prs.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
# ---
# name: Update all PR branches if main gets update
---
name: Update all PR branches if main gets update

# on:
# push:
# branches:
# - "main"
on:
push:
branches:
- "main"

# jobs:
# update-prs:
# name: Update PRs
# runs-on: ubuntu-latest
# steps:
# - name: ⬇ Checkout repo
# uses: actions/checkout@v3
jobs:
update-prs:
name: Update PRs
runs-on: ubuntu-latest
steps:
- name: ⬇ Checkout repo
uses: actions/checkout@v3

# - name: ⌚ Update PRs
# id: update-prs
# uses: actions/github-script@v6
# with:
# script: |
# const { default: updatePrs } = await import('${{ github.workspace }}/.github/scripts/update-prs.js');
# // print how many PRs are updated
# console.log(await updatePrs({github, context}));
- name: ⌚ Update PRs
id: update-prs
uses: actions/github-script@v6
with:
script: |
const { default: updatePrs } = await import('${{ github.workspace }}/.github/scripts/update-prs.js');
// print how many PRs are updated
console.log(await updatePrs({github, context}));

0 comments on commit 12ea9bd

Please sign in to comment.