static async Task Main(string[] args)
        {
            GitHubActionContext actionContext = new GitHubActionContext(args);

            actionContext.LoadParameters();

            HandlerRequestContext handlerRequestContext = new HandlerRequestContext();

            var serviceProvider = new ServiceCollection()
                                  .AddLogging(x => x.AddConsole())
                                  .AddGitHubClient(actionContext)
                                  .AddSingleton(actionContext)
                                  .AddSingleton(handlerRequestContext)
                                  .AddSingleton <IJobApplicationService, JobApplicationService>()
                                  .AddSingleton <IEventService, EventService>()
                                  .AddSingleton <ITwitterService, TwitterService>()
                                  .AddSingleton <IObjectScheduledService, ObjectScheduledService>()
                                  .AddSingleton <IIdentityService, IdentityService>()
                                  .AddSingleton <IEasyCronService, EasyCronService>()
                                  .AddHttpClientServices()
                                  .AddMediatR(typeof(Program))
                                  .BuildServiceProvider();

            var jobApplicationService = serviceProvider.GetService <IJobApplicationService>();

            await jobApplicationService.ExecuteJob();
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            GitHubActionContext actionContext = new GitHubActionContext(args);

            actionContext.LoadParameters();

            string value = actionContext.GetParameter(Parameters.WhoToGreet);

            Console.WriteLine($"Hello {value}!");
        }