mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-06-05 21:03:40 +00:00
ci/github-script/manual-file-edits: skip on PRs from one dev branch to another
Same logic as in lint-commits. Fixes https://matrix.to/#/!EoslJfrUGMtQOAfnht:lassul.us/$govFR3OHnME2TZh7tcDSJfXAEfnMVUevnv4l5y4qFD0?via=nixos.org&via=matrix.org&via=catgirl.cloud
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
// @ts-check
|
||||
const { classify } = require('../supportedBranches.js')
|
||||
const { getCommitDetailsForPR } = require('./get-pr-commit-details')
|
||||
|
||||
/**
|
||||
@@ -32,6 +33,27 @@ async function checkManualFileEdits({ github, context, core, repoPath, dry }) {
|
||||
return
|
||||
}
|
||||
|
||||
const baseBranchType = classify(
|
||||
pr.base.ref.replace(/^refs\/heads\//, ''),
|
||||
).type
|
||||
const headBranchType = classify(
|
||||
pr.head.ref.replace(/^refs\/heads\//, ''),
|
||||
).type
|
||||
|
||||
if (
|
||||
baseBranchType.includes('development') &&
|
||||
headBranchType.includes('development') &&
|
||||
pr.base.repo.id === pr.head.repo?.id
|
||||
) {
|
||||
// This matches, for example, PRs from NixOS:staging-next to NixOS:master, or vice versa.
|
||||
// Ignore them: we should only care about PRs introducing *new* commits.
|
||||
// We still want to run on PRs from, e.g., Someone:master to NixOS:master, though.
|
||||
core.info(
|
||||
'This PR is from one development branch to another. Skipping checks.',
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
const details = await getCommitDetailsForPR({ core, pr, repoPath })
|
||||
|
||||
if (
|
||||
|
||||
Reference in New Issue
Block a user