1package Net::GitHub::V3::Actions;
2
3use Moo;
4
5our $VERSION   = '1.02';
6our $AUTHORITY = 'cpan:FAYLAND';
7
8use Carp;
9use URI::Escape;
10use URI;
11use HTTP::Request::Common qw(POST);
12
13with 'Net::GitHub::V3::Query';
14
15## build methods on fly
16my %__methods = (
17
18    ### -------------------------------------------------------------------------------
19    ### Artifacts
20    ### -------------------------------------------------------------------------------
21
22    # List artifacts for a repository
23    artifacts => { v => 2,  url => '/repos/:owner/:repo/actions/artifacts', method => 'GET', paginate => 1 },
24
25    # List workflow run artifacts
26    # GET /repos/:owner/:repo/actions/runs/:run_id/artifacts
27    run_artifacts => { v => 2, url => '/repos/:owner/:repo/actions/runs/:run_id/artifacts', method => 'GET', paginate => 1 },
28
29    # Get an artifact
30    # GET /repos/:owner/:repo/actions/artifacts/:artifact_id
31    artifact => {  v => 2, url => '/repos/:owner/:repo/actions/artifacts/:artifact_id', method => 'GET' },
32
33    ### -------------------------------------------------------------------------------
34    ### Workflows - https://developer.github.com/v3/actions/workflows/
35    ### -------------------------------------------------------------------------------
36
37    # List repository workflows
38    # GET /repos/:owner/:repo/actions/workflows
39    workflows => { v => 2, url => '/repos/:owner/:repo/actions/workflows', method => 'GET', paginate => 1 },
40
41    # Get a workflow
42    # GET /repos/:owner/:repo/actions/workflows/:workflow_id
43    workflow => {  v => 2, url => '/repos/:owner/:repo/actions/workflows/:workflow_id', method => 'GET' },
44
45    ### -------------------------------------------------------------------------------
46    ### Workflow Jobs - https://developer.github.com/v3/actions/workflow-jobs/
47    ### -------------------------------------------------------------------------------
48
49    # List jobs for a workflow run
50    # GET /repos/:owner/:repo/actions/runs/:run_id/jobs pagination
51    jobs => {  v => 2, url => '/repos/:owner/:repo/actions/runs/:run_id/jobs', method => 'GET', paginate => 1 },
52
53    # Get a workflow job
54    # GET /repos/:owner/:repo/actions/jobs/:job_id
55    job => {  v => 2, url => '/repos/:owner/:repo/actions/jobs/:job_id', method => 'GET' },
56
57    ### -------------------------------------------------------------------------------
58    ### Workflow Runs - https://developer.github.com/v3/actions/workflow-runs/
59    ### -------------------------------------------------------------------------------
60
61    runs => { v => 2, url => '/repos/:owner/:repo/actions/workflows/:workflow_id/runs', method => 'GET', paginate => 1 },
62
63    # ...
64);
65__build_methods( __PACKAGE__, %__methods );
66
67no Moo;
68
691;
70__END__
71
72=head1 NAME
73
74Net::GitHub::V3::Actions - GitHub Actions API
75
76=head1 SYNOPSIS
77
78    use Net::GitHub::V3;
79
80    my $gh = Net::GitHub::V3->new; # read L<Net::GitHub::V3> to set right authentication info
81    my $actions = $gh->actions;
82
83    # set :user/:repo for simple calls
84    $actions->set_default_user_repo('fayland', 'perl-net-github');
85
86    $actions->workflows();
87    $actions->workflows( { owner => 'xxx', repo => 'repo' } );
88
89
90=head1 DESCRIPTION
91
92=head2 METHODS
93
94=head3 GitHub Actions
95
96L<https://developer.github.com/v3/actions/>
97
98=head3 Artifacts
99
100L<https://developer.github.com/v3/actions/artifacts/>
101
102=over 4
103
104=item artifacts
105
106List artifacts for a repository
107
108    $actions->artifacts( { owner => 'xxx', repo => 'repo' } );
109
110=item run_artifacts
111
112    $actions->run_artifacts( { owner => 'xxx', repo => 'repo', run_id => XXX } );
113
114=item artifact
115
116    $actions->artifacts( { owner => 'xxx', repo => 'repo', artifact_id => 'ID' } );
117
118=back
119
120=head3 Workflows
121
122L<https://developer.github.com/v3/actions/workflows/>
123
124=over 4
125
126=item workflows
127
128List repository workflows
129
130    $actions->workflows( { owner => 'xxx', repo => 'repo' } );
131
132=item workflow
133
134Get a workflow
135
136    $actions->workflow( { owner => 'xxx', repo => 'repo', workflow_id => 1234 } );
137
138=back
139
140=head3 Workflow Jobs
141
142L<https://developer.github.com/v3/actions/workflow-jobs/>
143
144=over 4
145
146=item jobs
147
148List jobs for a workflow run
149
150=item job
151
152Get a workflow job
153
154=back
155
156=head1 AUTHOR & COPYRIGHT & LICENSE
157
158Refer L<Net::GitHub>
159