diff --git a/.changeset/giant-pets-cover.md b/.changeset/giant-pets-cover.md
new file mode 100644
index 0000000000..604f39cf8d
--- /dev/null
+++ b/.changeset/giant-pets-cover.md
@@ -0,0 +1,5 @@
+---
+'@backstage/plugin-scaffolder': minor
+---
+
+Add a new git repository url picker for `gitea`. This `GiteaRepoPicker` can be used in a template to scaffold a project to be cloned using gitea.
diff --git a/plugins/scaffolder/api-report.md b/plugins/scaffolder/api-report.md
index 6f8479990b..4df1eff430 100644
--- a/plugins/scaffolder/api-report.md
+++ b/plugins/scaffolder/api-report.md
@@ -379,6 +379,7 @@ export const RepoUrlPickerFieldExtension: FieldExtensionComponent_2<
secretsKey: string;
additionalScopes?:
| {
+ gitea?: string[] | undefined;
gerrit?: string[] | undefined;
github?: string[] | undefined;
gitlab?: string[] | undefined;
@@ -405,6 +406,7 @@ export const RepoUrlPickerFieldSchema: FieldSchema<
secretsKey: string;
additionalScopes?:
| {
+ gitea?: string[] | undefined;
gerrit?: string[] | undefined;
github?: string[] | undefined;
gitlab?: string[] | undefined;
diff --git a/plugins/scaffolder/src/api.ts b/plugins/scaffolder/src/api.ts
index c67a5c944e..a66ac522c2 100644
--- a/plugins/scaffolder/src/api.ts
+++ b/plugins/scaffolder/src/api.ts
@@ -107,6 +107,7 @@ export class ScaffolderClient implements ScaffolderApi {
...this.scmIntegrationsApi.bitbucketCloud.list(),
...this.scmIntegrationsApi.bitbucketServer.list(),
...this.scmIntegrationsApi.gerrit.list(),
+ ...this.scmIntegrationsApi.gitea.list(),
...this.scmIntegrationsApi.github.list(),
...this.scmIntegrationsApi.gitlab.list(),
]
diff --git a/plugins/scaffolder/src/components/fields/RepoUrlPicker/GiteaRepoPicker.test.tsx b/plugins/scaffolder/src/components/fields/RepoUrlPicker/GiteaRepoPicker.test.tsx
new file mode 100644
index 0000000000..e66ca49af1
--- /dev/null
+++ b/plugins/scaffolder/src/components/fields/RepoUrlPicker/GiteaRepoPicker.test.tsx
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2022 The Backstage Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import React from 'react';
+import { GiteaRepoPicker } from './GiteaRepoPicker';
+import { render, fireEvent } from '@testing-library/react';
+
+describe('GiteaRepoPicker', () => {
+ describe('owner input field', () => {
+ it('calls onChange when the owner input changes', () => {
+ const onChange = jest.fn();
+ const { getAllByRole } = render(
+ ,
+ );
+
+ const ownerInput = getAllByRole('textbox')[0];
+
+ fireEvent.change(ownerInput, { target: { value: 'test-owner' } });
+
+ expect(onChange).toHaveBeenCalledWith({ owner: 'test-owner' });
+ });
+ });
+});
diff --git a/plugins/scaffolder/src/components/fields/RepoUrlPicker/GiteaRepoPicker.tsx b/plugins/scaffolder/src/components/fields/RepoUrlPicker/GiteaRepoPicker.tsx
new file mode 100644
index 0000000000..566a2732e3
--- /dev/null
+++ b/plugins/scaffolder/src/components/fields/RepoUrlPicker/GiteaRepoPicker.tsx
@@ -0,0 +1,75 @@
+/*
+ * Copyright 2021 The Backstage Authors
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import React from 'react';
+import FormControl from '@material-ui/core/FormControl';
+import FormHelperText from '@material-ui/core/FormHelperText';
+import Input from '@material-ui/core/Input';
+import InputLabel from '@material-ui/core/InputLabel';
+import { Select, SelectItem } from '@backstage/core-components';
+import { RepoUrlPickerState } from './types';
+
+export const GiteaRepoPicker = (props: {
+ allowedOwners?: string[];
+ allowedRepos?: string[];
+ state: RepoUrlPickerState;
+ onChange: (state: RepoUrlPickerState) => void;
+ rawErrors: string[];
+}) => {
+ const { allowedOwners = [], state, onChange, rawErrors } = props;
+ const ownerItems: SelectItem[] = allowedOwners
+ ? allowedOwners.map(i => ({ label: i, value: i }))
+ : [{ label: 'Loading...', value: 'loading' }];
+
+ const { owner } = state;
+
+ return (
+ <>
+ 0 && !owner}
+ >
+ {allowedOwners?.length ? (
+
+ >
+ );
+};
diff --git a/plugins/scaffolder/src/components/fields/RepoUrlPicker/RepoUrlPicker.tsx b/plugins/scaffolder/src/components/fields/RepoUrlPicker/RepoUrlPicker.tsx
index 7fc71d8338..ba333088ab 100644
--- a/plugins/scaffolder/src/components/fields/RepoUrlPicker/RepoUrlPicker.tsx
+++ b/plugins/scaffolder/src/components/fields/RepoUrlPicker/RepoUrlPicker.tsx
@@ -20,6 +20,7 @@ import {
} from '@backstage/integration-react';
import React, { useEffect, useState, useMemo, useCallback } from 'react';
import { GithubRepoPicker } from './GithubRepoPicker';
+import { GiteaRepoPicker } from './GiteaRepoPicker';
import { GitlabRepoPicker } from './GitlabRepoPicker';
import { AzureRepoPicker } from './AzureRepoPicker';
import { BitbucketRepoPicker } from './BitbucketRepoPicker';
@@ -183,6 +184,15 @@ export const RepoUrlPicker = (props: RepoUrlPickerProps) => {
state={state}
/>
)}
+ {hostType === 'gitea' && (
+
+ )}
{hostType === 'gitlab' && (