You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -94,11 +114,15 @@ calls [GitHub List Organisational Repos API](https://docs.github.com/en/rest/rep
94
114
. For repository workflows, it
95
115
calls [GitHub List Repository Workflow API](https://docs.github.com/en/rest/actions/workflows#list-repository-workflows)
96
116
. For workflow usage, it
97
-
calls [GitHub Get Workflow Usage API](https://docs.github.com/en/rest/actions/workflows#get-workflow-usage). Finally for
98
-
days left in the billing cycle , it
99
-
calls [GitHub Get shared storage billing for an organization API](https://docs.github.com/en/rest/billing#get-shared-storage-billing-for-an-organization)
117
+
calls [GitHub Get Workflow Usage API](https://docs.github.com/en/rest/actions/workflows#get-workflow-usage).
118
+
119
+
For days left in the billing cycle , it
120
+
calls [GitHub Get Actions billing for an organization API](https://docs.github.com/en/rest/billing#get-shared-storage-billing-for-an-organization)
100
121
.
101
122
123
+
Finally for monthly allowance, paid minutes and what GitHub think has been used it
124
+
calls [GitHub Get shared storage billing for an organization API](https://docs.github.com/en/rest/billing#get-github-actions-billing-for-an-organization)
125
+
102
126
## Prerequisites to Run as an GH Action
103
127
104
128
- an organisation or repo secret called `ORGANISATION` with the value of your organisation
@@ -112,31 +136,33 @@ calls [GitHub Get shared storage billing for an organization API](https://docs.g
112
136
Create a file called `gha-audit.yml` in your `workflows` directory, paste the following as the contents and you are good
113
137
to
114
138
go. [GHA best practices](https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-third-party-actions)
115
-
recommend using a commit SHA, rather than a version. The example below runs on a schedule at 3AM every day.
139
+
recommend using a commit SHA, rather than a version. The example below runs on a schedule at 3AM every day. This way
140
+
when the remaining allowance drops below the threshold (100 or user defined) a notification will be triggered.
116
141
117
142
```
118
-
name: GHA Billable Audit
143
+
name: GHA USAGE Audit
119
144
on:
120
145
schedule:
121
146
- cron: "0 3 * * *" # Runs at 03:00 AM (UTC) every day
122
147
jobs:
123
-
gha-billable-minutes-report:
148
+
gha-usage-minutes-report:
124
149
runs-on: ubuntu-latest
125
150
steps:
126
-
- name: GitHub Actions Billable Usage Audit
151
+
- name: GitHub Actions Usage Audit
127
152
uses: fergusmacd/github-action-usage@daff7e5517914546a1e39fcc22f476e1471853f6 # use a commit SHA
128
153
# pass user input as arguments
129
154
with:
130
155
organisation: ${{secrets.ORGANISATION}}
131
156
gitHubAPIKey: ${{secrets.GITHUBAPIKEY}} # default token in GitHub Workflow
132
157
loglevel: error # not required, change to debug if misbehaving
158
+
raisealarmremainingminutes: 100 # not required, defaults to 100
133
159
```
134
160
135
161
### Running Locally
136
162
137
163
The docker file and python script can both be run locally in the following ways.
0 commit comments