Skip to content

Commit

Permalink
Update documentation (#207)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: GitHub Action <action@github.com>
  • Loading branch information
coenm and actions-user authored Oct 16, 2024
1 parent 9ef0c18 commit aa3f283
Show file tree
Hide file tree
Showing 18 changed files with 138 additions and 148 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,14 @@ Title will be the last part of the branchname split on `/`, so `feature/123-test
- `to-branch`: Name of the branch the pull request should be merged into. For instance `develop`, or `main`. ([Text](repository_action_types.md#text))
- `reviewer-ids`: List of reviewer ids. The id should be a valid Azure DevOps user id (i.e. GUID). (List<Text>)
- `draft-pr`: Boolean specifying if th PR should be marked as draft. ([Predicate](repository_action_types.md#predicate))
- `include-work-items`: Boolean specifying if workitems should be included in the PR. RepoM will try to resolve the workitems by looping through the commit messages. ([Predicate](repository_action_types.md#predicate))
- `include-work-items`: Boolean specifying if work items should be included in the PR. RepoM will try to resolve the work items by looping through the commit messages. ([Predicate](repository_action_types.md#predicate))
- `open-in-browser`: Boolean specifying if the Pull request should be opened in the browser after creation. ([Predicate](repository_action_types.md#predicate))
- `context`: The context in which the action is available. ([Context](repository_action_types.md#context))
- `active`: Whether the menu item is enabled. ([Predicate](repository_action_types.md#predicate))
- `auto-complete`: Auto complete options. Please take a look at the same for more information (AutoCompleteOptionsV1, optional)
- `auto-complete`: Auto complete options. If not provided, auto complete will not be set.
- `merge-strategy`: The merge strategy. Possible values are `no-fast-forward`, `squash`, `rebase`, and `rebase-merge`.
- `delete-source-branch`: Boolean specifying if the source branch should be deleted after completion. ([Predicate](repository_action_types.md#predicate))
- `transition-work-items`: Boolean specifying if related work items should be transitioned to the next state. ([Predicate](repository_action_types.md#predicate))

### Example

Expand Down
8 changes: 4 additions & 4 deletions docs/mdsource/repom.generated.source.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Action to create a folder (sub menu) in the context menu of the repository allow

Properties:

- `actions`: List of actions. (ActionMenu, optional)
- `actions`: List of actions. ([ActionMenu](repository_action_types.md#actions))
- `name`: Name of the menu item. ([Text](repository_action_types.md#text))
- `active`: Whether the menu item is enabled. ([Predicate](repository_action_types.md#predicate))
- `context`: The context in which the action is available. ([Context](repository_action_types.md#context))
Expand All @@ -94,7 +94,7 @@ Properties:
- `enumerable`: The list of items to enumerate on. (Variable)
- `variable`: The name of the variable to access to current enumeration of the items. For each iteration, the variable `{var.name}` has the value of the current iteration. (string?, optional)
- `skip`: Predicate to skip the current item. ([Predicate](repository_action_types.md#predicate))
- `actions`: List of repeated actions. (List)
- `actions`: List of repeated actions. ([ActionMenu](repository_action_types.md#actions))

### Example

Expand Down Expand Up @@ -193,15 +193,15 @@ snippet: just-text@1-scenario01

## pin-repository@1

Action to pin (or unpin) the current repository. Pinning is not persistant and all pinned repositories will be cleared when RepoM exits.
Action to pin (or unpin) the current repository. Pinning is not persistent and all pinned repositories will be cleared when RepoM exits.
Pinning a repository allowed custom filtering, ordering and searching.

Properties:

- `name`: Name of the menu item. ([Text](repository_action_types.md#text))
- `active`: Whether the menu item is enabled. ([Predicate](repository_action_types.md#predicate))
- `context`: The context in which the action is available. ([Context](repository_action_types.md#context))
- `mode`: The pin mode `[Toggle, Pin, UnPin]`. (Nullable, optional)
- `mode`: The pin mode. Should be `toggle`, `pin`, or `un-pin`. Default value is `toggle`.

### Example

Expand Down
103 changes: 0 additions & 103 deletions docs/mdsource/repository_action_types.md

This file was deleted.

17 changes: 17 additions & 0 deletions docs/mdsource/repository_action_types.source.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# Repository Action types

## Actions

Actions are a list of actions. This can be used in a sub menu.

### Example

```yaml
action-menu:
- type: folder@1
actions:
- type: just-text@1
name: x
- type: url@1
name: x
# etc. etc.
```

## Context

The context type enables you to create or load variables and add some custom scriban methods in order to render [Text](#text) or calculate [Predicats](#predicate).
Expand Down
7 changes: 5 additions & 2 deletions docs/plugin_repom.plugin.azuredevops.generated.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,14 @@ Title will be the last part of the branchname split on `/`, so `feature/123-test
- `to-branch`: Name of the branch the pull request should be merged into. For instance `develop`, or `main`. ([Text](repository_action_types.md#text))
- `reviewer-ids`: List of reviewer ids. The id should be a valid Azure DevOps user id (i.e. GUID). (List<Text>)
- `draft-pr`: Boolean specifying if th PR should be marked as draft. ([Predicate](repository_action_types.md#predicate))
- `include-work-items`: Boolean specifying if workitems should be included in the PR. RepoM will try to resolve the workitems by looping through the commit messages. ([Predicate](repository_action_types.md#predicate))
- `include-work-items`: Boolean specifying if work items should be included in the PR. RepoM will try to resolve the work items by looping through the commit messages. ([Predicate](repository_action_types.md#predicate))
- `open-in-browser`: Boolean specifying if the Pull request should be opened in the browser after creation. ([Predicate](repository_action_types.md#predicate))
- `context`: The context in which the action is available. ([Context](repository_action_types.md#context))
- `active`: Whether the menu item is enabled. ([Predicate](repository_action_types.md#predicate))
- `auto-complete`: Auto complete options. Please take a look at the same for more information (AutoCompleteOptionsV1, optional)
- `auto-complete`: Auto complete options. If not provided, auto complete will not be set.
- `merge-strategy`: The merge strategy. Possible values are `no-fast-forward`, `squash`, `rebase`, and `rebase-merge`.
- `delete-source-branch`: Boolean specifying if the source branch should be deleted after completion. ([Predicate](repository_action_types.md#predicate))
- `transition-work-items`: Boolean specifying if related work items should be transitioned to the next state. ([Predicate](repository_action_types.md#predicate))

### Example

Expand Down
8 changes: 4 additions & 4 deletions docs/repom.generated.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ Action to create a folder (sub menu) in the context menu of the repository allow

Properties:

- `actions`: List of actions. (ActionMenu, optional)
- `actions`: List of actions. ([ActionMenu](repository_action_types.md#actions))
- `name`: Name of the menu item. ([Text](repository_action_types.md#text))
- `active`: Whether the menu item is enabled. ([Predicate](repository_action_types.md#predicate))
- `context`: The context in which the action is available. ([Context](repository_action_types.md#context))
Expand Down Expand Up @@ -156,7 +156,7 @@ Properties:
- `enumerable`: The list of items to enumerate on. (Variable)
- `variable`: The name of the variable to access to current enumeration of the items. For each iteration, the variable `{var.name}` has the value of the current iteration. (string?, optional)
- `skip`: Predicate to skip the current item. ([Predicate](repository_action_types.md#predicate))
- `actions`: List of repeated actions. (List)
- `actions`: List of repeated actions. ([ActionMenu](repository_action_types.md#actions))

### Example

Expand Down Expand Up @@ -378,15 +378,15 @@ action-menu:

## pin-repository@1

Action to pin (or unpin) the current repository. Pinning is not persistant and all pinned repositories will be cleared when RepoM exits.
Action to pin (or unpin) the current repository. Pinning is not persistent and all pinned repositories will be cleared when RepoM exits.
Pinning a repository allowed custom filtering, ordering and searching.

Properties:

- `name`: Name of the menu item. ([Text](repository_action_types.md#text))
- `active`: Whether the menu item is enabled. ([Predicate](repository_action_types.md#predicate))
- `context`: The context in which the action is available. ([Context](repository_action_types.md#context))
- `mode`: The pin mode `[Toggle, Pin, UnPin]`. (Nullable, optional)
- `mode`: The pin mode. Should be `toggle`, `pin`, or `un-pin`. Default value is `toggle`.

### Example

Expand Down
17 changes: 17 additions & 0 deletions docs/repository_action_types.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# Repository Action types

## Actions

Actions are a list of actions. This can be used in a sub menu.

### Example

```yaml
action-menu:
- type: folder@1
actions:
- type: just-text@1
name: x
- type: url@1
name: x
# etc. etc.
```

## Context

The context type enables you to create or load variables and add some custom scriban methods in order to render [Text](#text) or calculate [Predicats](#predicate).
Expand Down
9 changes: 8 additions & 1 deletion src/RepoM.ActionMenu.CodeGen/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,16 @@ internal static class Constants
{
internal static readonly Dictionary<string, TypeInfoDescriptor> TypeInfos = new()
{
{
typeof(RepoM.ActionMenu.Core.Yaml.Model.ActionMenus.ActionMenu).FullName!,
new TypeInfoDescriptor(nameof(RepoM.ActionMenu.Core.Yaml.Model.ActionMenus.ActionMenu), typeof(RepoM.ActionMenu.Core.Yaml.Model.ActionMenus.ActionMenu).FullName!)
{
Link = "repository_action_types.md#actions",
}
},
{
typeof(Interface.YamlModel.Templating.Text).FullName!,
new TypeInfoDescriptor(nameof(Text), typeof(Interface.YamlModel.Templating.Text).FullName!)
new TypeInfoDescriptor(nameof(Interface.YamlModel.Templating.Text), typeof(Interface.YamlModel.Templating.Text).FullName!)
{
Link = "repository_action_types.md#text",
}
Expand Down
13 changes: 12 additions & 1 deletion src/RepoM.ActionMenu.CodeGen/Models/MemberDescriptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,15 @@ public TypeInfoDescriptor(ITypeSymbol typeSymbol)
{
Nullable = IsNullableType(typeSymbol);

// hack
if (Name.Contains("AutoCompleteOptionsV1"))
{
// do nothing intentionally, just for debugging coenm
SkipForDocumentGeneration = true;
}

if (Name.Contains("PinMode"))
{
SkipForDocumentGeneration = true;
}
}

Expand Down Expand Up @@ -65,6 +71,11 @@ public TypeInfoDescriptor(string name, string csharpTypeName)

public bool Nullable { get; set; }

/// <summary>
/// Skip this type for document generation.
/// </summary>
public bool SkipForDocumentGeneration { get; set; } = false;

private static bool IsNullableType(ITypeSymbol typeSymbol)
{
return typeSymbol is INamedTypeSymbol { NullableAnnotation: NullableAnnotation.Annotated, };
Expand Down
11 changes: 11 additions & 0 deletions src/RepoM.ActionMenu.CodeGen/Templates/DocsPlugin.scriban-txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
{{~
func write_parenthesis_when_not_empty(s)
if !string.empty s
ret "(" + s + ")"
end
ret ""
end

func write_type_with_link(t)
if t.SkipForDocumentGeneration
ret "";
end

result = t.Name;

if !string.empty t.Link
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
Properties:

{{~ for p in actionmenu_item.ActionMenuProperties ~}}
- `{{ hyphenated p.CSharpName }}`: {{ p.Description }} ({{ write_type_with_link p.ReturnType }})
- `{{ hyphenated p.CSharpName }}`: {{ p.Description }} {{ write_parenthesis_when_not_empty (write_type_with_link (p.ReturnType)) }}
{{~ if hyphenated(p.CSharpName) == 'auto-complete' ~}}
- `merge-strategy`: The merge strategy. Possible values are `no-fast-forward`, `squash`, `rebase`, and `rebase-merge`.
- `delete-source-branch`: Boolean specifying if the source branch should be deleted after completion. ([Predicate](repository_action_types.md#predicate))
- `transition-work-items`: Boolean specifying if related work items should be transitioned to the next state. ([Predicate](repository_action_types.md#predicate))
{{~ end ~}}
{{~ end ~}}
{{~ if actionmenu_item.Examples ~}}

Expand Down Expand Up @@ -36,7 +41,7 @@ Properties:

{{ example_item.Text }}
{{~ else ~}}
NAME NOT FOUND!! {{ example_item.TypeName }}.
NAME NOT FOUND!! {{ example_item.TypeName }}.
{{~ end ~}}
{{~ end ~}}
{{~ end ~}}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public string Type
}

/// <inheritdoc cref="IMenuActions.Actions"/>
public ActionMenu? Actions { get; set; }
public ActionMenu Actions { get; set; } = [];

/// <inheritdoc cref="IName.Name"/>
[Text]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace RepoM.ActionMenu.Core.ActionMenu.Model.ActionMenus.ForEach;

using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using RepoM.ActionMenu.Core.Yaml.Model.ActionMenus;
using RepoM.ActionMenu.Core.Yaml.Model.Templating;
using RepoM.ActionMenu.Interface.YamlModel;
using RepoM.ActionMenu.Interface.YamlModel.ActionMenus;
Expand Down Expand Up @@ -59,12 +59,13 @@ public string Type
[Predicate(false)]
public Predicate Skip { get; init; } = new ScribanPredicate();

// <inheritdoc cref="IMenuActions.Actions"/>
/// <summary>
/// List of repeated actions.
/// </summary>
[Required]
public List<IMenuAction> Actions { get; init; } = new();
public ActionMenu Actions { get; set; } = [];

public override string ToString()
{
return $"({TYPE_VALUE})";
Expand Down
Loading

0 comments on commit aa3f283

Please sign in to comment.