Skip to content

Commit b8b15df

Browse files
authored
Add BranchProtectionRuleEvent Installation field (#2216)
Fixes: #2214.
1 parent f262aa1 commit b8b15df

File tree

5 files changed

+37
-21
lines changed

5 files changed

+37
-21
lines changed

github/event_types.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@ type RequestedAction struct {
2020
//
2121
// GitHub API docs: https://docs.github.com/en/developers/webhooks-and-events/webhooks/webhook-events-and-payloads#branch_protection_rule
2222
type BranchProtectionRuleEvent struct {
23-
Action *string `json:"action,omitempty"`
24-
Rule *BranchProtectionRule `json:"rule,omitempty"`
25-
Changes *ProtectionChanges `json:"changes,omitempty"`
26-
Repo *Repository `json:"repository,omitempty"`
27-
Org *Organization `json:"organization,omitempty"`
28-
Sender *User `json:"sender,omitempty"`
23+
Action *string `json:"action,omitempty"`
24+
Rule *BranchProtectionRule `json:"rule,omitempty"`
25+
Changes *ProtectionChanges `json:"changes,omitempty"`
26+
Repo *Repository `json:"repository,omitempty"`
27+
Org *Organization `json:"organization,omitempty"`
28+
Sender *User `json:"sender,omitempty"`
29+
Installation *Installation `json:"installation,omitempty"`
2930
}
3031

3132
// CheckRunEvent is triggered when a check run is "created", "completed", or "rerequested".

github/github-accessors.go

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/github-accessors_test.go

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scrape/testdata/access-restrictions-disabled.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
Some extraneous markup removed to keep the file size smaller -->
33
<html lang="en">
44
<body class="logged-in env-production min-width-lg">
5-
5+
66
<div class="application-main " data-commit-hovercards-enabled>
77
<main id="js-pjax-container" data-pjax-container>
8-
8+
99
<div itemscope itemtype="http://schema.org/Organization">
1010

1111
<div class="container-lg px-3 d-flex">
1212

1313
<div class="col-9">
14-
14+
1515
<div class="boxed-group oauth-application-whitelist ">
1616
<h3>Third-party application access policy</h3>
1717
<div class="boxed-group-inner">

scrape/testdata/access-restrictions-enabled.html

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
Some extraneous markup removed to keep the file size smaller -->
33
<html lang="en">
44
<body class="logged-in env-production min-width-lg">
5-
5+
66
<div class="application-main " data-commit-hovercards-enabled>
77
<main id="js-pjax-container" data-pjax-container>
8-
8+
99

1010

1111
<div itemscope itemtype="http://schema.org/Organization">
1212

1313
<div class="container-lg px-3 d-flex">
1414

1515
<div class="col-9">
16-
16+
1717
<div class="boxed-group oauth-application-whitelist is-selectable">
1818
<h3>Third-party application access policy</h3>
1919
<div class="boxed-group-inner">
@@ -23,32 +23,32 @@ <h3>Third-party application access policy</h3>
2323
<p>
2424
Only approved applications can access data in this organization. Applications owned by <strong>google-test</strong> always have access.
2525
</p>
26-
26+
2727
<details
2828
class="details-reset details-overlay details-overlay-dark lh-default text-gray-dark d-inline-block text-left"
2929
>
3030
<summary
3131
class="btn btn-danger"
32-
33-
34-
35-
32+
33+
34+
35+
3636
>
37-
37+
3838
Remove restrictions
3939
</summary>
4040
<details-dialog
4141
aria-label="Are you sure?"
4242
class="Box Box--overlay d-flex flex-column anim-fade-in fast "
43-
43+
4444
>
4545
<div class="Box-header">
4646
<button class="Box-btn-octicon btn-octicon float-right" type="button" aria-label="Close dialog" data-close-dialog>
4747
<svg class="octicon octicon-x" viewBox="0 0 12 16" version="1.1" width="12" height="16" aria-hidden="true"><path fill-rule="evenodd" d="M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48L7.48 8z"/></svg>
4848
</button>
4949
<h3 class="Box-title ">Are you sure?</h3>
5050
</div>
51-
51+
5252
<div class="flash flash-full flash-warn">
5353
You’re about to remove all third-party application restrictions. Please read this carefully.
5454
</div>
@@ -69,7 +69,7 @@ <h3 class="Box-title ">Are you sure?</h3>
6969
<ul class="boxed-group-list">
7070
<li>
7171
<div class="float-right request-indicator">
72-
Approval requested by <a class="requestor" href="/willnorris">willnorris</a> &#8212;
72+
Approval requested by <a class="requestor" href="/willnorris">willnorris</a> &#8212;
7373
<a href="/orgs/google-test/policies/applications/22222">Review</a>
7474
</div>
7575
<img class="avatar float-left" src="https://avatars3.githubusercontent.com/oa/22222?s=40&amp;u=90a5890234f8061be4c6c0b29b4fa7594f2ba2d7&amp;v=4" height="20" width="20" alt="" />

0 commit comments

Comments
 (0)