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
Copy file name to clipboardExpand all lines: README.md
+19-18Lines changed: 19 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,18 +7,18 @@ Why would you want to do this? Well the `GITHUB_TOKEN` whilst having an expiry,
7
7
events that prevent downstream GitHub Actions workflow from triggering. This prevents recursive loops from workflows, but
8
8
there are a number of valid types of workflows that may require or desire triggering downstream GitHub Actions Workflows.
9
9
10
-
The existing way to work around this today is to use a Personal Access Token, but these tokens are tied to a user and
11
-
generally are over priviledged for the tasks at hand, increasing the risk if they get exposed and are not time limited
10
+
The existing way to work around this today is to use a Personal Access Token, but these tokens are tied to a user and
11
+
generally are over priviledged for the tasks at hand, increasing the risk if they get exposed and are not time limited
12
12
like the `GITHUB_TOKEN`.
13
13
14
-
This is where a GitHub Application access token can really help out. The benefits of GitHub Applications is that you can
15
-
restrict/scope the access of the token considerably more than what can be achieved using a Personal Access Token. The
14
+
This is where a GitHub Application access token can really help out. The benefits of GitHub Applications is that you can
15
+
restrict/scope the access of the token considerably more than what can be achieved using a Personal Access Token. The
16
16
access token from the GitHub Application is also time limited, expiring after an hour from being issued, providing some
17
-
more protection against any leaking of credentials from a Workflow.
17
+
more protection against any leaking of credentials from a Workflow.
18
18
19
19
20
20
## Usage
21
-
To use this action you first need a GitHub Application created so that you can request temporary credentials on behalf
21
+
To use this action you first need a GitHub Application created so that you can request temporary credentials on behalf
22
22
of the application inside your workflows.
23
23
24
24
__Requirements:__
@@ -28,7 +28,7 @@ __Requirements:__
28
28
29
29
30
30
### Creating a GitHub Application
31
-
You will need to have a GitHub Application that is scoped with the necessary permissions for the token that you want to
31
+
You will need to have a GitHub Application that is scoped with the necessary permissions for the token that you want to
32
32
retrieve at runtime.
33
33
34
34
To create a GitHub Application you can follow the steps available at https://docs.github.com/en/developers/apps/creating-a-github-app
@@ -43,39 +43,40 @@ The important configuration details for the application are:
43
43
*`Where can this GitHub App be installed?` should be scoped to your desired audience (the current account, or any account)
44
44
45
45
Once the application has been created you will be taken to the `General` settings page for the new application.
46
-
The GitHub Application will be issued an `App ID` which you can see in the `About` section, take note of this for later
46
+
The GitHub Application will be issued an `App ID` which you can see in the `About` section, take note of this for later
47
47
use in the Actions workflow.
48
48
49
-
On the `General` settings page for the application, at the bottom there is a `Private keys` section that you can use to
49
+
On the `General` settings page for the application, at the bottom there is a `Private keys` section that you can use to
50
50
generate a private key that can be utilized to authenticate as the application.
51
51
Generate a new private key and store the information for later use.
52
52
53
53
_Note: the private keys can and should be rotated periodically to limit the risks of them being exposed in use._
54
54
55
55
56
56
### Install the GitHub Application
57
-
Once you have the GitHub Application defined, you will need to install the application on the target organization or repository/
58
-
repositories that you want it to have access to. These will be any repositories that you want to gather information
57
+
Once you have the GitHub Application defined, you will need to install the application on the target organization or repository/
58
+
repositories that you want it to have access to. These will be any repositories that you want to gather information
59
59
from or want the application to modify as per the scopes that were defined when the application was installed.
60
60
61
-
_Note: The GitHub Application will need to be installed on the organization and or repository that you are executing
61
+
_Note: The GitHub Application will need to be installed on the organization and or repository that you are executing
62
62
the GitHub Actions workflow from, as the implementation requires this to be able to generate the access tokens_.
63
63
64
64
65
65
### Using the GitHub Action in a Workflow
66
66
67
-
To use the action in a worklow, it is recommended that you store the GitHub Application Private key in GitHub Secrets.
67
+
To use the action in a worklow, it is recommended that you store the GitHub Application Private key in GitHub Secrets.
68
68
This can be done at a repository or organization level (provided that the actions workflow has access to the secret).
69
69
70
-
When storing the Private key, you can store the raw PEM encoded certificate contents that the GitHub Application
71
-
generates for you or Base64 encode it in the secret.
70
+
When storing the Private key, you can store the raw PEM encoded certificate contents that the GitHub Application
71
+
generates for you or Base64 encode it in the secret.
72
72
73
73
#### Parameters
74
74
75
75
*`application_id`: The GitHub Application ID that you wil be getting the access token for
76
76
*`application_private_key`: A private key generated for the GitHub Application so that you can authenticate (PEM format or base64 encoded)
77
77
*`permissions`: The optional limited permissions to request, specifying this allows you to request a subset of the permissions for the underlying GitHub Application. Defaults to all permissions available to the GitHub Application when not specified. Must be provided in a comma separated list of token permissions e.g. `issues:read, secrets:write, packages:read`
78
78
*`organization`: An optional organization name if the GitHub Application is installed at the Organization level (instead of the repository).
79
+
*`github_api_base_url`: An optional URl to the GitHub API, this will be read and loaded from the runner environment by default, but you might be bridging access to a secondary GHES instance or from GHES to GHEC, you can utilize this to make sure the Octokit library is talking to the right GitHub instance.
79
80
80
81
#### Examples
81
82
Get a token with all the permissions of the GitHub Application:
Copy file name to clipboardExpand all lines: action.yml
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,10 @@ inputs:
21
21
description: The GitHub Organization to get the application installation for, if not specified will use the current repository instead
22
22
required: false
23
23
24
+
github_api_base_url:
25
+
description: The GitHub API base URL to use, no needed it working within the same GitHub instance as the workflow as it will get picked up from the environment
26
+
required: false
27
+
24
28
outputs:
25
29
token:
26
30
description: A valid token representing the Application that can be used to access what the Application has been scoped to access.
0 commit comments