Skip to content

Commit

Permalink
Update document generation
Browse files Browse the repository at this point in the history
  • Loading branch information
coenm committed Oct 16, 2024
1 parent 9ef0c18 commit 70c7999
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 11 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.
- `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: 7 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,10 @@ public TypeInfoDescriptor(ITypeSymbol typeSymbol)
{
Nullable = IsNullableType(typeSymbol);

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

Expand Down Expand Up @@ -65,6 +66,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 @@ -20,14 +20,14 @@ internal class AutoCompleteOptionsV1
public MergeStrategyV1 MergeStrategy { get; set; } = MergeStrategyV1.NoFastForward; // GitHub issue: https://github.com/coenm/RepoM/issues/87

/// <summary>
/// Boolean specifying if the source branche should be deleted afer completion.
/// Boolean specifying if the source branch should be deleted after completion.
/// </summary>
[Required]
[Predicate(true)]
public Predicate DeleteSourceBranch { get; set; } = true;

/// <summary>
/// Boolean specifying if related workitems should be transitioned to the next state.
/// Boolean specifying if related work items should be transitioned to the next state.
/// </summary>
[Required]
[Predicate(true)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public string Type
public Predicate DraftPr { get; set; } = false;

/// <summary>
/// Boolean specifying if workitems should be included in the PR. RepoM will try to resolve the workitems by looping through the commit messages.
/// 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.
/// </summary>
[Predicate(true)]
public Predicate IncludeWorkItems { get; set; } = true;
Expand All @@ -88,7 +88,7 @@ public string Type
public Predicate Active { get; set; } = true;

/// <summary>
/// Auto complete options. Please take a look at the same for more information
/// Auto complete options.
/// </summary>
public AutoCompleteOptionsV1? AutoComplete { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ This property will be used instead of the Name property.
IsConst: false,
Description:
Pull Request title. When not provided, the title will be defined based on the branch name.
Title will be the last part of the branchname split on `/`, so `feature/123-testBranch` will result in title `123-testBranch`,
Title will be the last part of the branch name split on `/`, so `feature/123-testBranch` will result in title `123-testBranch`,
Examples: {
Items: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public string Type

/// <summary>
/// Pull Request title. When not provided, the title will be defined based on the branch name.
/// Title will be the last part of the branchname split on `/`, so `feature/123-testBranch` will result in title `123-testBranch`
/// Title will be the last part of the branch name split on `/`, so `feature/123-testBranch` will result in title `123-testBranch`
/// </summary>
/// <example>
/// `{{ repository.branch | string.replace "feature/" "" | string.truncate 16 "..." }}`
Expand Down

0 comments on commit 70c7999

Please sign in to comment.