38 Commits

Author SHA1 Message Date
Stefan 952a2a7073 feat: add support for enterprise-level GitHub Apps (#263)
This pull request adds support for generating GitHub App installation
tokens for enterprise-level installations.

### What changed

- Added a new `enterprise` input to `action.yml`.
- Wired `enterprise` through `main.js` and `lib/main.js`.
- Added validation so `enterprise` cannot be combined with `owner` or
`repositories`.
- Implemented enterprise installation lookup using the direct GitHub API
route `GET /enterprises/{enterprise}/installation`, then used the
returned installation ID to mint an installation token through
`@octokit/auth-app`.
- Updated `README.md` with enterprise installation usage and input
documentation.
- Updated `dist/main.cjs` for the bundled action.
- Shared token creation retry behavior across repository, owner, and
enterprise paths so server errors and transient network errors are
retried, while client errors fail immediately.

### Tests

Added focused test coverage for:

- enterprise token creation
- enterprise token creation with explicit permissions
- enterprise installation not found
- mutual exclusivity with `owner`
- mutual exclusivity with `repositories`
- owner installation client errors are not retried
- transient network errors are retried during token creation

### Notes

- This keeps the existing repository-scoped token behavior unchanged.
- Owner, repository, and enterprise token creation now share the same
retry policy: server errors and recognized transient network errors are
retried, while client errors fail immediately. This intentionally fixes
the previous owner-path behavior that retried client errors.

Refs:
-
https://github.blog/changelog/2025-07-01-enterprise-level-access-for-github-apps-and-installation-automation-apis/
-
https://docs.github.com/en/rest/apps/apps?apiVersion=2022-11-28#get-an-enterprise-installation-for-the-authenticated-app

---------

Co-authored-by: Parker Brown <17183625+parkerbxyz@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-05-08 11:56:11 -07:00
Josh Johanning 7989d206df docs: use APP_ prefix instead of reserved GITHUB_ prefix (#363)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-04-21 09:56:11 -07:00
Copilot e6bd4e6970 feat: add client-id input and deprecate app-id (#353)
GitHub now recommends using a GitHub App's Client ID for authentication.
This PR adds a first-class `client-id` input, keeps `app-id` available
for compatibility, and makes the migration path explicit in both runtime
behavior and documentation.

### Action inputs

- Adds a new `client-id` input
- Removes `required` from `app-id`
- Marks `app-id` as deprecated in `action.yml`

### Runtime behavior

- Updates input parsing to prefer `client-id`
- Falls back to `app-id` for existing workflows
- Adds a clear error when neither `client-id` nor `app-id` is provided

### Docs

- Updates the README to recommend `client-id`
- Switches usage examples to `client-id`
- Documents that `app-id` is deprecated and that `client-id` takes
precedence if both are set

### Regression coverage

- Adds a focused test proving a client-ID-shaped value works through the
new `client-id` input
- Adds coverage for the missing-ID validation path
- Updates snapshots to lock in the new metadata and runtime behavior

### Resulting usage

Users can migrate to the new input name directly:

```yaml
- uses: actions/create-github-app-token@v3
  with:
    client-id: ${{ vars.GITHUB_APP_CLIENT_ID }}
    private-key: ${{ secrets.GITHUB_APP_PRIVATE_KEY }}
```

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: parkerbxyz <17183625+parkerbxyz@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-10 17:36:03 -07:00
Parker Brown 739cf66feb docs: update README action versions
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
(cherry picked from commit b87c921a8e196a5881f0387a9685c0fa784ebde0)
2026-03-13 17:21:42 -07:00
Parker Brown 4451bcbc13 fix!: require NODE_USE_ENV_PROXY for proxy support (#342)
BREAKING CHANGE: Custom proxy handling has been removed. If you use HTTP_PROXY or HTTPS_PROXY, you must now also set NODE_USE_ENV_PROXY=1 on the action step.
2026-03-13 17:21:42 -07:00
Salman Chishti 2e564a0bb8 feat!: node 24 support (#275)
BREAKING CHANGE: Requires [Actions Runner v2.327.1](https://github.com/actions/runner/releases/tag/v2.327.1) or later if you are using a self-hosted runner.

---------

Co-authored-by: Parker Brown <17183625+parkerbxyz@users.noreply.github.com>
(cherry picked from commit 61789386cb)
2026-03-13 17:21:42 -07:00
Gregor Martynus 6d44c9fd24 docs(README): Client ID can be used as App ID (#251)
closes #136

---------

Co-authored-by: Parker Brown <17183625+parkerbxyz@users.noreply.github.com>
2025-05-21 09:51:36 -07:00
Yuta Kasai c3c17c79cc fix: use core.getBooleanInput() to retrieve boolean input values (#223)
This PR switches from evaluating values passed to `skip-token-revoke` as
true if they are truthy in JavaScript, to using `getBooleanInput`. This
change ensures that only proper YAML boolean values are recognized,
preventing unintended evaluations to true.
- The definition of `getBooleanInput` is here: definition of
`core#getBooealnInput` is here:
https://github.com/actions/toolkit/blob/930c89072712a3aac52d74b23338f00bb0cfcb24/packages/core/src/core.ts#L188-L208

The documentation states, `"If truthy, the token will not be revoked
when the current job is complete"`, so this change could be considered a
breaking change. This means that if there are users who rely on `truthy`
and expect values like whitespace or `"false"` to be evaluated as true
(though this is likely rare), it would be a breaking change.
- `Boolean(" ")` and `Boolean("false")` are both evaluated as true.

Alternatively, it can simply be considered a fix. How to handle this is
up to the maintainer.

Resolves https://github.com/actions/create-github-app-token/issues/216
2025-04-25 11:59:34 -07:00
CarolMebiom 9ba274d954 fix(README): use v2 in examples (#234)
Fixes #232
2025-04-25 11:32:06 -07:00
Gregor Martynus 0e0aa99a86 feat: permissions (#168)
- Load `app-permissions` from schema exported by `@octokit/openapi`
- Update documentation in README.md
- Implement the `permissions_*` inputs in the action code

---------

Co-authored-by: Parker Brown <17183625+parkerbxyz@users.noreply.github.com>
2025-03-27 19:00:54 +00:00
Carlos García bb3ca765af docs(README): remove extra space in variable syntax in README example (#201)
### Fix syntax error in GitHub Actions example in README  

This PR fixes a syntax error in the "Create a git committer string for
an app installation" example in the README file.

#### What was wrong?  
The example contained an incorrect space in the variable syntax:  
```yaml  
${ {steps.committer.outputs.string }}  
```  
This caused the example to fail, as GitHub Actions does not allow spaces
in variable interpolation.

#### What was fixed?  
The syntax was corrected to:  
```yaml  
${{ steps.committer.outputs.string }}  
```  

This fix ensures that users can copy and use the example without
encountering any errors.
2025-01-24 13:00:38 -08:00
Dylan T. 6f9957685a docs(README): fix typo (#186) 2024-12-19 16:20:55 -08:00
Peter Evans 796b88dc58 feat: allow repositories input to be comma or newline-separated (#169)
Resolves https://github.com/actions/create-github-app-token/issues/106

- Fixes the parsing to cope with whitespace in the input string.
- Allows the input to be comma or newline-separated. (I've done this for
all array-type inputs in my own actions, but I'm happy to remove this if
you only want to support comma-separated.)
- Added tests for parsing comma and newline-separated inputs.
2024-09-11 13:54:50 -07:00
vleon1a 000e2a0d29 docs(readme): document how a Base64 private key could be decoded (#155)
Addressing this comment
https://github.com/actions/create-github-app-token/issues/42#issuecomment-2214599409

---------

Co-authored-by: Parker Brown <17183625+parkerbxyz@users.noreply.github.com>
2024-07-11 22:09:08 +00:00
沙漠之子 d0ac2addd1 docs(README): fix the git committer string and Configure git CLI examples (#151)
1. Fix the `git committer string` and `Configure git CLI` examples.
2. Formatting examples
3. Modify the get `<BOT USER ID>` comment and add a note that
[octokit/request-action](https://github.com/octokit/request-action) can
be used.

---------

Co-authored-by: Parker Brown <17183625+parkerbxyz@users.noreply.github.com>
2024-07-02 20:09:29 -07:00
Anuraag (Rag) Agrawal 74cd7f68cb docs(README): fix committer string example and add git config example (#145) 2024-06-28 07:51:24 -07:00
Gregor Martynus 0fd38177ed docs(README): add note about expiration (#141)
addresses https://github.com/actions/create-github-app-token/issues/121#issuecomment-2043214796

Co-authored-by: Parker Brown <17183625+parkerbxyz@users.noreply.github.com>
2024-06-11 20:56:57 -07:00
Gregor Martynus b3be847492 docs(README): Create a git committer string for an app installation (#142)
closes #137
2024-06-11 10:16:50 -07:00
dependabot[bot] 9d23fb93dd feat(private-key): escaped newlines will be replaced (#132)
via https://github.com/gr2m/universal-github-app-jwt/releases/tag/v2.1.1
2024-05-01 11:15:40 -07:00
Gregor Martynus 34c66235f6 docs(README): remove github-api-url from most basic example (#120) 2024-03-30 11:15:37 -07:00
Martin Costello d9bc16919c fix: clarify owner input description (#118) 2024-03-25 09:53:54 -07:00
沙漠之子 babaff4320 feat(outputs): app-slug and installation-id (#105)
It is convenient to use `https://api.github.com/users/$app_slug[bot]` to
obtain the corresponding account ID later.
Then build `Signed-off-by: $app_slug[bot]
<$id+$app_slug[bot]@users.noreply.github.com>`.

Currently, there is no Linux environment to build test snapshot files
2024-03-01 19:18:38 +00:00
Mohammad Ismail 1e02bd5721 docs(README): add GHES workflow example (#104)
This pull request includes a significant change to the `README.md` file.
The change adds a new job to the GitHub Actions workflow, which is
designed to create an example of how to use `create-github-app-token`
action on GitHub Enterprise Server.

Resolves https://github.com/actions/create-github-app-token/issues/98

---------

Co-authored-by: Parker Brown <17183625+parkerbxyz@users.noreply.github.com>
2024-02-21 12:36:37 -08:00
Gregor Martynus 837e2752e0 feat: github-api-url (#88)
closes #77

---------

Co-authored-by: Parker Brown <17183625+parkerbxyz@users.noreply.github.com>
2024-01-26 10:51:16 -08:00
Steve Russo 8746053070 docs(README): fix use of deprecated arguments (#86)
Using those fields that have an underscore (instead of a hyphen) cause
the following warnings if used:
```
Warning: Input 'app_id' has been deprecated with message: 'app_id' is deprecated and will be removed in a future version. Use 'app-id' instead.
Warning: Input 'private_key' has been deprecated with message: 'private_key' is deprecated and will be removed in a future version. Use 'private-key' instead.
```

So this PR just drops the last use of `app_id` and `private_key` from
the README in favor of `app-id` and `private-key`.
2023-12-05 09:16:54 -08:00
Grant Birkinbine bb368d6a10 General Improvements (#70)
# General Improvements

> This is a classic @GrantBirki drive-by PR 🚗

This pull request does the following:

- Lightly updates and formats a few existing Actions workflows
- Adds a new `package-check` workflow to validate the contents of the
`dist/` directory have been properly built
- Uses a `.node-version` file so that local development and Actions
remain on the same pinned version of node
- Adds status badges to the readme for visual effect  🎨
2023-11-02 22:23:07 -07:00
Parker Brown d2cdb754af docs(README): create tokens for multiple accounts (#63)
Adds an example workflow to the README that shows how a matrix strategy can be used to create tokens for multiple user or organization accounts. Resolves #45.
2023-10-16 22:43:07 +00:00
Parker Brown b94a200224 docs: update skip-token-revoke input name (#61)
This is a quick follow-up to #59. I was mid-review when it merged and
noticed one instance of `skip_token_revoke` in the README that didn't
get changed to `skip-token-revoke`. The PR merged just before I pushed a
commit to fix it.
2023-10-06 13:19:45 -07:00
Clay Miller 7b1d2aef87 feat: use dash notation for inputs (deprecates underscore notation) (#59)
Fixes #57 

This PR implements the 3-step plan proposed by @gr2m in
https://github.com/actions/create-github-app-token/issues/57#issuecomment-1751272252:

> 1. Support both input types
> 2. Log a deprecation warning for the old notation
> 3. Add a test for deprecations

Although this PR supports both input formats simultaneously, I opted
_not_ to document the old format in the updated README. That’s a
decision I’m happy to revisit, if y’all would prefer to have
documentation for both the old and new formats.
2023-10-06 13:10:49 -07:00
Clay Miller 9ec88c41ee feat: Add a skip_token_revoke input for configuring token revocation (#54)
Fixes https://github.com/actions/create-github-app-token/issues/55

Currently, `actions/create-github-app-token` always/unconditionally
revokes the installation access token in a `post` step, at the
completion of the current job. This prevents tokens from being used in
other jobs.

This PR makes this behavior configurable:
- When the `skip-token-revoke` input is not specified (i.e. by default),
the token is revoked in a `post` step (i.e. the current behavior).
- When the `skip-token-revoke` input is set to a truthy value (e.g.
`"true"`[^1]), the token is not revoked in a `post` step.

This PR adds a test for the `skip-token-revoke: "true"` case.

This is configurable in other app token actions, e.g.
[tibdex/github-app-token](https://github.com/tibdex/github-app-token/blob/3eb77c7243b85c65e84acfa93fdbac02fb6bd532/README.md?plain=1#L46-L47)
and
[wow-actions/use-app-token](https://github.com/wow-actions/use-app-token/blob/cd772994fc762f99cf291f308797341327a49b0c/README.md?plain=1#L132).

[^1]: Note that `"false"` is also truthy: `Boolean("false")` is `true`.
If we think that’ll potentially confuse folks, I can require
`skip-token-revoke` to be set explicitly to `"true"`.
2023-10-06 09:10:49 -07:00
Tim Reimherr 20fd86373f feat: support tokens scoped to multiple repositories within organization (#46)
Co-authored-by: Gregor Martynus <39992+gr2m@users.noreply.github.com>
Co-authored-by: Parker Brown <17183625+parkerbxyz@users.noreply.github.com>
2023-10-03 22:28:48 -07:00
Josh Gross 5611f921d9 docs(README): clarify token masking (#29)
With #13, this action is explicitly masking the token so we don't need to mention that we're relying on a specific format of GitHub tokens being masked by the runner.
2023-08-25 21:51:50 -07:00
Gregor Martynus cb1fcdda59 fix(README): fix name in usage examples (#12) 2023-08-21 15:09:16 -07:00
Parker Brown 950f8a0559 docs(README): update title, description, formatting, and more (#11)
- Update title
- Remove blockquote formatting from description to improve accessibility
- Capitalize "app" in "GitHub App" for consistency
- Add missing periods in unordered list
- Use new highlight syntax for note
2023-08-21 14:31:57 -07:00
Gregor Martynus c04bb41e61 fix(README): update repository name, remove section for feature that is not yet implemented (#9)
Co-authored-by: Parker Brown <17183625+parkerbxyz@users.noreply.github.com>
2023-08-21 11:49:27 -07:00
Gregor Martynus c08b7942e4 fix(README): update action name (#5) 2023-06-15 15:48:41 -07:00
Gregor Martynus f45685208f feat: initial version (#1)
Co-authored-by: Parker Brown <17183625+parkerbxyz@users.noreply.github.com>
Co-authored-by: Gregor Martynus <gr2m@users.noreply.github.com>
2023-06-08 17:04:10 -07:00
Gregor Martynus abcb015889 docs(README): initial version 2023-05-18 15:37:30 -07:00