Compare commits
2
Commits
d4e7c9127d
..
dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1f256b236c | ||
|
|
36a546c224 |
No files matched your search
@@ -161,6 +161,21 @@ jobs:
|
|||||||
# Read release notes
|
# Read release notes
|
||||||
BODY=$(cat release_notes.txt)
|
BODY=$(cat release_notes.txt)
|
||||||
|
|
||||||
|
# Check if release already exists for this tag
|
||||||
|
EXISTING_RELEASE=$(curl -s \
|
||||||
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
|
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases/tags/${TAG_NAME}")
|
||||||
|
|
||||||
|
EXISTING_ID=$(echo "$EXISTING_RELEASE" | jq -r '.id // empty')
|
||||||
|
|
||||||
|
if [ -n "$EXISTING_ID" ] && [ "$EXISTING_ID" != "null" ]; then
|
||||||
|
echo "Release already exists for tag ${TAG_NAME} (ID: $EXISTING_ID). Deleting..."
|
||||||
|
curl -s -X DELETE \
|
||||||
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
|
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/releases/${EXISTING_ID}"
|
||||||
|
echo "Deleted existing release."
|
||||||
|
fi
|
||||||
|
|
||||||
# Create release via Gitea API
|
# Create release via Gitea API
|
||||||
RELEASE_RESPONSE=$(curl -s -X POST \
|
RELEASE_RESPONSE=$(curl -s -X POST \
|
||||||
-H "Authorization: token ${GITEA_TOKEN}" \
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
||||||
|
|||||||
@@ -443,23 +443,25 @@ final class Manager {
|
|||||||
public static function is_localhost(): bool {
|
public static function is_localhost(): bool {
|
||||||
$host = wp_parse_url( home_url(), PHP_URL_HOST );
|
$host = wp_parse_url( home_url(), PHP_URL_HOST );
|
||||||
|
|
||||||
// Common localhost identifiers.
|
$localhost_patterns = array(
|
||||||
$localhost_hosts = array(
|
|
||||||
'localhost',
|
'localhost',
|
||||||
'127.0.0.1',
|
'127.0.0.1',
|
||||||
'::1',
|
'::1',
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( in_array( $host, $localhost_hosts, true ) ) {
|
// Check exact matches.
|
||||||
|
if ( in_array( $host, $localhost_patterns, true ) ) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Common local development TLDs.
|
// Check .localhost TLD (e.g., mysite.localhost).
|
||||||
$local_tlds = array( '.local', '.test', '.localhost', '.dev.local' );
|
if ( str_ends_with( $host, '.localhost' ) ) {
|
||||||
foreach ( $local_tlds as $tld ) {
|
|
||||||
if ( str_ends_with( $host, $tld ) ) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check .local TLD (common for local development).
|
||||||
|
if ( str_ends_with( $host, '.local' ) ) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -76,6 +76,30 @@ class Integration {
|
|||||||
return $this->prometheus_active;
|
return $this->prometheus_active;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Collect metrics for early metrics mode.
|
||||||
|
*
|
||||||
|
* This static method can be called directly by wp-prometheus during early
|
||||||
|
* metrics mode when the wp_prometheus_collect_metrics hook is skipped.
|
||||||
|
*
|
||||||
|
* Usage in wp-prometheus early metrics handler:
|
||||||
|
*
|
||||||
|
* ```php
|
||||||
|
* // After creating the collector, before rendering:
|
||||||
|
* if ( class_exists( 'WP_FediStream\Prometheus\Integration' ) ) {
|
||||||
|
* \WP_FediStream\Prometheus\Integration::collect_early_metrics( $collector );
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param object $collector The Prometheus collector instance.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function collect_early_metrics( object $collector ): void {
|
||||||
|
$integration = new self();
|
||||||
|
$integration->prometheus_active = true; // Force active since we're being called directly.
|
||||||
|
$integration->collect_metrics( $collector );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Collect FediStream metrics.
|
* Collect FediStream metrics.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in new issue
Block a user