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();
        }
Esempio n. 2
0
 public JobApplicationService(ILoggerFactory loggerFactory, GitHubActionContext gitHubActionContext, HandlerRequestContext handlerRequestContext, IMediator mediator, IObjectScheduledService objectScheduledService, IEasyCronService easyCronService)
 {
     _logger = loggerFactory.CreateLogger <JobApplicationService>();
     _gitHubActionContext   = gitHubActionContext;
     _handlerRequestContext = handlerRequestContext;
     _mediator = mediator;
     _objectScheduledService = objectScheduledService;
     _easyCronService        = easyCronService;
 }