Skip to content

Commit

Permalink
Fix GitHub spelling (#8118)
Browse files Browse the repository at this point in the history
  • Loading branch information
szakarias authored Oct 7, 2024
1 parent 91d82f8 commit 2bab85a
Show file tree
Hide file tree
Showing 18 changed files with 90 additions and 90 deletions.
10 changes: 5 additions & 5 deletions app/lib/account/agent.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ abstract class KnownAgents {
///
/// Deprecated and should not be used for new audit-log entries.
/// This value is still present in some older audit-log entries.
static const _genericGithubActions = 'service:github-actions';
static const _genericGitHubActions = 'service:github-actions';

/// Non-specific agent - only specifies it is from GCP Service Account.
///
Expand Down Expand Up @@ -67,7 +67,7 @@ abstract class KnownAgents {
];

static const _nonSpecificAgentIds = <String>{
_genericGithubActions,
_genericGitHubActions,
_genericGcpServiceAccount,
pubSupport,
};
Expand Down Expand Up @@ -132,15 +132,15 @@ abstract class AuthenticatedAgent {
/// Holds the authenticated GitHub Action information.
///
/// The [agentId] has the following format: `service:github-actions:<repositoryOwnerId>/<repositoryId>`
class AuthenticatedGithubAction implements AuthenticatedAgent {
class AuthenticatedGitHubAction implements AuthenticatedAgent {
@override
late final agentId = KnownAgents.githubActionsAgentId(
repositoryOwnerId: payload.repositoryOwnerId,
repositoryId: payload.repositoryId,
);

@override
String get displayId => KnownAgents._genericGithubActions;
String get displayId => KnownAgents._genericGitHubActions;

/// OIDC `id_token` the request was authenticated with.
///
Expand All @@ -155,7 +155,7 @@ class AuthenticatedGithubAction implements AuthenticatedAgent {
/// The parsed, GitHub-specific JWT payload.
final GitHubJwtPayload payload;

AuthenticatedGithubAction({
AuthenticatedGitHubAction({
required this.idToken,
required this.payload,
}) {
Expand Down
2 changes: 1 addition & 1 deletion app/lib/account/backend.dart
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ Future<AuthenticatedAgent?> _tryAuthenticateServiceAgent(String token) async {
if (payload == null) {
throw AuthenticationException.tokenInvalid('unable to parse payload');
}
return AuthenticatedGithubAction(
return AuthenticatedGitHubAction(
idToken: idToken,
payload: payload,
);
Expand Down
2 changes: 1 addition & 1 deletion app/lib/account/default_auth_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ abstract class BaseAuthProvider extends AuthProvider {
if (idToken.payload.iss == GitHubJwtPayload.issuerUrl) {
// The token claims to be issued by GitHub. If there is any problem
// with the token, the authentication should fail without any fallback.
await _verifyToken(idToken, openIdDataFetch: fetchGithubOpenIdData);
await _verifyToken(idToken, openIdDataFetch: fetchGitHubOpenIdData);
return idToken;
}

Expand Down
4 changes: 2 additions & 2 deletions app/lib/audit/models.dart
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ class AuditLogRecord extends db.ExpandoModel<String> {
static Map<String, dynamic> _dataForPublishing({
required AuthenticatedAgent uploader,
}) {
if (uploader is AuthenticatedGithubAction) {
if (uploader is AuthenticatedGitHubAction) {
final runId = uploader.payload.runId;
final sha = uploader.payload.sha;
return <String, dynamic>{
Expand All @@ -256,7 +256,7 @@ class AuditLogRecord extends db.ExpandoModel<String> {
if (version != null) ' version `$version`',
if (publisherId != null) ' owned by publisher `$publisherId`',
];
if (uploader is AuthenticatedGithubAction) {
if (uploader is AuthenticatedGitHubAction) {
final repository = uploader.payload.repository;
final runId = uploader.payload.runId;
final sha = uploader.payload.sha;
Expand Down
2 changes: 1 addition & 1 deletion app/lib/fake/backend/fake_auth_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ String _createGcpToken({
}

@visibleForTesting
String createFakeGithubActionToken({
String createFakeGitHubActionToken({
required String repository,
required String ref,
// `https://pub.dev` unless specified otherwise
Expand Down
10 changes: 5 additions & 5 deletions app/lib/frontend/templates/views/pkg/admin_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ d.Node packageAdminPageNode({
d.Node _automatedPublishing(Package package) {
final github = package.automatedPublishing?.githubConfig;
final gcp = package.automatedPublishing?.gcpConfig;
final isGithubEnabled = github?.isEnabled ?? false;
final isGitHubEnabled = github?.isEnabled ?? false;
return d.fragment([
d.a(name: 'automated-publishing'),
d.h2(text: 'Automated publishing'),
Expand All @@ -281,13 +281,13 @@ d.Node _automatedPublishing(Package package) {
child: material.checkbox(
id: '-pkg-admin-automated-github-enabled',
label: 'Enable publishing from GitHub Actions',
checked: isGithubEnabled,
checked: isGitHubEnabled,
),
),
d.div(
classes: [
'-pub-form-checkbox-indent',
if (!isGithubEnabled) '-pub-form-block-hidden',
if (!isGitHubEnabled) '-pub-form-block-hidden',
],
children: [
d.div(
Expand Down Expand Up @@ -368,7 +368,7 @@ d.Node _automatedPublishing(Package package) {
value: github?.environment,
),
),
if (isGithubEnabled) _exampleGithubWorkflow(github!),
if (isGitHubEnabled) _exampleGitHubWorkflow(github!),
],
),
d.a(name: 'google-cloud-service-account'),
Expand Down Expand Up @@ -415,7 +415,7 @@ d.Node _automatedPublishing(Package package) {
]);
}

d.Node _exampleGithubWorkflow(GithubPublishingConfig github) {
d.Node _exampleGitHubWorkflow(GitHubPublishingConfig github) {
final expandedTagPattern = (github.tagPattern ?? '{{version}}')
.replaceAll('{{version}}', '[0-9]+.[0-9]+.[0-9]+*');
final requireEnvironment = github.requireEnvironment;
Expand Down
26 changes: 13 additions & 13 deletions app/lib/package/backend.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ final maxAssetContentLength = 256 * 1024;
final _defaultMaxVersionsPerPackage = 1000;

final Logger _logger = Logger('pub.cloud_repository');
final _validGithubUserOrRepoRegExp =
final _validGitHubUserOrRepoRegExp =
RegExp(r'^[a-z0-9\-\._]+$', caseSensitive: false);
final _validGithubVersionPattern =
final _validGitHubVersionPattern =
RegExp(r'^[a-z0-9\-._]+$', caseSensitive: false);
final _validGithubEnvironment =
final _validGitHubEnvironment =
RegExp(r'^[a-z0-9\-\._]+$', caseSensitive: false);

/// Sets the package backend service.
Expand Down Expand Up @@ -546,8 +546,8 @@ class PackageBackend {
InvalidInputException.check(parts.length == 2,
'The `repository` field must follow the `<owner>/<repository>` pattern.');
InvalidInputException.check(
_validGithubUserOrRepoRegExp.hasMatch(parts[0]) &&
_validGithubUserOrRepoRegExp.hasMatch(parts[1]),
_validGitHubUserOrRepoRegExp.hasMatch(parts[0]) &&
_validGitHubUserOrRepoRegExp.hasMatch(parts[1]),
'The `repository` field has invalid characters.');
}

Expand All @@ -557,7 +557,7 @@ class PackageBackend {
InvalidInputException.check(
tagPatternParts
.where((e) => e.isNotEmpty)
.every(_validGithubVersionPattern.hasMatch),
.every(_validGitHubVersionPattern.hasMatch),
'The `tagPattern` field has invalid characters.');

InvalidInputException.check(
Expand All @@ -566,7 +566,7 @@ class PackageBackend {

if (environment.isNotEmpty) {
InvalidInputException.check(
_validGithubEnvironment.hasMatch(environment),
_validGitHubEnvironment.hasMatch(environment),
'The `environment` field has invalid characters.');
}
}
Expand Down Expand Up @@ -1308,8 +1308,8 @@ class PackageBackend {
await packageBackend.isPackageAdmin(package, agent.user.userId)) {
return;
}
if (agent is AuthenticatedGithubAction) {
await _checkGithubActionAllowed(agent, package, newVersion);
if (agent is AuthenticatedGitHubAction) {
await _checkGitHubActionAllowed(agent, package, newVersion);
return;
}
if (agent is AuthenticatedGcpServiceAccount) {
Expand All @@ -1323,7 +1323,7 @@ class PackageBackend {
agent.displayId, package.name!);
}

Future<void> _checkGithubActionAllowed(AuthenticatedGithubAction agent,
Future<void> _checkGitHubActionAllowed(AuthenticatedGitHubAction agent,
Package package, String newVersion) async {
final githubConfig = package.automatedPublishing?.githubConfig;
final githubLock = package.automatedPublishing?.githubLock;
Expand Down Expand Up @@ -1676,15 +1676,15 @@ class PackageBackend {
Package package, AuthenticatedAgent agent) {
final current = package.automatedPublishing;
if (current == null) {
if (agent is AuthenticatedGithubAction ||
if (agent is AuthenticatedGitHubAction ||
agent is AuthenticatedGcpServiceAccount) {
// This should be unreachable
throw AssertionError('Authentication should never have been possible');
}
return;
}
if (agent is AuthenticatedGithubAction && current.githubLock == null) {
current.githubLock = GithubPublishingLock(
if (agent is AuthenticatedGitHubAction && current.githubLock == null) {
current.githubLock = GitHubPublishingLock(
repositoryOwnerId: agent.payload.repositoryOwnerId,
repositoryId: agent.payload.repositoryId,
);
Expand Down
14 changes: 7 additions & 7 deletions app/lib/package/models.dart
Original file line number Diff line number Diff line change
Expand Up @@ -473,8 +473,8 @@ class Release {

@JsonSerializable(explicitToJson: true, includeIfNull: false)
class AutomatedPublishing {
GithubPublishingConfig? githubConfig;
GithubPublishingLock? githubLock;
GitHubPublishingConfig? githubConfig;
GitHubPublishingLock? githubLock;
GcpPublishingConfig? gcpConfig;
GcpPublishingLock? gcpLock;

Expand Down Expand Up @@ -524,19 +524,19 @@ class AutomatedPublishingProperty extends db.Property {
}

@JsonSerializable(explicitToJson: true, includeIfNull: false)
class GithubPublishingLock {
class GitHubPublishingLock {
final String repositoryOwnerId;
final String repositoryId;

GithubPublishingLock({
GitHubPublishingLock({
required this.repositoryOwnerId,
required this.repositoryId,
});

factory GithubPublishingLock.fromJson(Map<String, dynamic> json) =>
_$GithubPublishingLockFromJson(json);
factory GitHubPublishingLock.fromJson(Map<String, dynamic> json) =>
_$GitHubPublishingLockFromJson(json);

Map<String, dynamic> toJson() => _$GithubPublishingLockToJson(this);
Map<String, dynamic> toJson() => _$GitHubPublishingLockToJson(this);
}

@JsonSerializable(explicitToJson: true, includeIfNull: false)
Expand Down
12 changes: 6 additions & 6 deletions app/lib/package/models.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/lib/service/openid/github_openid.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import 'openid_utils.dart';
final _logger = Logger('github_openid');

/// Fetches the OpenID configuration and then the JSON Web Key list from GitHub.
Future<OpenIdData> fetchGithubOpenIdData() async {
Future<OpenIdData> fetchGitHubOpenIdData() async {
final githubUrl =
'https://token.actions.githubusercontent.com/.well-known/openid-configuration';
final list = await cache
Expand Down
2 changes: 1 addition & 1 deletion app/test/audit/backend_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ void main() {
created: clock.now(),
package: 'pkg',
version: '1.2.0',
uploader: AuthenticatedGithubAction(
uploader: AuthenticatedGitHubAction(
idToken: token,
payload: GitHubJwtPayload(token.payload),
),
Expand Down
10 changes: 5 additions & 5 deletions app/test/package/automated_publishing_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void main() {
final rs = await client.setAutomatedPublishing(
'oxygen',
AutomatedPublishingConfig(
github: GithubPublishingConfig(
github: GitHubPublishingConfig(
isEnabled: true,
repository: 'dart-lang/pub-dev',
tagPattern: '{{version}}',
Expand Down Expand Up @@ -123,7 +123,7 @@ void main() {
final rs = client.setAutomatedPublishing(
'oxygen',
AutomatedPublishingConfig(
github: GithubPublishingConfig(
github: GitHubPublishingConfig(
isEnabled: repository.isEmpty,
repository: repository,
tagPattern: '{{version}}',
Expand Down Expand Up @@ -151,7 +151,7 @@ void main() {
final rs = client.setAutomatedPublishing(
'oxygen',
AutomatedPublishingConfig(
github: GithubPublishingConfig(
github: GitHubPublishingConfig(
isEnabled: false,
repository: 'abcd/efgh',
tagPattern: pattern,
Expand All @@ -177,7 +177,7 @@ void main() {
final rs = client.setAutomatedPublishing(
'oxygen',
AutomatedPublishingConfig(
github: GithubPublishingConfig(
github: GitHubPublishingConfig(
isEnabled: false,
repository: 'abcd/efgh',
tagPattern: '{{version}}',
Expand All @@ -200,7 +200,7 @@ void main() {
final rs = client.setAutomatedPublishing(
'oxygen',
AutomatedPublishingConfig(
github: GithubPublishingConfig(
github: GitHubPublishingConfig(
isEnabled: false,
repository: 'abcd/efgh',
isPushEventEnabled: false,
Expand Down
Loading

0 comments on commit 2bab85a

Please sign in to comment.