mirror of
https://github.com/esphome/esphome.git
synced 2026-05-28 13:37:24 +08:00
[ci] Fix deprecated-component matcher (#15417)
This commit is contained in:
@@ -235,19 +235,20 @@ async function detectDeprecatedComponents(github, context, changedFiles) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get PR head to fetch files from the PR branch
|
// Get base branch ref to check if deprecation already exists for the component
|
||||||
const prNumber = context.payload.pull_request.number;
|
// This prevents flagging a PR that simply adds deprecation
|
||||||
|
const baseRef = context.payload.pull_request.base.ref;
|
||||||
|
|
||||||
// Check each component's __init__.py for DEPRECATED_COMPONENT constant
|
// Check each component's __init__.py for DEPRECATED_COMPONENT constant
|
||||||
for (const component of components) {
|
for (const component of components) {
|
||||||
const initFile = `esphome/components/${component}/__init__.py`;
|
const initFile = `esphome/components/${component}/__init__.py`;
|
||||||
try {
|
try {
|
||||||
// Fetch file content from PR head using GitHub API
|
// Fetch file content from base branch using GitHub API
|
||||||
const { data: fileData } = await github.rest.repos.getContent({
|
const { data: fileData } = await github.rest.repos.getContent({
|
||||||
owner,
|
owner,
|
||||||
repo,
|
repo,
|
||||||
path: initFile,
|
path: initFile,
|
||||||
ref: `refs/pull/${prNumber}/head`
|
ref: baseRef
|
||||||
});
|
});
|
||||||
|
|
||||||
// Decode base64 content
|
// Decode base64 content
|
||||||
|
|||||||
Reference in New Issue
Block a user