-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dee33ea
commit 6fec4aa
Showing
4 changed files
with
91 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using System; | ||
using System.Net.Http; | ||
using System.Net.Http.Headers; | ||
using System.Net.Mime; | ||
using System.Text.Json; | ||
using System.Threading.Tasks; | ||
|
||
namespace Build; | ||
|
||
public static class Http | ||
Check warning on line 10 in Build/Http.cs GitHub Actions / build (DUI3-DX\Connectors\Revit\Speckle.Connectors.Revit2023\Speckle.Connectors.Revit2023.csproj)
Check warning on line 10 in Build/Http.cs GitHub Actions / build (DUI3-DX\Connectors\Revit\Speckle.Connectors.ArcGIS3\Speckle.Connectors.Revit2023.csproj)
|
||
{ | ||
public static async Task TriggerWorkflow(string secret, string artifactId) | ||
{ | ||
using var client = new HttpClient(); | ||
var payload = new { event_type = "trigger-workflow", client_payload = new { artifact_id = artifactId } }; | ||
var content = new StringContent( | ||
JsonSerializer.Serialize(payload), | ||
new MediaTypeHeaderValue(MediaTypeNames.Application.Json) | ||
); | ||
|
||
var request = new HttpRequestMessage() | ||
{ | ||
RequestUri = new Uri("https://api.github.com/repos/specklesystems/connector-installers/dispatches"), | ||
Headers = { Authorization = new AuthenticationHeaderValue($"Bearer {secret}") }, | ||
Content = content | ||
}; | ||
request.Headers.Add("X-GitHub-Api-Version", "2022-11-28"); | ||
var response = await client.SendAsync(request).ConfigureAwait(false); | ||
if (!response.IsSuccessStatusCode) | ||
{ | ||
throw new InvalidOperationException(response.StatusCode + response.ReasonPhrase); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters