Skip to content

Commit

Permalink
Merge pull request #332 from dflook/github-dot-com-token
Browse files Browse the repository at this point in the history
Add GITHUB_DOM_COM_TOKEN
  • Loading branch information
dflook committed Mar 1, 2024
2 parents 05383b5 + 606912e commit c270ae8
Show file tree
Hide file tree
Showing 27 changed files with 239 additions and 2 deletions.
7 changes: 5 additions & 2 deletions image/src/opentofu/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
import os

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

if os.environ.get('GITHUB_API_URL', 'https://api.github.com') == 'https://api.github.com':
if os.environ.get('GITHUB_DOT_COM_TOKEN'):
# We have a specific token for github.com
token = os.environ.get('GITHUB_DOT_COM_TOKEN')
elif os.environ.get('GITHUB_API_URL', 'https://api.github.com') == 'https://api.github.com':
# Use the provided GITHUB_TOKEN, if we think it is for github.com and not an enterprise instance
token = os.environ.get('TERRAFORM_ACTIONS_GITHUB_TOKEN')
else:
token = None
Expand Down
9 changes: 9 additions & 0 deletions terraform-apply/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,15 @@ These input values must be the same as any [`dflook/terraform-plan`](https://git
- Type: string
- Optional

* `GITHUB_DOT_COM_TOKEN`

This is used to specify a token for GitHub.com when the action is running on a GitHub Enterprise instance.
This is only used for downloading OpenTofu binaries from GitHub.com.
If this is not set, an unauthenticated request will be made to GitHub.com to download the binary, which may be rate limited.

- Type: string
- Optional

* `TERRAFORM_CLOUD_TOKENS`

API tokens for cloud hosts, of the form `<host>=<token>`. Multiple tokens may be specified, one per line.
Expand Down
9 changes: 9 additions & 0 deletions terraform-check/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,15 @@ This is intended to run on a schedule to notify if manual changes to your infras

## Environment Variables

* `GITHUB_DOT_COM_TOKEN`

This is used to specify a token for GitHub.com when the action is running on a GitHub Enterprise instance.
This is only used for downloading OpenTofu binaries from GitHub.com.
If this is not set, an unauthenticated request will be made to GitHub.com to download the binary, which may be rate limited.

- Type: string
- Optional

* `TERRAFORM_CLOUD_TOKENS`

API tokens for cloud hosts, of the form `<host>=<token>`. Multiple tokens may be specified, one per line.
Expand Down
9 changes: 9 additions & 0 deletions terraform-destroy-workspace/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,15 @@ This action uses the `terraform destroy` command to destroy all resources in a T

## Environment Variables

* `GITHUB_DOT_COM_TOKEN`

This is used to specify a token for GitHub.com when the action is running on a GitHub Enterprise instance.
This is only used for downloading OpenTofu binaries from GitHub.com.
If this is not set, an unauthenticated request will be made to GitHub.com to download the binary, which may be rate limited.

- Type: string
- Optional

* `TERRAFORM_CLOUD_TOKENS`

API tokens for cloud hosts, of the form `<host>=<token>`. Multiple tokens may be specified, one per line.
Expand Down
9 changes: 9 additions & 0 deletions terraform-destroy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,15 @@ and [dflook/terraform-apply](https://github.com/dflook/terraform-github-actions/

## Environment Variables

* `GITHUB_DOT_COM_TOKEN`

This is used to specify a token for GitHub.com when the action is running on a GitHub Enterprise instance.
This is only used for downloading OpenTofu binaries from GitHub.com.
If this is not set, an unauthenticated request will be made to GitHub.com to download the binary, which may be rate limited.

- Type: string
- Optional

* `TERRAFORM_CLOUD_TOKENS`

API tokens for cloud hosts, of the form `<host>=<token>`. Multiple tokens may be specified, one per line.
Expand Down
9 changes: 9 additions & 0 deletions terraform-fmt-check/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ If any files are not correctly formatted a failing GitHub check will be added fo

## Environment Variables

* `GITHUB_DOT_COM_TOKEN`

This is used to specify a token for GitHub.com when the action is running on a GitHub Enterprise instance.
This is only used for downloading OpenTofu binaries from GitHub.com.
If this is not set, an unauthenticated request will be made to GitHub.com to download the binary, which may be rate limited.

- Type: string
- Optional

* `TERRAFORM_CLOUD_TOKENS`

For the purpose of detecting the Terraform version to use from a cloud backend.
Expand Down
9 changes: 9 additions & 0 deletions terraform-fmt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ This action uses the `terraform fmt -recursive` command to reformat files in a d

## Environment Variables

* `GITHUB_DOT_COM_TOKEN`

This is used to specify a token for GitHub.com when the action is running on a GitHub Enterprise instance.
This is only used for downloading OpenTofu binaries from GitHub.com.
If this is not set, an unauthenticated request will be made to GitHub.com to download the binary, which may be rate limited.

- Type: string
- Optional

* `TERRAFORM_CLOUD_TOKENS`

For the purpose of detecting the Terraform version to use from a cloud backend.
Expand Down
9 changes: 9 additions & 0 deletions terraform-new-workspace/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ Creates a new Terraform workspace. If the workspace already exists, succeeds wit

## Environment Variables

* `GITHUB_DOT_COM_TOKEN`

This is used to specify a token for GitHub.com when the action is running on a GitHub Enterprise instance.
This is only used for downloading OpenTofu binaries from GitHub.com.
If this is not set, an unauthenticated request will be made to GitHub.com to download the binary, which may be rate limited.

- Type: string
- Optional

* `TERRAFORM_CLOUD_TOKENS`

API tokens for cloud hosts, of the form `<host>=<token>`. Multiple tokens may be specified, one per line.
Expand Down
9 changes: 9 additions & 0 deletions terraform-output/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ Retrieve the root-level outputs from a Terraform configuration.

## Environment Variables

* `GITHUB_DOT_COM_TOKEN`

This is used to specify a token for GitHub.com when the action is running on a GitHub Enterprise instance.
This is only used for downloading OpenTofu binaries from GitHub.com.
If this is not set, an unauthenticated request will be made to GitHub.com to download the binary, which may be rate limited.

- Type: string
- Optional

* `TERRAFORM_CLOUD_TOKENS`

API tokens for cloud hosts, of the form `<host>=<token>`. Multiple tokens may be specified, one per line.
Expand Down
9 changes: 9 additions & 0 deletions terraform-plan/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,15 @@ The [dflook/terraform-apply](https://github.com/dflook/terraform-github-actions/
- Type: string
- Optional

* `GITHUB_DOT_COM_TOKEN`

This is used to specify a token for GitHub.com when the action is running on a GitHub Enterprise instance.
This is only used for downloading OpenTofu binaries from GitHub.com.
If this is not set, an unauthenticated request will be made to GitHub.com to download the binary, which may be rate limited.

- Type: string
- Optional

* `TERRAFORM_CLOUD_TOKENS`

API tokens for cloud hosts, of the form `<host>=<token>`. Multiple tokens may be specified, one per line.
Expand Down
9 changes: 9 additions & 0 deletions terraform-remote-state/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ Retrieves the root-level outputs from a Terraform remote state.

## Environment Variables

* `GITHUB_DOT_COM_TOKEN`

This is used to specify a token for GitHub.com when the action is running on a GitHub Enterprise instance.
This is only used for downloading OpenTofu binaries from GitHub.com.
If this is not set, an unauthenticated request will be made to GitHub.com to download the binary, which may be rate limited.

- Type: string
- Optional

* `TERRAFORM_CLOUD_TOKENS`

API tokens for cloud hosts, of the form `<host>=<token>`. Multiple tokens may be specified, one per line.
Expand Down
9 changes: 9 additions & 0 deletions terraform-unlock-state/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ Force unlocks a Terraform remote state.

## Environment Variables

* `GITHUB_DOT_COM_TOKEN`

This is used to specify a token for GitHub.com when the action is running on a GitHub Enterprise instance.
This is only used for downloading OpenTofu binaries from GitHub.com.
If this is not set, an unauthenticated request will be made to GitHub.com to download the binary, which may be rate limited.

- Type: string
- Optional

* `TERRAFORM_CLOUD_TOKENS`

API tokens for cloud hosts, of the form `<host>=<token>`. Multiple tokens may be specified, one per line.
Expand Down
9 changes: 9 additions & 0 deletions terraform-validate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,15 @@ If the Terraform configuration is not valid, the build is failed.

## Environment Variables

* `GITHUB_DOT_COM_TOKEN`

This is used to specify a token for GitHub.com when the action is running on a GitHub Enterprise instance.
This is only used for downloading OpenTofu binaries from GitHub.com.
If this is not set, an unauthenticated request will be made to GitHub.com to download the binary, which may be rate limited.

- Type: string
- Optional

* `TERRAFORM_CLOUD_TOKENS`

API tokens for cloud hosts, of the form `<host>=<token>`. Multiple tokens may be specified, one per line.
Expand Down
9 changes: 9 additions & 0 deletions terraform-version/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,15 @@ outputs yourself.

## Environment Variables

* `GITHUB_DOT_COM_TOKEN`

This is used to specify a token for GitHub.com when the action is running on a GitHub Enterprise instance.
This is only used for downloading OpenTofu binaries from GitHub.com.
If this is not set, an unauthenticated request will be made to GitHub.com to download the binary, which may be rate limited.

- Type: string
- Optional

* `TERRAFORM_CLOUD_TOKENS`

API tokens for cloud hosts, of the form `<host>=<token>`. Multiple tokens may be specified, one per line.
Expand Down
9 changes: 9 additions & 0 deletions tofu-apply/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,15 @@ These input values must be the same as any [`dflook/tofu-plan`](https://github.c
- Type: string
- Optional

* `GITHUB_DOT_COM_TOKEN`

This is used to specify a token for GitHub.com when the action is running on a GitHub Enterprise instance.
This is only used for downloading OpenTofu binaries from GitHub.com.
If this is not set, an unauthenticated request will be made to GitHub.com to download the binary, which may be rate limited.

- Type: string
- Optional

* `TERRAFORM_CLOUD_TOKENS`

API tokens for cloud hosts, of the form `<host>=<token>`. Multiple tokens may be specified, one per line.
Expand Down
9 changes: 9 additions & 0 deletions tofu-check/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,15 @@ This is intended to run on a schedule to notify if manual changes to your infras

## Environment Variables

* `GITHUB_DOT_COM_TOKEN`

This is used to specify a token for GitHub.com when the action is running on a GitHub Enterprise instance.
This is only used for downloading OpenTofu binaries from GitHub.com.
If this is not set, an unauthenticated request will be made to GitHub.com to download the binary, which may be rate limited.

- Type: string
- Optional

* `TERRAFORM_CLOUD_TOKENS`

API tokens for cloud hosts, of the form `<host>=<token>`. Multiple tokens may be specified, one per line.
Expand Down
9 changes: 9 additions & 0 deletions tofu-destroy-workspace/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,15 @@ This action uses the `tofu destroy` command to destroy all resources in an OpenT

## Environment Variables

* `GITHUB_DOT_COM_TOKEN`

This is used to specify a token for GitHub.com when the action is running on a GitHub Enterprise instance.
This is only used for downloading OpenTofu binaries from GitHub.com.
If this is not set, an unauthenticated request will be made to GitHub.com to download the binary, which may be rate limited.

- Type: string
- Optional

* `TERRAFORM_CLOUD_TOKENS`

API tokens for cloud hosts, of the form `<host>=<token>`. Multiple tokens may be specified, one per line.
Expand Down
9 changes: 9 additions & 0 deletions tofu-destroy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,15 @@ and [dflook/tofu-apply](https://github.com/dflook/terraform-github-actions/tree/

## Environment Variables

* `GITHUB_DOT_COM_TOKEN`

This is used to specify a token for GitHub.com when the action is running on a GitHub Enterprise instance.
This is only used for downloading OpenTofu binaries from GitHub.com.
If this is not set, an unauthenticated request will be made to GitHub.com to download the binary, which may be rate limited.

- Type: string
- Optional

* `TERRAFORM_CLOUD_TOKENS`

API tokens for cloud hosts, of the form `<host>=<token>`. Multiple tokens may be specified, one per line.
Expand Down
9 changes: 9 additions & 0 deletions tofu-fmt-check/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ If any files are not correctly formatted a failing GitHub check will be added fo

## Environment Variables

* `GITHUB_DOT_COM_TOKEN`

This is used to specify a token for GitHub.com when the action is running on a GitHub Enterprise instance.
This is only used for downloading OpenTofu binaries from GitHub.com.
If this is not set, an unauthenticated request will be made to GitHub.com to download the binary, which may be rate limited.

- Type: string
- Optional

* `TERRAFORM_CLOUD_TOKENS`

For the purpose of detecting the OpenTofu version to use from a cloud backend.
Expand Down
9 changes: 9 additions & 0 deletions tofu-fmt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ This action uses the `tofu fmt -recursive` command to reformat files in a direct

## Environment Variables

* `GITHUB_DOT_COM_TOKEN`

This is used to specify a token for GitHub.com when the action is running on a GitHub Enterprise instance.
This is only used for downloading OpenTofu binaries from GitHub.com.
If this is not set, an unauthenticated request will be made to GitHub.com to download the binary, which may be rate limited.

- Type: string
- Optional

* `TERRAFORM_CLOUD_TOKENS`

For the purpose of detecting the OpenTofu version to use from a cloud backend.
Expand Down
9 changes: 9 additions & 0 deletions tofu-new-workspace/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ Creates a new OpenTofu workspace. If the workspace already exists, succeeds with

## Environment Variables

* `GITHUB_DOT_COM_TOKEN`

This is used to specify a token for GitHub.com when the action is running on a GitHub Enterprise instance.
This is only used for downloading OpenTofu binaries from GitHub.com.
If this is not set, an unauthenticated request will be made to GitHub.com to download the binary, which may be rate limited.

- Type: string
- Optional

* `TERRAFORM_CLOUD_TOKENS`

API tokens for cloud hosts, of the form `<host>=<token>`. Multiple tokens may be specified, one per line.
Expand Down
9 changes: 9 additions & 0 deletions tofu-output/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ Retrieve the root-level outputs from an OpenTofu configuration.

## Environment Variables

* `GITHUB_DOT_COM_TOKEN`

This is used to specify a token for GitHub.com when the action is running on a GitHub Enterprise instance.
This is only used for downloading OpenTofu binaries from GitHub.com.
If this is not set, an unauthenticated request will be made to GitHub.com to download the binary, which may be rate limited.

- Type: string
- Optional

* `TERRAFORM_CLOUD_TOKENS`

API tokens for cloud hosts, of the form `<host>=<token>`. Multiple tokens may be specified, one per line.
Expand Down
9 changes: 9 additions & 0 deletions tofu-plan/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,15 @@ The [dflook/tofu-apply](https://github.com/dflook/terraform-github-actions/tree/
- Type: string
- Optional

* `GITHUB_DOT_COM_TOKEN`

This is used to specify a token for GitHub.com when the action is running on a GitHub Enterprise instance.
This is only used for downloading OpenTofu binaries from GitHub.com.
If this is not set, an unauthenticated request will be made to GitHub.com to download the binary, which may be rate limited.

- Type: string
- Optional

* `TERRAFORM_CLOUD_TOKENS`

API tokens for cloud hosts, of the form `<host>=<token>`. Multiple tokens may be specified, one per line.
Expand Down
9 changes: 9 additions & 0 deletions tofu-remote-state/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ Retrieves the root-level outputs from an OpenTofu remote state.

## Environment Variables

* `GITHUB_DOT_COM_TOKEN`

This is used to specify a token for GitHub.com when the action is running on a GitHub Enterprise instance.
This is only used for downloading OpenTofu binaries from GitHub.com.
If this is not set, an unauthenticated request will be made to GitHub.com to download the binary, which may be rate limited.

- Type: string
- Optional

* `TERRAFORM_CLOUD_TOKENS`

API tokens for cloud hosts, of the form `<host>=<token>`. Multiple tokens may be specified, one per line.
Expand Down
9 changes: 9 additions & 0 deletions tofu-unlock-state/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ Force unlocks an OpenTofu remote state.

## Environment Variables

* `GITHUB_DOT_COM_TOKEN`

This is used to specify a token for GitHub.com when the action is running on a GitHub Enterprise instance.
This is only used for downloading OpenTofu binaries from GitHub.com.
If this is not set, an unauthenticated request will be made to GitHub.com to download the binary, which may be rate limited.

- Type: string
- Optional

* `TERRAFORM_CLOUD_TOKENS`

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

0 comments on commit c270ae8

Please sign in to comment.