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
Update documentation to explain GitHub REST API rate limits and how to authenticate Evergreen requests. Added a new, expanded GitHub rate limit doc with guidance on creating personal access tokens, setting GITHUB_TOKEN/GH_TOKEN on Windows, macOS/Linux and in GitHub Actions, and how authentication raises the limit to 5,000 requests/hour. Clarified that Get-EvergreenApp and Update-Evergreen query GitHub (and may be rate limited), added verbose rate-limit output details, and linked relevant pages. Changes applied to docs/github.md, Get-EvergreenApp.md, Update-Evergreen.md, and issues.md.
Copy file name to clipboardExpand all lines: docs/github.md
+77-10Lines changed: 77 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,30 +3,97 @@ layout: doc
3
3
---
4
4
# Working with GitHub rate limits
5
5
6
-
Over 150 applications supported by Evergreen are hosted on GitHub repositories or pull data from a GitHub repository for determining the latest version. Evergreen makes use of the GitHub REST API when requesting details for these applications.
6
+
Over 150 applications supported by Evergreen are hosted on GitHub repositories or pull data from a GitHub repository to determine the latest version. Evergreen uses the GitHub REST API when querying details for these applications.
7
7
8
-
GitHub implements rate limits on the API for unauthenticated requests. See [Rate limits for the REST API](https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api) for details.
8
+
Both `Get-EvergreenApp` and `Update-Evergreen` make requests to the GitHub REST API:
9
9
10
-
## Authenticating to the GitHub API
10
+
-`Get-EvergreenApp` queries GitHub releases and tags to return version and download details for applications hosted on GitHub
11
+
-`Update-Evergreen` downloads the latest application functions and manifests from the [eucpilots/evergreen-apps](https://github.com/eucpilots/evergreen-apps) repository
11
12
12
-
For environments that may consume more than 60 requests to the API in an hour, Evergreen supports authenticated requests by use of [personal access tokens](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens). [Fine-grained personal access tokens](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token) should be used.
13
+
GitHub implements rate limits on the API for unauthenticated requests, allowing only 60 requests per hour per IP address. In environments where Evergreen is run frequently or across multiple sessions, this limit can be reached quickly. See [Rate limits for the REST API](https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api) for details.
13
14
14
-
A token that has read-only access to public repositories only is recommended. This should enable you to use a long expiry time; however, secure management of this token is recommended.
15
+
Authenticating requests with a personal access token raises the limit to 5,000 requests per hour.
16
+
17
+
## Creating a personal access token
18
+
19
+
Evergreen supports authenticated requests using [personal access tokens](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens). [Fine-grained personal access tokens](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token) are recommended.
20
+
21
+
A token with read-only access to public repositories is sufficient. No additional scopes or permissions are required. Because the token only needs read access to public repositories, a long expiry period is reasonable; however, secure management of the token is still recommended.
15
22
16
23

17
24
18
-
## GITHUB_TOKEN environment variable
25
+
## Setting the GITHUB_TOKEN environment variable
26
+
27
+
Evergreen reads the `GITHUB_TOKEN` or `GH_TOKEN` environment variables. Setting either variable with the value of the personal access token enables Evergreen to authenticate requests to the GitHub API automatically. Both `Get-EvergreenApp` and `Update-Evergreen` will use the token without any additional configuration.
28
+
29
+
### Windows
30
+
31
+
To set the variable for the current user persistently (survives across sessions and reboots):
The variable can also be set via **System Properties > Advanced > Environment Variables** in the Windows UI.
44
+
45
+
To set it only for the current PowerShell session:
46
+
47
+
```powershell
48
+
$env:GITHUB_TOKEN = "<your-token>"
49
+
```
50
+
51
+
### macOS and Linux
52
+
53
+
Add the following line to your shell profile (`~/.zshrc` for Zsh, `~/.bashrc` or `~/.bash_profile` for Bash) to set the variable persistently:
19
54
20
-
Evergreen will use the token stored in the `GITHUB_TOKEN` or `GH_TOKEN` environment variables. Setting either of these variables with the value of the personal access token will allow Evergreen to use the token when querying the GitHub API, significantly increasing the number of available requests.
55
+
```bash
56
+
export GITHUB_TOKEN="<your-token>"
57
+
```
58
+
59
+
Reload the profile after saving:
21
60
22
-
### GitHub Actions
61
+
```bash
62
+
source~/.zshrc # or source ~/.bashrc
63
+
```
23
64
24
-
Additionally, if you are running Evergreen in a GitHub Actions workflow, the `GITHUB_TOKEN` will be used, so no additional personal access tokens are required - [Use GITHUB_TOKEN for authentication in workflows](https://docs.github.com/en/actions/tutorials/authenticate-with-github_token).
65
+
To set it only for the current shell session:
66
+
67
+
```bash
68
+
export GITHUB_TOKEN="<your-token>"
69
+
```
25
70
26
-
For example, add the following code to the top of your workflow file:
71
+
## GitHub Actions
72
+
73
+
When running Evergreen in a GitHub Actions workflow, the `GITHUB_TOKEN` secret is automatically available and does not require a separate personal access token. See [Use GITHUB_TOKEN for authentication in workflows](https://docs.github.com/en/actions/tutorials/authenticate-with-github_token).
74
+
75
+
Add the following to the top of your workflow file to make the token available as an environment variable:
27
76
28
77
```yaml
29
78
# Environment variables
30
79
env:
31
80
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32
81
```
82
+
83
+
Evergreen will pick up the variable automatically when the workflow runs.
84
+
85
+
## Checking the rate limit status
86
+
87
+
When running `Get-EvergreenApp` for an application that uses GitHub as its source, passing `-Verbose` will output the current number of remaining API requests:
88
+
89
+
```powershell
90
+
Get-EvergreenApp -Name "MicrosoftBicep" -Verbose
91
+
```
92
+
93
+
The verbose output will include a line similar to:
94
+
95
+
```
96
+
VERBOSE: Get-GitHubRateLimit: Remaining requests to the GitHub API: 58 of 60
97
+
```
98
+
99
+
When the rate limit is exhausted, Evergreen returns a `RateLimited` version object and outputs a warning. Setting `GITHUB_TOKEN` or `GH_TOKEN` before running Evergreen will resolve this.
Copy file name to clipboardExpand all lines: docs/help/en-US/Get-EvergreenApp.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,8 @@ The output from this function can be passed to Where-Object to filter for a spec
26
26
27
27
`Get-EvergreenApp` uses official vendor sources including update APIs, web queries, and code repository locations to return details of a target application at run time.
28
28
29
+
Over 150 applications supported by Evergreen are hosted on GitHub. For these applications, `Get-EvergreenApp` queries the GitHub REST API, which is subject to a rate limit of 60 unauthenticated requests per hour. Set the `GITHUB_TOKEN` or `GH_TOKEN` environment variable to a personal access token to authenticate requests and raise the limit to 5,000 requests per hour.
For applications that use GitHub as a source, `Get-EvergreenApp` queries the GitHub REST API. Set the `GITHUB_TOKEN` or `GH_TOKEN` environment variable to a personal access token to authenticate these requests and avoid rate limiting. See [Working with GitHub rate limits](https://eucpilots.com/evergreen-docs/github/) for details.
Enables separation of the core Evergreen module from app-specific code and manifests. Downloads the latest versions of /Apps and /Manifests from a specified GitHub repository to a user-writable location (no admin required). By default, the local cache is downloaded to %LocalAppData%\Evergreen on Windows, and ~/.evergreen on macOS and Linux.
22
+
Enables separation of the core Evergreen module from app-specific code and manifests. Downloads the latest versions of /Apps and /Manifests from the [eucpilots/evergreen-apps](https://github.com/eucpilots/evergreen-apps) GitHub repository to a user-writable location (no admin required). By default, the local cache is downloaded to %LocalAppData%\Evergreen on Windows, and ~/.evergreen on macOS and Linux.
23
+
24
+
`Update-Evergreen` queries the GitHub REST API to check for and download updates. In environments where it is run frequently, GitHub's unauthenticated API rate limit of 60 requests per hour may be reached. Set the `GITHUB_TOKEN` or `GH_TOKEN` environment variable to a personal access token to authenticate requests and raise the limit to 5,000 requests per hour.
`Update-Evergreen` uses the GitHub REST API to check for and download updates from the eucpilots/evergreen-apps repository. Set the `GITHUB_TOKEN` or `GH_TOKEN` environment variable to a personal access token to authenticate these requests. See [Working with GitHub rate limits](https://eucpilots.com/evergreen-docs/github/) for details.
81
+
78
82
## RELATED LINKS
83
+
84
+
[Working with GitHub rate limits](https://eucpilots.com/evergreen-docs/github/)
Copy file name to clipboardExpand all lines: docs/issues.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,9 +21,9 @@ Supports Windows platforms only - this function wraps `Resolve-DnsName` which is
21
21
22
22
### Get-GitHubRepoRelease
23
23
24
-
`Get-GitHubRepoRelease` queries release information from a specified GitHub repository to return version and binaries or is used to source the version number for some applications. This function uses an unauthenticated session to the GitHub REST API, thus requests will be [rate limited]. Using the `-Verbose` parameter with `Get-EvergreenApp` for those applications that use GitHub as the source, will display the number of available requests to the API.
24
+
`Get-GitHubRepoRelease` queries release information from a specified GitHub repository to return version and binaries or is used to source the version number for some applications. By default, requests to the GitHub REST API are unauthenticated and subject to a rate limit of 60 requests per hour. Using the `-Verbose` parameter with `Get-EvergreenApp` for those applications that use GitHub as the source will display the number of available API requests remaining.
25
25
26
-
Updating `Get-GitHubRepoRelease` to support authenticated requests is planned for a future release.
26
+
Authenticated requests are supported via the `GITHUB_TOKEN` or `GH_TOKEN` environment variables, which raise the rate limit to 5,000 requests per hour. See [Working with GitHub rate limits](/github) for setup instructions.
0 commit comments