Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ jobs:

- name: Deploy
run: php ./tempest deploy
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}



2 changes: 1 addition & 1 deletion deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ php8.4 tempest cache:clear --all
php8.4 tempest discovery:generate
php8.4 tempest migrate:up --force
php8.4 tempest static:clean --force
php8.4 tempest static:generate
php8.4 tempest static:generate --verbose=true

# Supervisor
sudo supervisorctl restart all
15 changes: 14 additions & 1 deletion src/GitHub/GetLatestRelease.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
use Tempest\HttpClient\HttpClient;
use Throwable;

use function Tempest\env;

final class GetLatestRelease
{
public function __construct(
Expand All @@ -15,12 +17,23 @@ public function __construct(

public function __invoke(): ?string
{
// Added by Aidan Casey to combat the GitHub rate limits.
// We will inject the GH_TOKEN using our workflow.
$headers = [];

if ($githubToken = env('GH_TOKEN')) {
$headers['Authorization'] = 'Bearer ' . $githubToken;
}

// Default release to the currently running version of Tempest.
$defaultRelease = sprintf('v%s', Kernel::VERSION);

try {
$body = $this->httpClient
->get('https://api.github.com/repos/tempestphp/tempest-framework/releases/latest')
->get(
uri: 'https://api.github.com/repos/tempestphp/tempest-framework/releases/latest',
headers: $headers,
)
->body;

return json_decode($body)->tag_name ?? $defaultRelease;
Expand Down
15 changes: 14 additions & 1 deletion src/GitHub/GetStargazersCount.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
use Tempest\HttpClient\HttpClient;
use Throwable;

use function Tempest\env;

final class GetStargazersCount
{
public function __construct(
Expand All @@ -14,8 +16,19 @@ public function __construct(

public function __invoke(): ?string
{
// Added by Aidan Casey to combat the GitHub rate limits.
// We will inject the GH_TOKEN using our workflow.
$headers = [];

if ($githubToken = env('GH_TOKEN')) {
$headers['Authorization'] = 'Bearer ' . $githubToken;
}

try {
$body = $this->httpClient->get('https://api.github.com/repos/tempestphp/tempest-framework')->body;
$body = $this->httpClient->get(
uri: 'https://api.github.com/repos/tempestphp/tempest-framework',
headers: $headers,
)->body;
$stargazers = json_decode($body)->stargazers_count ?? null;

return $stargazers > 999
Expand Down