Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Below is the current status of each extension. Icons indicate implementation pro
| Status | Extension | Description | Module Name | Issue |
|--------|------------|-------------|-------------|-------|
| 🔲 | **Azure DevOps** | Pipelines, repositories, work items | `Elsa.AzureDevOps` | [Open Issue](https://github.com/elsa-workflows/elsa-extensions/issues/new) |
| 🔲 | **GitHub** | PR automation, repo events | `Elsa.GitHub` | [Open Issue](https://github.com/elsa-workflows/elsa-extensions/issues/new) |
| [✅](https://github.com/elsa-workflows/elsa-extensions/tree/main/src/github/Elsa.Integrations.GitHub) | **GitHub** | PR automation, repo events | `Elsa.Integrations.GitHub` | [Fixed Issue](https://github.com/elsa-workflows/elsa-extensions/issues/6) |
| 🔲 | **GitLab** | CI/CD triggers and repo management | `Elsa.GitLab` | [Open Issue](https://github.com/elsa-workflows/elsa-extensions/issues/new) |
| 🔲 | **Jenkins** | Pipeline automation and job execution | `Elsa.Jenkins` | [Open Issue](https://github.com/elsa-workflows/elsa-extensions/issues/new) |
| 🔲 | **Datadog** | Monitoring, logging, and alerts | `Elsa.Datadog` | [Open Issue](https://github.com/elsa-workflows/elsa-extensions/issues/new) |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
using Elsa.Integrations.GitHub.Activities;
using Elsa.Workflows;
using Elsa.Workflows.Attributes;
using Elsa.Workflows.Models;
using JetBrains.Annotations;
using Octokit;

namespace Elsa.Integrations.GitHub.Activities.Comments;

/// <summary>
/// Creates a new comment on an issue or pull request in a GitHub repository.
/// </summary>
[Activity(
"Elsa.GitHub.Comments",
"GitHub Comments",
"Creates a new comment on an issue or pull request in a GitHub repository.",
DisplayName = "Create Comment")]
[UsedImplicitly]
public class CreateComment : GitHubActivity
{
/// <summary>
/// The owner of the repository.
/// </summary>
[Input(Description = "The owner of the repository.")]
public Input<string> Owner { get; set; } = null!;

/// <summary>
/// The name of the repository.
/// </summary>
[Input(Description = "The name of the repository.")]
public Input<string> Repository { get; set; } = null!;

/// <summary>
/// The issue or pull request number.
/// </summary>
[Input(Description = "The issue or pull request number.")]
public Input<int> Number { get; set; } = default!;

/// <summary>
/// The comment body text.
/// </summary>
[Input(Description = "The comment body text.")]
public Input<string> Body { get; set; } = null!;

/// <summary>
/// The created comment.
/// </summary>
[Output(Description = "The created comment.")]
public Output<IssueComment> CreatedComment { get; set; } = default!;

/// <summary>
/// Executes the activity.
/// </summary>
protected override async ValueTask ExecuteAsync(ActivityExecutionContext context)
{
var owner = context.Get(Owner)!;
var repository = context.Get(Repository)!;
var number = context.Get(Number);
var body = context.Get(Body)!;

var client = GetClient(context);
var comment = await client.Issue.Comment.Create(owner, repository, number, body);

context.Set(CreatedComment, comment);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using Elsa.Integrations.GitHub.Activities;
using Elsa.Workflows;
using Elsa.Workflows.Attributes;
using Elsa.Workflows.Models;
using JetBrains.Annotations;

namespace Elsa.Integrations.GitHub.Activities.Comments;

/// <summary>
/// Deletes a comment from a GitHub repository.
/// </summary>
[Activity(
"Elsa.GitHub.Comments",
"GitHub Comments",
"Deletes a comment from a GitHub repository.",
DisplayName = "Delete Comment")]
[UsedImplicitly]
public class DeleteComment : GitHubActivity
{
/// <summary>
/// The owner of the repository.
/// </summary>
[Input(Description = "The owner of the repository.")]
public Input<string> Owner { get; set; } = null!;

/// <summary>
/// The name of the repository.
/// </summary>
[Input(Description = "The name of the repository.")]
public Input<string> Repository { get; set; } = null!;

/// <summary>
/// The comment ID.
/// </summary>
[Input(Description = "The comment ID.")]
public Input<int> Id { get; set; } = default!;

/// <summary>
/// Executes the activity.
/// </summary>
protected override async ValueTask ExecuteAsync(ActivityExecutionContext context)
{
var owner = context.Get(Owner)!;
var repository = context.Get(Repository)!;
var id = context.Get(Id);

var client = GetClient(context);
await client.Issue.Comment.Delete(owner, repository, id);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
using Elsa.Integrations.GitHub.Activities;
using Elsa.Workflows;
using Elsa.Workflows.Attributes;
using Elsa.Workflows.Models;
using JetBrains.Annotations;
using Octokit;

namespace Elsa.Integrations.GitHub.Activities.Comments;

/// <summary>
/// Retrieves a specific comment from a GitHub repository.
/// </summary>
[Activity(
"Elsa.GitHub.Comments",
"GitHub Comments",
"Retrieves a specific comment from a GitHub repository.",
DisplayName = "Get Comment")]
[UsedImplicitly]
public class GetComment : GitHubActivity
{
/// <summary>
/// The owner of the repository.
/// </summary>
[Input(Description = "The owner of the repository.")]
public Input<string> Owner { get; set; } = null!;

/// <summary>
/// The name of the repository.
/// </summary>
[Input(Description = "The name of the repository.")]
public Input<string> Repository { get; set; } = null!;

/// <summary>
/// The comment ID.
/// </summary>
[Input(Description = "The comment ID.")]
public Input<int> Id { get; set; } = default!;

/// <summary>
/// The retrieved comment.
/// </summary>
[Output(Description = "The retrieved comment.")]
public Output<IssueComment> RetrievedComment { get; set; } = default!;

/// <summary>
/// Executes the activity.
/// </summary>
protected override async ValueTask ExecuteAsync(ActivityExecutionContext context)
{
var owner = context.Get(Owner)!;
var repository = context.Get(Repository)!;
var id = context.Get(Id);

var client = GetClient(context);
var comment = await client.Issue.Comment.GetComment(owner, repository, id);

context.Set(RetrievedComment, comment);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
using Elsa.Integrations.GitHub.Activities;
using Elsa.Workflows;
using Elsa.Workflows.Attributes;
using Elsa.Workflows.Models;
using JetBrains.Annotations;
using Octokit;

namespace Elsa.Integrations.GitHub.Activities.Comments;

/// <summary>
/// Updates an existing comment in a GitHub repository.
/// </summary>
[Activity(
"Elsa.GitHub.Comments",
"GitHub Comments",
"Updates an existing comment in a GitHub repository.",
DisplayName = "Update Comment")]
[UsedImplicitly]
public class UpdateComment : GitHubActivity
{
/// <summary>
/// The owner of the repository.
/// </summary>
[Input(Description = "The owner of the repository.")]
public Input<string> Owner { get; set; } = null!;

/// <summary>
/// The name of the repository.
/// </summary>
[Input(Description = "The name of the repository.")]
public Input<string> Repository { get; set; } = null!;

/// <summary>
/// The comment ID.
/// </summary>
[Input(Description = "The comment ID.")]
public Input<int> Id { get; set; } = default!;

/// <summary>
/// The updated comment body text.
/// </summary>
[Input(Description = "The updated comment body text.")]
public Input<string> Body { get; set; } = null!;

/// <summary>
/// The updated comment.
/// </summary>
[Output(Description = "The updated comment.")]
public Output<IssueComment> UpdatedComment { get; set; } = default!;

/// <summary>
/// Executes the activity.
/// </summary>
protected override async ValueTask ExecuteAsync(ActivityExecutionContext context)
{
var owner = context.Get(Owner)!;
var repository = context.Get(Repository)!;
var id = context.Get(Id);
var body = context.Get(Body)!;

var client = GetClient(context);
var comment = await client.Issue.Comment.Update(owner, repository, id, body);

context.Set(UpdatedComment, comment);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Elsa.Workflows;

namespace Elsa.Integrations.GitHub.Activities.Events;

/// <summary>
/// Base class for GitHub event activities.
/// </summary>
public abstract class GitHubEventActivity : GitHubTriggerActivity
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using Elsa.Workflows;
using Elsa.Workflows.Attributes;
using Elsa.Workflows.Models;
using JetBrains.Annotations;
using Octokit;

namespace Elsa.Integrations.GitHub.Activities.Events;

/// <summary>
/// Triggers when a new branch is created.
/// </summary>
[Activity(
"Elsa.GitHub.Events",
"GitHub Events",
"Triggers when a new branch is created.",
DisplayName = "Watch Branches")]
[UsedImplicitly]
public class WatchBranches : GitHubEventActivity
{
/// <summary>
/// The owner of the repository to watch.
/// </summary>
[Input(Description = "The owner of the repository to watch.")]
public Input<string> Owner { get; set; } = null!;

/// <summary>
/// The name of the repository to watch.
/// </summary>
[Input(Description = "The name of the repository to watch.")]
public Input<string> Repository { get; set; } = null!;

/// <summary>
/// The branch that triggered the activity.
/// </summary>
[Output(Description = "The branch that triggered the activity.")]
public Output<Branch> BranchEvent { get; set; } = default!;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using Elsa.Workflows;
using Elsa.Workflows.Attributes;
using Elsa.Workflows.Models;
using JetBrains.Annotations;
using Octokit;

namespace Elsa.Integrations.GitHub.Activities.Events;

/// <summary>
/// Triggers when an issue is created or updated.
/// </summary>
[Activity(
"Elsa.GitHub.Events",
"GitHub Events",
"Triggers when an issue is created or updated.",
DisplayName = "Watch Issues")]
[UsedImplicitly]
public class WatchIssues : GitHubEventActivity
{
/// <summary>
/// The owner of the repository to watch.
/// </summary>
[Input(Description = "The owner of the repository to watch.")]
public Input<string> Owner { get; set; } = null!;

/// <summary>
/// The name of the repository to watch.
/// </summary>
[Input(Description = "The name of the repository to watch.")]
public Input<string> Repository { get; set; } = null!;

/// <summary>
/// The issue event that triggered the activity.
/// </summary>
[Output(Description = "The issue event that triggered the activity.")]
public Output<Issue> IssueEvent { get; set; } = default!;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
using Elsa.Workflows;
using Elsa.Workflows.Attributes;
using Elsa.Workflows.Models;
using JetBrains.Annotations;
using Octokit;

namespace Elsa.Integrations.GitHub.Activities.Events;

/// <summary>
/// Triggers when a pull request is created or updated.
/// </summary>
[Activity(
"Elsa.GitHub.Events",
"GitHub Events",
"Triggers when a pull request is created or updated.",
DisplayName = "Watch Pull Requests")]
[UsedImplicitly]
public class WatchPullRequests : GitHubEventActivity
{
/// <summary>
/// The owner of the repository to watch.
/// </summary>
[Input(Description = "The owner of the repository to watch.")]
public Input<string> Owner { get; set; } = null!;

/// <summary>
/// The name of the repository to watch.
/// </summary>
[Input(Description = "The name of the repository to watch.")]
public Input<string> Repository { get; set; } = null!;

/// <summary>
/// The pull request event that triggered the activity.
/// </summary>
[Output(Description = "The pull request event that triggered the activity.")]
public Output<PullRequest> PullRequestEvent { get; set; } = default!;
}
Loading