|
1 | | -# GHEC billing and usage reporting |
| 1 | +# GitHub Enterprise Cloud Billing and Usage Reporting |
2 | 2 |
|
3 | | -This action extracts billing and usage numbers from an enterprise and creates a report as a GitHub issue in the repository where it is running. |
| 3 | +This action extracts billing and usage numbers from a GitHub enterprise and |
| 4 | +creates a report as an issue in the repository where it is running. |
4 | 5 |
|
5 | | -## Inputs and environment variables |
| 6 | +## Inputs |
6 | 7 |
|
7 | | -### Inputs |
| 8 | +- **`enterprise_slug`**: The |
| 9 | + [slug](https://en.wikipedia.org/wiki/Clean_URL#Slug) of the enterprise you |
| 10 | + wish to query |
| 11 | +- **`enterprise_token`**: The token that has access to the enterprise you wish |
| 12 | + to query |
8 | 13 |
|
9 | | -- **enterprise**: the [slug](https://en.wikipedia.org/wiki/Clean_URL#Slug) of the enterprise you wish to query. |
10 | | -- **title**: the title of the report issue. This title will be used as the issue title and as the top heading of the issue body with the date of the run appended to it. By [default](https://github.com/ActionsDesk/ghec-enterprise-reporting/blob/main/action.yml) the title will have the value `GHEC Usage Report`. |
| 14 | + This should be created as a |
| 15 | + [GitHub Actions secret](https://docs.github.com/en/actions/security-for-github-actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository) |
| 16 | + in the repository that is using this action. This token should have the |
| 17 | + following scopes: |
11 | 18 |
|
12 | | -### Environment variables |
| 19 | + - `admin:enterprise` |
| 20 | + - `admin:org` |
13 | 21 |
|
14 | | -Environment variables are meant to be used in your workflow file. Take a look at our [docs for the proper workflow file syntax](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions). |
| 22 | +- **`github_token`**: The token that will be used to create the issue (defaults |
| 23 | + to the |
| 24 | + [automatic token](https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication) |
| 25 | + provided by GitHub) |
| 26 | +- **`issue_title`**: The title of the report issue (default: |
| 27 | + `GHEC Usage Report`) |
15 | 28 |
|
16 | | -When dealing with token please take extra care and use the secure store available in every GitHub repo. Once the value has been added to the secure store you can access it in your workflow file by using `${{secrets.SECURE_VALUE}}` syntax. Here's a [sample workflow](#using-this-action) file as an example. |
| 29 | + This title will be used as the issue title, as well as the top heading of the |
| 30 | + issue body with the date of the run appended to it. |
17 | 31 |
|
18 | | -#### ENTERPRISE_TOKEN |
| 32 | +## Usage |
19 | 33 |
|
20 | | -A token that has access to the enterprise level data for the enterprise you wish to query. To create a token go to the settings on the account that should manage it. |
21 | | - |
22 | | -It's important that this token have the following OAuth scopes: |
23 | | - |
24 | | -- admin:enterprise |
25 | | -- admin:org |
26 | | - |
27 | | -This token needs to be added to the secrets store of the repository that is using it. Take a look at our docs for more on [using secrets with GitHub Actions](https://docs.github.com/en/actions/getting-started-with-github-actions/security-hardening-for-github-actions#using-secrets). |
28 | | -Take a look at our docs for more information about [personal access tokens](https://docs.github.com/en/developers/apps/about-apps#personal-access-tokens) and [OAuth scopes](https://docs.github.com/en/developers/apps/scopes-for-oauth-apps). |
29 | | - |
30 | | -#### GITHUB_TOKEN |
31 | | - |
32 | | -This is the GitHub token that is available in the Action's context. This token will be used to create an issue with the generated report. You don't have to do anything more to use this. |
33 | | - |
34 | | -## Using this action |
35 | | - |
36 | | -A great way to using this action is with a scheduler. Here's an example workflow file that will run our action on the 28th day of the month, every month: |
| 34 | +A great way to using this action is with a scheduler. Here's an example workflow |
| 35 | +file that will run our action on the 28th day of the month, every month: |
37 | 36 |
|
38 | 37 | ```yaml |
39 | 38 | on: |
|
42 | 41 |
|
43 | 42 | jobs: |
44 | 43 | report: |
| 44 | + name: Report on GitHub Enterprise Cloud Usage |
45 | 45 | runs-on: ubuntu-latest |
46 | 46 |
|
47 | 47 | steps: |
48 | | - - uses: actionsdesk/ghec-enterprise-reporting@v2 |
| 48 | + - name: Generate Report |
| 49 | + id: report |
| 50 | + uses: ActionsDesk/ghec-enterprise-reporting@vX.Y.Z # Replace with the latest version |
49 | 51 | with: |
50 | | - enterprise: 'awesome-enterprise' |
51 | | - title: 'Much enterprise reporting' |
52 | | - env: |
53 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
54 | | - ENTERPRISE_TOKEN: ${{secrets.ENTERPRISE_TOKEN}} |
| 52 | + enterprise_slug: awesome-enterprise |
| 53 | + enterprise_token: ${{ secrets.ENTERPRISE_TOKEN }} |
| 54 | + issue_title: My Enterprise Report |
| 55 | +``` |
| 56 | +
|
| 57 | +## Example Output |
| 58 | +
|
| 59 | +The following markdown will be generated in the issue body: |
| 60 | +
|
| 61 | +```markdown |
| 62 | +This usage report is for the **ENTERPRISE_SLUG** GHEC account. |
| 63 | + |
| 64 | +## AssetPacks |
| 65 | + |
| 66 | +Total Purchased: 6 |
| 67 | + |
| 68 | +## Enterprise Organizations |
| 69 | + |
| 70 | +| Name | Login | Billing Email | |
| 71 | +| -------- | --------- | ------------- | |
| 72 | +| ORG_NAME | ORG_LOGIN | BILLING_EMAIL | |
| 73 | + |
| 74 | +## Bandwidth |
| 75 | + |
| 76 | +| Usage | Quota | Usage Percentage | |
| 77 | +| ----- | ----- | ---------------- | |
| 78 | +| 0 | 0 | 0 | |
| 79 | + |
| 80 | +## Storage |
| 81 | + |
| 82 | +| Usage | Quota | Usage Percentage | |
| 83 | +| ----- | ----- | ---------------- | |
| 84 | +| 0 | 0 | 0 | |
| 85 | + |
| 86 | +## Licenses |
| 87 | + |
| 88 | +| Total Licenses | All Licensable Users Count | Total Available Licenses | |
| 89 | +| -------------- | -------------------------- | ------------------------ | |
| 90 | +| 0 | 0 | 0 | |
| 91 | + |
| 92 | +## Actions Usage |
| 93 | + |
| 94 | +| Minutes Used | Paid Minutes Used | Included Minutes | |
| 95 | +| ------------ | ----------------- | ---------------- | |
| 96 | +| 0 | 0 | 0 | |
| 97 | + |
| 98 | +## Packages Usage |
| 99 | + |
| 100 | +| Total GB Bandwidth Used | Total Paid GB Bandwidth Used | Included GB Bandwidth | |
| 101 | +| ----------------------- | ---------------------------- | --------------------- | |
| 102 | +| 0 | 0 | 0 | |
| 103 | + |
| 104 | +## Shared Storage Usage |
| 105 | + |
| 106 | +| Days Left In Cycle | Estimated Paid Storage For Month | Estimated Storage For Month | |
| 107 | +| ------------------ | -------------------------------- | --------------------------- | |
| 108 | +| 0 | 0 | 0 | |
55 | 109 | ``` |
56 | 110 |
|
57 | 111 | ## Contributing |
58 | 112 |
|
59 | | -All contributions are welcome, from issues to pull requests. Please take a look at our [CONTRIBUTION.md](CONTRIBUTION.md) file for details! |
| 113 | +All contributions are welcome, from issues to pull requests. Please take a look |
| 114 | +at our [CONTRIBUTION.md](CONTRIBUTION.md) file for details! |
0 commit comments