Skip to content

Commit

Permalink
Merge pull request #332 from matthiasdg/feature/no_fixed_url
Browse files Browse the repository at this point in the history
Support for GitHub enterprise
  • Loading branch information
arnested committed Dec 1, 2023
2 parents c41aab7 + 014bfb3 commit dc74996
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
3 changes: 3 additions & 0 deletions docker-compose.override.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ services:
# Repo name (normally set automatically by the action) eg.
# 'reload/github-security-jira'.
GITHUB_REPOSITORY: reload/github-security-jira
# GitHub URLs (normally set automatically by the action)
GITHUB_GRAPHQL_URL: https://api.github.com/graphql
GITHUB_SERVER_URL: https://github.com
# In repos, this is the 'GitHubSecurityToken' secret.
GH_SECURITY_TOKEN: github_pat
# In repos, this is the 'JiraApiToken' secret.
Expand Down
3 changes: 2 additions & 1 deletion src/PullRequestIssue.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ public function __construct(array $data)
$this->safeVersion = \preg_filter('/.*to ([^ ]+).*/', '$1', $data['title']) ?? '';

$githubRepo = \getenv('GITHUB_REPOSITORY') ?: '';
$githubUrl = \getenv('GITHUB_SERVER_URL') ?: 'https://github.com';

$body = <<<EOT
- Repository: [{$githubRepo}|https://github.com/{$githubRepo}]
- Repository: [{$githubRepo}|{$githubUrl}/{$githubRepo}]
- Package: {$this->package}
- Secure version: {$this->safeVersion}
- Pull request with more info: [#{$data['number']}|{$data['url']}]
Expand Down
5 changes: 3 additions & 2 deletions src/SecurityAlertIssue.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,12 @@ public function __construct(array $data)
$advisory_description = \wordwrap($data['securityVulnerability']['advisory']['description'] ?? '', 100);
$ecosystem = $data['securityVulnerability']['package']['ecosystem'] ?? '';
$githubRepo = \getenv('GITHUB_REPOSITORY') ?: '';
$githubUrl = \getenv('GITHUB_SERVER_URL') ?: 'https://github.com';
$safeVersion = $this->safeVersion ?? 'no fix';

$body = <<<EOT
- Repository: [{$githubRepo}|https://github.com/{$githubRepo}]
- Alert: [{$this->advisorySummary}|https://github.com/{$githubRepo}/security/dependabot/{$this->alertNumber}]
- Repository: [{$githubRepo}|{$githubUrl}/{$githubRepo}]
- Alert: [{$this->advisorySummary}|{$githubUrl}/{$githubRepo}/security/dependabot/{$this->alertNumber}]
- Package: {$this->package} ($ecosystem)
- Vulnerable version: {$this->vulnerableVersionRange}
- Secure version: {$safeVersion}
Expand Down
4 changes: 2 additions & 2 deletions src/SyncCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ protected function fetchPullRequestData(): array
protected function getGHClient(): GraphQLClient
{
$access_token = \getenv('GH_SECURITY_TOKEN');

return ClientBuilder::build('https://api.github.com/graphql', [
$graphql_url = \getenv('GITHUB_GRAPHQL_URL') ?: 'https://api.github.com/graphql';
return ClientBuilder::build($graphql_url, [
'headers' => [
'Accept' => 'application/json',
'Authorization' => "Bearer {$access_token}",
Expand Down

0 comments on commit dc74996

Please sign in to comment.