This is an automated email from the ASF dual-hosted git repository.
derrickaw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new d3d6e484a74 add closing dependabot step (#39649)
d3d6e484a74 is described below
commit d3d6e484a74fb744078d0f0578b4b329f85f9060
Author: Derrick Williams <[email protected]>
AuthorDate: Fri Aug 7 13:18:20 2026 -0400
add closing dependabot step (#39649)
* add closing step
* remove gha precommit changes and move them to new pr workflow
---
scripts/ci/pr-bot/processNewPrs.ts | 20 ++++++++++++++++++++
scripts/ci/pr-bot/shared/githubUtils.ts | 21 +++++++++++++++++++++
2 files changed, 41 insertions(+)
diff --git a/scripts/ci/pr-bot/processNewPrs.ts
b/scripts/ci/pr-bot/processNewPrs.ts
index 776ae8aa83a..dd20d4a98c2 100644
--- a/scripts/ci/pr-bot/processNewPrs.ts
+++ b/scripts/ci/pr-bot/processNewPrs.ts
@@ -182,6 +182,26 @@ async function processPull(
reviewerConfig: typeof ReviewerConfig,
stateClient: typeof PersistentState
) {
+ if (pull.user.login === "dependabot[bot]") {
+ const files = await github.getPrFiles(pull.number);
+ const touchesContainer = files.some((file: string) =>
+ file.startsWith("sdks/python/container/")
+ );
+ if (touchesContainer) {
+ console.log(
+ `Closing PR ${pull.number} because it is a dependabot PR touching
container/`
+ );
+ await github.addPrComment(
+ pull.number,
+ "Closing this PR because dependabot updates for container/** are not
allowed due to generated files " +
+ "and excluded_paths is disabled due to
dependabot/dependabot-core#14408. " +
+ "Once issue is resolved, please remove this step."
+ );
+ await github.closePr(pull.number);
+ return;
+ }
+ }
+
let prState = await stateClient.getPrState(pull.number);
if (!needsProcessed(pull, prState)) {
return;
diff --git a/scripts/ci/pr-bot/shared/githubUtils.ts
b/scripts/ci/pr-bot/shared/githubUtils.ts
index 667255b1692..0d287bd0937 100644
--- a/scripts/ci/pr-bot/shared/githubUtils.ts
+++ b/scripts/ci/pr-bot/shared/githubUtils.ts
@@ -70,6 +70,27 @@ export async function nextActionAuthor(
});
}
+export async function closePr(pullNumber: number) {
+ await getGitHubClient().rest.pulls.update({
+ owner: REPO_OWNER,
+ repo: REPO,
+ pull_number: pullNumber,
+ state: "closed",
+ });
+}
+
+export async function getPrFiles(pullNumber: number): Promise<string[]> {
+ const files = await getGitHubClient().paginate(
+ getGitHubClient().rest.pulls.listFiles,
+ {
+ owner: REPO_OWNER,
+ repo: REPO,
+ pull_number: pullNumber,
+ }
+ );
+ return files.map((file: any) => file.filename);
+}
+
export async function checkIfCommitter(username: string): Promise<boolean> {
const permissionLevel = (
await getGitHubClient().rest.repos.getCollaboratorPermissionLevel({