Skip to content

Commit

Permalink
New updates to generated code (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
octokitbot authored Jul 24, 2024
1 parent 6b72641 commit ceadf39
Show file tree
Hide file tree
Showing 8 changed files with 129 additions and 112 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/add_to_octokit_project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Add PRs and issues to Octokit org project

on:
issues:
types: [reopened, opened]
pull_request_target:
types: [reopened, opened]

jobs:
add-to-project:
name: Add issue to project
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/[email protected]
with:
project-url: https://github.com/orgs/octokit/projects/10
github-token: ${{ secrets.OCTOKITBOT_PROJECT_ACTION_TOKEN }}
labeled: "Status: Stale"
label-operator: NOT
32 changes: 32 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "Build and test .NET SDK"

on:
pull_request:
workflow_dispatch:
push:
branches:
- "main"

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3

- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.x.x'

- name: Build the project
run: dotnet build src/GitHub.Octokit.GHEC.SDK.csproj

- name: Format
run: dotnet format --verify-no-changes

- name: Test SDK
run: dotnet test -p:CollectCoverage=true -p:CoverletOutput=TestResults/ -p:CoverletOutputFormat=opencover -p:ExcludeByFile="**/GitHub/**/*.cs"

- name: Build and strong name sign
run: dotnet build src/GitHub.Octokit.GHEC.SDK.csproj --no-incremental /p:SignAssembly=true /p:AssemblyOriginatorKeyFile=../key.snk
29 changes: 29 additions & 0 deletions .github/workflows/immediate-response.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Issue/PR response
permissions:
issues: write
pull-requests: write
on:
issues:
types:
- opened
pull_request_target:
types:
- opened
jobs:
respond-to-issue:
if: ${{ github.actor != 'dependabot[bot]' && github.actor != 'renovate[bot]' && github.actor != 'githubactions[bot]' && github.actor != 'octokitbot' }}
runs-on: ubuntu-latest
steps:
- name: Determine issue or PR number
id: extract
run: echo "NUMBER=${{ github.event.issue.number || github.event.pull_request.number }}" >> "$GITHUB_OUTPUT"

- name: Respond to issue or PR
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ steps.extract.outputs.NUMBER }}
body: >
👋 Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday!
We have a [process in place](https://github.com/octokit/.github/blob/main/community/prioritization_response.md#overview) for prioritizing and responding to your input.
Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labeled with `Status: Up for grabs`.
You & others like you are the reason all of this works! So thank you & happy coding! 🚀
30 changes: 30 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Publish Release to NuGet

on:
release:
types: [published]

defaults:
run:
shell: bash

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x.x

- name: Build and strong name
run: dotnet build --configuration Release --no-incremental -p:version=${GITHUB_REF#refs/*/v} -p:SignAssembly=true -p:AssemblyOriginatorKeyFile=../key.snk

- name: Pack SDK
run: dotnet pack -p:version=${GITHUB_REF#refs/*/v} -o ./publish

- name: Ship to NuGet
run: dotnet nuget push ./publish/*.nupkg -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}} --skip-duplicate
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ You may also want:
- [dotnet-sdk-enterprise-cloud repository](https://github.com/octokit/dotnet-sdk-enterprise-cloud)
- For GitHub Enterprise Server
- [dotnet-sdk-enterprise-server repository](https://github.com/octokit/dotnet-sdk-enterprise-server)
- For our classic non-generated, hand-maintained Octokit.net project
- [Octokit.net repository](https://github.com/octokit/octokit.net)
- For why we're building generative SDKs, see [Why a generated SDK?](#why-a-generated-sdk) below
- Go
- For the standard GitHub.com product
- [go-sdk repository](https://github.com/octokit/go-sdk)
Expand Down
54 changes: 14 additions & 40 deletions src/GitHub/Models/Users.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,45 +11,23 @@ public class Users : IAdditionalDataHolder, IParsable
{
/// <summary>Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.</summary>
public IDictionary<string, object> AdditionalData { get; set; }
/// <summary>The fragment property</summary>
/// <summary>Whether this email address is the primary address.</summary>
public bool? Primary { get; set; }
/// <summary>The type of email address.</summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public string? Fragment { get; set; }
public string? Type { get; set; }
#nullable restore
#else
public string Fragment { get; set; }
public string Type { get; set; }
#endif
/// <summary>The matches property</summary>
/// <summary>The email address.</summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public List<Users_matches>? Matches { get; set; }
public string? Value { get; set; }
#nullable restore
#else
public List<Users_matches> Matches { get; set; }
#endif
/// <summary>The object_type property</summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public string? ObjectType { get; set; }
#nullable restore
#else
public string ObjectType { get; set; }
#endif
/// <summary>The object_url property</summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public string? ObjectUrl { get; set; }
#nullable restore
#else
public string ObjectUrl { get; set; }
#endif
/// <summary>The property property</summary>
#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP3_1_OR_GREATER
#nullable enable
public string? Property { get; set; }
#nullable restore
#else
public string Property { get; set; }
public string Value { get; set; }
#endif
/// <summary>
/// Instantiates a new <see cref="Users"/> and sets the default values.
Expand All @@ -76,11 +54,9 @@ public virtual IDictionary<string, Action<IParseNode>> GetFieldDeserializers()
{
return new Dictionary<string, Action<IParseNode>>
{
{"fragment", n => { Fragment = n.GetStringValue(); } },
{"matches", n => { Matches = n.GetCollectionOfObjectValues<Users_matches>(Users_matches.CreateFromDiscriminatorValue)?.ToList(); } },
{"object_type", n => { ObjectType = n.GetStringValue(); } },
{"object_url", n => { ObjectUrl = n.GetStringValue(); } },
{"property", n => { Property = n.GetStringValue(); } },
{"primary", n => { Primary = n.GetBoolValue(); } },
{"type", n => { Type = n.GetStringValue(); } },
{"value", n => { Value = n.GetStringValue(); } },
};
}
/// <summary>
Expand All @@ -90,11 +66,9 @@ public virtual IDictionary<string, Action<IParseNode>> GetFieldDeserializers()
public virtual void Serialize(ISerializationWriter writer)
{
_ = writer ?? throw new ArgumentNullException(nameof(writer));
writer.WriteStringValue("fragment", Fragment);
writer.WriteCollectionOfObjectValues<Users_matches>("matches", Matches);
writer.WriteStringValue("object_type", ObjectType);
writer.WriteStringValue("object_url", ObjectUrl);
writer.WriteStringValue("property", Property);
writer.WriteBoolValue("primary", Primary);
writer.WriteStringValue("type", Type);
writer.WriteStringValue("value", Value);
writer.WriteAdditionalData(AdditionalData);
}
}
Expand Down
71 changes: 0 additions & 71 deletions src/GitHub/Models/Users_matches.cs

This file was deleted.

2 changes: 1 addition & 1 deletion src/NugetREADME.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Octokit

This is a .NET SDK for GitHub's REST API, built on [Kiota](https://github.com/microsoft/kiota). For usage instructions and further documentation, please see the [project's README](https://github.com/octokit/dotnet-sdk-enterprise-cloud/blob/main/README.md).
This is a .NET SDK for GitHub's Enterprise Cloud product, built on [Kiota](https://github.com/microsoft/kiota). For usage instructions and further documentation, please see the [project's README](https://github.com/octokit/dotnet-sdk-enterprise-cloud/blob/main/README.md).

0 comments on commit ceadf39

Please sign in to comment.