Skip to content

Commit

Permalink
Fix winlibs uploads
Browse files Browse the repository at this point in the history
  • Loading branch information
shivammathur committed Feb 14, 2025
1 parent b7d5d36 commit 820056e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/winlibs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ on:
php_versions:
description: 'PHP Versions'
required: true
vs_version:
description: 'VS Versions'
required: true
vs_version_targets:
description: 'VS Version Targets'
required: true
Expand Down
2 changes: 1 addition & 1 deletion src/Actions/GetArtifacts.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public function handle($workflow_run_id, $token): void
{
$ch = curl_init();

$base_url = "https://api.github.com/repos/";
$base_url = "https://api.github.com/repos";

$repo = "winlibs/winlib-builder";

Expand Down
5 changes: 2 additions & 3 deletions src/Http/Controllers/WinlibsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ protected function validate(array $data): bool
'library' => 'required|string',
'ref' => 'required|string',
'workflow_run_id' => 'required|string',
'php_versions' => 'required|string|regex:/^\d+\.\d+$}|^master$/',
'vs_version' => 'required|string|regex:/^(v[c|s]\d{2})(,v[c|s]\d{2})*$/',
'vs_version_targets' => 'required|string|regex:/^v[c|s]\d{2}$/',
'php_versions' => 'required|string|regex:/^(?:\d+\.\d+|master)(?:,\s*(?:\d+\.\d+|master))*$/',
'vs_version_targets' => 'required|string|regex:/^(v[c|s]\d{2})(,v[c|s]\d{2})*$/',
'stability' => 'required|string|regex:/^(stable|staging)(,(stable|staging))?$/',
'token' => 'required|string',
]);
Expand Down
14 changes: 11 additions & 3 deletions src/Validator.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,17 @@ public function validate(array $data): void
$this->errors = [];

foreach ($this->rules as $field => $ruleString) {
$rulesArray = explode('|', $ruleString);
foreach ($rulesArray as $rule) {
$ruleParts = explode(':', $rule);
$regexPos = strpos($ruleString, 'regex:');
if ($regexPos !== false) {
$nonRegexPart = substr($ruleString, 0, $regexPos);
$nonRegexRules = array_filter(explode('|', rtrim($nonRegexPart, '|')));
$regexRule = substr($ruleString, $regexPos);
$rules = array_merge($nonRegexRules, [$regexRule]);
} else {
$rules = array_filter(explode('|', $ruleString));
}
foreach ($rules as $rule) {
$ruleParts = explode(':', $rule, 2);
$ruleName = $ruleParts[0];
$ruleValue = $ruleParts[1] ?? null;

Expand Down

0 comments on commit 820056e

Please sign in to comment.