Skip to content

Commit

Permalink
Creating issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Suplanus committed Nov 4, 2020
1 parent e877f9e commit f703bb0
Show file tree
Hide file tree
Showing 9 changed files with 366 additions and 39 deletions.
Binary file added demodata/example.zip
Binary file not shown.
28 changes: 16 additions & 12 deletions src/GitHubReleaser/GitHubReleaser.args.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@
"Id": "a6460bf8-07be-48ea-b2f4-11bca9e86648",
"Command": "Test1",
"Items": [
{
"Id": "2762c393-a835-4357-8543-d0c1c1d45fdb",
"Command": "/github-repo:\"Suplanus/GitHubReleaser\""
},
{
"Id": "82ec0542-defa-498f-814d-b85df87b49b1",
"Command": "/github-token:\"Fill out Secrets.cs\""
},
{
"Id": "3735ff7a-efec-45ad-a02e-1f2fe65e5926",
"Command": "/file-for-version:\".\\GitHubReleaser.exe\""
},
{
"Id": "912b3373-c011-40ab-857c-1aa38c0b5042",
"Command": "/create-changelog-file:\"true\""
Expand All @@ -16,31 +28,23 @@
},
{
"Id": "3c1e4015-2cf8-4927-b596-4cb39742ddcb",
"Command": "/release-attachments:\"TODO\" \"TODO\""
"Command": "/release-attachments:\".\\..\\..\\..\\..\\..\\demodata\\example.zip\""
},
{
"Id": "29245bfd-5851-4c3d-9089-e6648a84e599",
"Command": "/issue-filter-label:\"not-in-changelog\""
},
{
"Id": "1da6e697-648d-495f-b2a4-27447f58ba81",
"Command": "/issue-labels:\"bug;Bug\" \"feature;Feature\""
"Command": "/issue-labels:\"bug;Bug\" \"enhancement;Enhancement\""
},
{
"Id": "a01d7c65-8590-4015-a84e-da00eb1e8ecd",
"Command": "/pre-release:\"false\""
},
{
"Id": "3735ff7a-efec-45ad-a02e-1f2fe65e5926",
"Command": "/file-for-version:\"TODO\""
},
{
"Id": "82ec0542-defa-498f-814d-b85df87b49b1",
"Command": "/github-token:\"Fill out Secrets.cs\""
},
{
"Id": "2762c393-a835-4357-8543-d0c1c1d45fdb",
"Command": "/github-repo:\"Suplanus/GitHubReleaser\""
"Id": "d9b72d73-4d90-4975-bae5-41bc95787a9a",
"Command": "/draft:\"true\""
}
]
}
Expand Down
1 change: 1 addition & 0 deletions src/GitHubReleaser/GitHubReleaser.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

<ItemGroup>
<PackageReference Include="FluentCommandLineParser-netstandard" Version="1.4.3.13" />
<PackageReference Include="Octokit" Version="0.48.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
</ItemGroup>

Expand Down
22 changes: 19 additions & 3 deletions src/GitHubReleaser/Model/CommandLineParameters.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Linq;
using Fclp;

namespace GitHubReleaser.Model
Expand All @@ -8,7 +8,9 @@ internal class CommandLineParameters : ReleaserSettings
{
public ICommandLineParserResult Result { get; set; }

public static CommandLineParameters GetCommandLineParameters(string[] args)
public List<string> IssueLabelsWithHeader { get; set; }

public static CommandLineParameters FromArguments(string[] args)
{
var parser = new FluentCommandLineParser<CommandLineParameters>();
parser.Setup(arg => arg.GitHubRepo)
Expand All @@ -26,7 +28,7 @@ public static CommandLineParameters GetCommandLineParameters(string[] args)
parser.Setup(arg => arg.IsPreRelease)
.As("pre-release");

parser.Setup(arg => arg.IssueLabels)
parser.Setup(arg => arg.IssueLabelsWithHeader)
.As("issue-labels");

parser.Setup(arg => arg.IssueFilterLabel)
Expand All @@ -41,8 +43,22 @@ public static CommandLineParameters GetCommandLineParameters(string[] args)
parser.Setup(arg => arg.IsChangelogFileCreationEnabled)
.As("create-changelog-file");

parser.Setup(arg => arg.IsDraft)
.As("draft");

var result = parser.Parse(args);
var commandLineArguments = parser.Object;

// Manual map
if (parser.Object.IssueLabelsWithHeader != null)
{
foreach (var issueLabelWithHeader in parser.Object.IssueLabelsWithHeader)
{
var split = issueLabelWithHeader.Split(';');
parser.Object.IssueLabels.Add(split.First(), split.Last());
}
}

commandLineArguments.Result = result;

#if DEBUG
Expand Down
16 changes: 16 additions & 0 deletions src/GitHubReleaser/Model/IssueWithLabel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using Octokit;

namespace GitHubReleaser.Model
{
internal class IssueWithLabel
{
public string Label { get; }
public Issue Issue { get; }

public IssueWithLabel(string label, Issue issue)
{
Label = label;
Issue = issue;
}
}
}
Loading

0 comments on commit f703bb0

Please sign in to comment.