Skip to content

Commit

Permalink
obtain correct beta branch name for homebridge
Browse files Browse the repository at this point in the history
  • Loading branch information
bwp91 committed Oct 29, 2023
1 parent 7186f1f commit 212b3eb
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 557 deletions.
70 changes: 35 additions & 35 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"@nestjs/swagger": "7.1.14",
"@nestjs/websockets": "10.2.7",
"@oznu/hap-client": "1.9.0",
"axios": "1.5.1",
"axios": "1.6.0",
"class-transformer": "0.5.1",
"class-validator": "0.14.0",
"commander": "7.2.0",
Expand All @@ -84,7 +84,7 @@
"reflect-metadata": "0.1.13",
"rxjs": "7.8.1",
"semver": "7.5.4",
"systeminformation": "5.21.13",
"systeminformation": "5.21.15",
"tail": "2.2.6",
"tar": "6.2.0",
"tcp-port-used": "1.0.2",
Expand All @@ -108,7 +108,7 @@
"eslint": "^8.52.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-jest": "^27.4.3",
"eslint-plugin-jest": "^27.6.0",
"form-data": "^4.0.0",
"jest": "^29.7.0",
"lodash": "^4.17.21",
Expand Down Expand Up @@ -153,4 +153,4 @@
"smart home",
"hb-service"
]
}
}
17 changes: 15 additions & 2 deletions src/modules/plugins/plugins.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -840,11 +840,24 @@ export class PluginsService {

// if loading a homebridge beta returned pre-defined help text
if (plugin.name === 'homebridge' && plugin.latestVersion?.includes('beta')) {
// Query the list of branches for the repo, if the request doesn't work it doesn't matter too much
let betaBranch: string;

try {
// Find the first branch that starts with "beta"
betaBranch = (await this.httpService.get('https://api.github.com/repos/homebridge/homebridge/branches').toPromise())
.data
.find((branch: any) => branch.name.startsWith('beta'))
?.name;
} catch (e) {
this.logger.error(`Failed to get list of branches from GitHub: ${e.message}`);
}

return {
name: 'v' + plugin.latestVersion,
changelog: 'Thank you for helping improve Homebridge by testing the beta build of Homebridge.\n\n\n' +
'To see what needs testing or to report issues: https://github.com/homebridge/homebridge/issues\n\n\n' +
'See the commit history for recent changes: https://github.com/homebridge/homebridge/commits/beta'
'To see what needs testing or to report issues: https://github.com/homebridge/homebridge/issues' +
`${betaBranch && `\n\n\nSee the commit history for recent changes: https://github.com/homebridge/homebridge/commits/${betaBranch}`}`,
};
}

Expand Down
Loading

0 comments on commit 212b3eb

Please sign in to comment.