Merge pull request #513 from liedekef/patch-1

Fix release asset filtering bug and treat `main` as a default branch.
This commit is contained in:
Yahnis Elsts 2023-01-03 17:05:04 +02:00 committed by GitHub
commit 7457e85680
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -114,7 +114,7 @@ if ( !class_exists(GitHubApi::class, false) ):
if ( $this->releaseAssetsEnabled ) {
//Use the first release asset that matches the specified regular expression.
if ( isset($release->assets, $release->assets[0]) ) {
$matchingAssets = array_filter($release->assets, array($this, 'matchesAssetFilter'));
$matchingAssets = array_values(array_filter($release->assets, array($this, 'matchesAssetFilter')));
} else {
$matchingAssets = array();
}
@ -358,7 +358,7 @@ if ( !class_exists(GitHubApi::class, false) ):
protected function getUpdateDetectionStrategies($configBranch) {
$strategies = array();
if ( $configBranch === 'master' ) {
if ( $configBranch === 'master' || $configBranch === 'main') {
//Use the latest release.
$strategies[self::STRATEGY_LATEST_RELEASE] = array($this, 'getLatestRelease');
//Failing that, use the tag with the highest version number.