Skip to content

Commit c270ae8

Browse files
authored
Merge pull request #332 from dflook/github-dot-com-token
Add GITHUB_DOM_COM_TOKEN
2 parents 05383b5 + 606912e commit c270ae8

File tree

27 files changed

+239
-2
lines changed

27 files changed

+239
-2
lines changed

image/src/opentofu/github.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22
import os
33

44
# This provides a github client for github.com
5-
# It will use a provided token, if we think it is for github.com and not an enterprise instance
65

7-
if os.environ.get('GITHUB_API_URL', 'https://api.github.com') == 'https://api.github.com':
6+
if os.environ.get('GITHUB_DOT_COM_TOKEN'):
7+
# We have a specific token for github.com
8+
token = os.environ.get('GITHUB_DOT_COM_TOKEN')
9+
elif os.environ.get('GITHUB_API_URL', 'https://api.github.com') == 'https://api.github.com':
10+
# Use the provided GITHUB_TOKEN, if we think it is for github.com and not an enterprise instance
811
token = os.environ.get('TERRAFORM_ACTIONS_GITHUB_TOKEN')
912
else:
1013
token = None

terraform-apply/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,15 @@ These input values must be the same as any [`dflook/terraform-plan`](https://git
299299
- Type: string
300300
- Optional
301301

302+
* `GITHUB_DOT_COM_TOKEN`
303+
304+
This is used to specify a token for GitHub.com when the action is running on a GitHub Enterprise instance.
305+
This is only used for downloading OpenTofu binaries from GitHub.com.
306+
If this is not set, an unauthenticated request will be made to GitHub.com to download the binary, which may be rate limited.
307+
308+
- Type: string
309+
- Optional
310+
302311
* `TERRAFORM_CLOUD_TOKENS`
303312

304313
API tokens for cloud hosts, of the form `<host>=<token>`. Multiple tokens may be specified, one per line.

terraform-check/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,15 @@ This is intended to run on a schedule to notify if manual changes to your infras
101101

102102
## Environment Variables
103103

104+
* `GITHUB_DOT_COM_TOKEN`
105+
106+
This is used to specify a token for GitHub.com when the action is running on a GitHub Enterprise instance.
107+
This is only used for downloading OpenTofu binaries from GitHub.com.
108+
If this is not set, an unauthenticated request will be made to GitHub.com to download the binary, which may be rate limited.
109+
110+
- Type: string
111+
- Optional
112+
104113
* `TERRAFORM_CLOUD_TOKENS`
105114

106115
API tokens for cloud hosts, of the form `<host>=<token>`. Multiple tokens may be specified, one per line.

terraform-destroy-workspace/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,15 @@ This action uses the `terraform destroy` command to destroy all resources in a T
119119

120120
## Environment Variables
121121

122+
* `GITHUB_DOT_COM_TOKEN`
123+
124+
This is used to specify a token for GitHub.com when the action is running on a GitHub Enterprise instance.
125+
This is only used for downloading OpenTofu binaries from GitHub.com.
126+
If this is not set, an unauthenticated request will be made to GitHub.com to download the binary, which may be rate limited.
127+
128+
- Type: string
129+
- Optional
130+
122131
* `TERRAFORM_CLOUD_TOKENS`
123132

124133
API tokens for cloud hosts, of the form `<host>=<token>`. Multiple tokens may be specified, one per line.

terraform-destroy/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,15 @@ and [dflook/terraform-apply](https://github.com/dflook/terraform-github-actions/
123123

124124
## Environment Variables
125125

126+
* `GITHUB_DOT_COM_TOKEN`
127+
128+
This is used to specify a token for GitHub.com when the action is running on a GitHub Enterprise instance.
129+
This is only used for downloading OpenTofu binaries from GitHub.com.
130+
If this is not set, an unauthenticated request will be made to GitHub.com to download the binary, which may be rate limited.
131+
132+
- Type: string
133+
- Optional
134+
126135
* `TERRAFORM_CLOUD_TOKENS`
127136

128137
API tokens for cloud hosts, of the form `<host>=<token>`. Multiple tokens may be specified, one per line.

terraform-fmt-check/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ If any files are not correctly formatted a failing GitHub check will be added fo
6262

6363
## Environment Variables
6464

65+
* `GITHUB_DOT_COM_TOKEN`
66+
67+
This is used to specify a token for GitHub.com when the action is running on a GitHub Enterprise instance.
68+
This is only used for downloading OpenTofu binaries from GitHub.com.
69+
If this is not set, an unauthenticated request will be made to GitHub.com to download the binary, which may be rate limited.
70+
71+
- Type: string
72+
- Optional
73+
6574
* `TERRAFORM_CLOUD_TOKENS`
6675

6776
For the purpose of detecting the Terraform version to use from a cloud backend.

terraform-fmt/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,15 @@ This action uses the `terraform fmt -recursive` command to reformat files in a d
5151

5252
## Environment Variables
5353

54+
* `GITHUB_DOT_COM_TOKEN`
55+
56+
This is used to specify a token for GitHub.com when the action is running on a GitHub Enterprise instance.
57+
This is only used for downloading OpenTofu binaries from GitHub.com.
58+
If this is not set, an unauthenticated request will be made to GitHub.com to download the binary, which may be rate limited.
59+
60+
- Type: string
61+
- Optional
62+
5463
* `TERRAFORM_CLOUD_TOKENS`
5564

5665
For the purpose of detecting the Terraform version to use from a cloud backend.

terraform-new-workspace/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ Creates a new Terraform workspace. If the workspace already exists, succeeds wit
4848

4949
## Environment Variables
5050

51+
* `GITHUB_DOT_COM_TOKEN`
52+
53+
This is used to specify a token for GitHub.com when the action is running on a GitHub Enterprise instance.
54+
This is only used for downloading OpenTofu binaries from GitHub.com.
55+
If this is not set, an unauthenticated request will be made to GitHub.com to download the binary, which may be rate limited.
56+
57+
- Type: string
58+
- Optional
59+
5160
* `TERRAFORM_CLOUD_TOKENS`
5261

5362
API tokens for cloud hosts, of the form `<host>=<token>`. Multiple tokens may be specified, one per line.

terraform-output/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ Retrieve the root-level outputs from a Terraform configuration.
4949

5050
## Environment Variables
5151

52+
* `GITHUB_DOT_COM_TOKEN`
53+
54+
This is used to specify a token for GitHub.com when the action is running on a GitHub Enterprise instance.
55+
This is only used for downloading OpenTofu binaries from GitHub.com.
56+
If this is not set, an unauthenticated request will be made to GitHub.com to download the binary, which may be rate limited.
57+
58+
- Type: string
59+
- Optional
60+
5261
* `TERRAFORM_CLOUD_TOKENS`
5362

5463
API tokens for cloud hosts, of the form `<host>=<token>`. Multiple tokens may be specified, one per line.

terraform-plan/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,15 @@ The [dflook/terraform-apply](https://github.com/dflook/terraform-github-actions/
200200
- Type: string
201201
- Optional
202202

203+
* `GITHUB_DOT_COM_TOKEN`
204+
205+
This is used to specify a token for GitHub.com when the action is running on a GitHub Enterprise instance.
206+
This is only used for downloading OpenTofu binaries from GitHub.com.
207+
If this is not set, an unauthenticated request will be made to GitHub.com to download the binary, which may be rate limited.
208+
209+
- Type: string
210+
- Optional
211+
203212
* `TERRAFORM_CLOUD_TOKENS`
204213

205214
API tokens for cloud hosts, of the form `<host>=<token>`. Multiple tokens may be specified, one per line.

0 commit comments

Comments
 (0)