feat: issue subscriptions and Actions workflow dispatch
- subscribe/unsubscribe to an issue from the detail screen - dispatch a workflow_dispatch run (workflow + ref) from Actions settings - i18n (en/nl)
This commit is contained in:
1 parent
eed9c91274
commit
207ac723af
8 files changed
+178
-2
No files matched your search
@@ -6,6 +6,7 @@ import { Screen } from '@/components/layout/screen';
|
||||
import { AppText } from '@/components/ui/app-text';
|
||||
import { Button } from '@/components/ui/button';
|
||||
import { Card } from '@/components/ui/card';
|
||||
import { ChipSelect } from '@/components/ui/chip-select';
|
||||
import { Field } from '@/components/ui/field';
|
||||
import { IconButton } from '@/components/ui/icon-button';
|
||||
import { ErrorState, LoadingView } from '@/components/ui/state-views';
|
||||
@@ -18,6 +19,7 @@ import {
|
||||
useRepoSecrets,
|
||||
useRepoVariables,
|
||||
} from '@/features/repositories/settings-queries';
|
||||
import { useDispatchWorkflow, useWorkflows } from '@/features/actions/queries';
|
||||
import { spacing } from '@/theme/tokens';
|
||||
import type { RepositoryStackParamList } from '@/navigation/types';
|
||||
import type { ScreenProps } from '@/navigation/typing';
|
||||
@@ -40,6 +42,10 @@ export function ActionsSettingsScreen({ route }: Props) {
|
||||
const [secretValue, setSecretValue] = useState('');
|
||||
const [varName, setVarName] = useState('');
|
||||
const [varValue, setVarValue] = useState('');
|
||||
const workflows = useWorkflows(owner, name);
|
||||
const [selectedWorkflow, setSelectedWorkflow] = useState<string | null>(null);
|
||||
const [dispatchRefName, setDispatchRefName] = useState('');
|
||||
const dispatch = useDispatchWorkflow(owner, name, selectedWorkflow ?? '');
|
||||
|
||||
if (secrets.isPending || variables.isPending) return <LoadingView />;
|
||||
if (secrets.isError || variables.isError) {
|
||||
@@ -118,6 +124,41 @@ export function ActionsSettingsScreen({ route }: Props) {
|
||||
|
||||
return (
|
||||
<Screen scroll padded>
|
||||
<AppText variant="subheading">{t('repoSettings.runWorkflow')}</AppText>
|
||||
<Card>
|
||||
<ChipSelect
|
||||
options={(workflows.data ?? []).map((workflow) => ({
|
||||
id: String(workflow.id),
|
||||
label: workflow.name ?? workflow.path ?? '',
|
||||
}))}
|
||||
selectedIds={selectedWorkflow ? [selectedWorkflow] : []}
|
||||
onToggle={(id) => setSelectedWorkflow(id)}
|
||||
emptyLabel={t('repoSettings.noWorkflows')}
|
||||
single
|
||||
/>
|
||||
<Field
|
||||
label={t('repoSettings.ref')}
|
||||
value={dispatchRefName}
|
||||
onChangeText={setDispatchRefName}
|
||||
placeholder="main"
|
||||
autoCapitalize="none"
|
||||
autoCorrect={false}
|
||||
/>
|
||||
<Button
|
||||
label={t('repoSettings.dispatch')}
|
||||
onPress={() =>
|
||||
dispatch.mutate(
|
||||
{ ref: dispatchRefName.trim() },
|
||||
{ onError: (error) => Alert.alert(t('errors.title'), apiErrorMessage(error, t)) },
|
||||
)
|
||||
}
|
||||
loading={dispatch.isPending}
|
||||
disabled={!selectedWorkflow || dispatchRefName.trim().length === 0}
|
||||
fullWidth
|
||||
style={styles.spaced}
|
||||
/>
|
||||
</Card>
|
||||
|
||||
<AppText variant="subheading">{t('repoSettings.secrets')}</AppText>
|
||||
<Card>
|
||||
<Field
|
||||
|
||||
Reference in new issue
Block a user