Compare commits
27
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef741caab5 | ||
|
|
7bd0371149 | ||
|
|
e6bd4e6970 | ||
|
|
076e9480ca | ||
|
|
3bbe07d928 | ||
|
|
28a99e369c | ||
|
|
4df50600ef | ||
|
|
4843c538d9 | ||
|
|
f8d387b68d | ||
|
|
d2129bd463 | ||
|
|
77b94efc3e | ||
|
|
3ab4c66898 | ||
|
|
739cf66feb | ||
|
|
db40289976 | ||
|
|
496a7ac4eb | ||
|
|
3870dc3051 | ||
|
|
4451bcbc13 | ||
|
|
dce0ab05f3 | ||
|
|
2e564a0bb8 | ||
|
|
fee1f7d63c | ||
|
|
6bda5bc141 | ||
|
|
b04413352d | ||
|
|
5cbc65624c | ||
|
|
b4f638f48e | ||
|
|
20749b7294 | ||
|
|
3f1903e205 | ||
|
|
cfb49a3e58 |
+19
-15
@@ -1,30 +1,34 @@
|
|||||||
version: 2
|
version: 2
|
||||||
|
|
||||||
|
multi-ecosystem-groups:
|
||||||
|
minor-and-patch:
|
||||||
|
schedule:
|
||||||
|
interval: 'quarterly'
|
||||||
|
commit-message:
|
||||||
|
prefix: 'fix'
|
||||||
|
prefix-development: 'build'
|
||||||
|
include: 'scope'
|
||||||
|
|
||||||
updates:
|
updates:
|
||||||
- package-ecosystem: 'npm'
|
- package-ecosystem: 'npm'
|
||||||
directory: '/'
|
directory: '/'
|
||||||
schedule:
|
patterns: ['*']
|
||||||
interval: 'monthly'
|
multi-ecosystem-group: 'minor-and-patch'
|
||||||
groups:
|
groups:
|
||||||
production-dependencies:
|
production:
|
||||||
dependency-type: 'production'
|
dependency-type: 'production'
|
||||||
update-types:
|
update-types:
|
||||||
- minor
|
- minor
|
||||||
- patch
|
- patch
|
||||||
development-dependencies:
|
development:
|
||||||
dependency-type: 'development'
|
dependency-type: 'development'
|
||||||
update-types:
|
update-types:
|
||||||
- minor
|
- minor
|
||||||
- patch
|
- patch
|
||||||
commit-message:
|
|
||||||
prefix: 'fix'
|
|
||||||
prefix-development: 'build'
|
|
||||||
include: 'scope'
|
|
||||||
- package-ecosystem: 'github-actions'
|
- package-ecosystem: 'github-actions'
|
||||||
directory: '/'
|
directory: '/'
|
||||||
schedule:
|
patterns: ['*']
|
||||||
interval: 'monthly'
|
multi-ecosystem-groups: 'minor-and-patch'
|
||||||
groups:
|
update-types:
|
||||||
github-actions:
|
- minor
|
||||||
update-types:
|
- patch
|
||||||
- minor
|
|
||||||
- patch
|
|
||||||
|
|||||||
@@ -61,8 +61,8 @@ jobs:
|
|||||||
# do not run from forks, as forks don’t have access to repository secrets
|
# do not run from forks, as forks don’t have access to repository secrets
|
||||||
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login == github.event.pull_request.base.repo.owner.login
|
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login == github.event.pull_request.base.repo.owner.login
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v6
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
node-version-file: package.json
|
node-version-file: package.json
|
||||||
cache: 'npm'
|
cache: 'npm'
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ GitHub Action for creating a GitHub App installation access token.
|
|||||||
In order to use this action, you need to:
|
In order to use this action, you need to:
|
||||||
|
|
||||||
1. [Register new GitHub App](https://docs.github.com/apps/creating-github-apps/setting-up-a-github-app/creating-a-github-app).
|
1. [Register new GitHub App](https://docs.github.com/apps/creating-github-apps/setting-up-a-github-app/creating-a-github-app).
|
||||||
2. [Store the App's ID or Client ID in your repository environment variables](https://docs.github.com/actions/learn-github-actions/variables#defining-configuration-variables-for-multiple-workflows) (example: `APP_ID`).
|
2. [Store the App's Client ID in your repository environment variables](https://docs.github.com/actions/how-tos/write-workflows/choose-what-workflows-do/use-variables#defining-configuration-variables-for-multiple-workflows) (example: `GITHUB_APP_CLIENT_ID`).
|
||||||
3. [Store the App's private key in your repository secrets](https://docs.github.com/actions/security-guides/encrypted-secrets?tool=webui#creating-encrypted-secrets-for-a-repository) (example: `PRIVATE_KEY`).
|
3. [Store the App's private key in your repository secrets](https://docs.github.com/actions/how-tos/write-workflows/choose-what-workflows-do/use-secrets?tool=webui#creating-secrets-for-a-repository) (example: `GITHUB_APP_PRIVATE_KEY`).
|
||||||
|
|
||||||
> [!IMPORTANT]
|
> [!IMPORTANT]
|
||||||
> An installation access token expires after 1 hour. Please [see this comment](https://github.com/actions/create-github-app-token/issues/121#issuecomment-2043214796) for alternative approaches if you have long-running processes.
|
> An installation access token expires after 1 hour. Please [see this comment](https://github.com/actions/create-github-app-token/issues/121#issuecomment-2043214796) for alternative approaches if you have long-running processes.
|
||||||
@@ -31,8 +31,8 @@ jobs:
|
|||||||
- uses: actions/create-github-app-token@v3
|
- uses: actions/create-github-app-token@v3
|
||||||
id: app-token
|
id: app-token
|
||||||
with:
|
with:
|
||||||
app-id: ${{ vars.APP_ID }}
|
client-id: ${{ vars.GITHUB_APP_CLIENT_ID }}
|
||||||
private-key: ${{ secrets.PRIVATE_KEY }}
|
private-key: ${{ secrets.GITHUB_APP_PRIVATE_KEY }}
|
||||||
- uses: ./actions/staging-tests
|
- uses: ./actions/staging-tests
|
||||||
with:
|
with:
|
||||||
token: ${{ steps.app-token.outputs.token }}
|
token: ${{ steps.app-token.outputs.token }}
|
||||||
@@ -51,15 +51,15 @@ jobs:
|
|||||||
id: app-token
|
id: app-token
|
||||||
with:
|
with:
|
||||||
# required
|
# required
|
||||||
app-id: ${{ vars.APP_ID }}
|
client-id: ${{ vars.GITHUB_APP_CLIENT_ID }}
|
||||||
private-key: ${{ secrets.PRIVATE_KEY }}
|
private-key: ${{ secrets.GITHUB_APP_PRIVATE_KEY }}
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
token: ${{ steps.app-token.outputs.token }}
|
token: ${{ steps.app-token.outputs.token }}
|
||||||
ref: ${{ github.head_ref }}
|
ref: ${{ github.head_ref }}
|
||||||
# Make sure the value of GITHUB_TOKEN will not be persisted in repo's config
|
# Make sure the value of GITHUB_TOKEN will not be persisted in repo's config
|
||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
- uses: creyD/prettier_action@v4.3
|
- uses: creyD/prettier_action@v6
|
||||||
with:
|
with:
|
||||||
github_token: ${{ steps.app-token.outputs.token }}
|
github_token: ${{ steps.app-token.outputs.token }}
|
||||||
```
|
```
|
||||||
@@ -77,8 +77,8 @@ jobs:
|
|||||||
id: app-token
|
id: app-token
|
||||||
with:
|
with:
|
||||||
# required
|
# required
|
||||||
app-id: ${{ vars.APP_ID }}
|
client-id: ${{ vars.GITHUB_APP_CLIENT_ID }}
|
||||||
private-key: ${{ secrets.PRIVATE_KEY }}
|
private-key: ${{ secrets.GITHUB_APP_PRIVATE_KEY }}
|
||||||
- name: Get GitHub App User ID
|
- name: Get GitHub App User ID
|
||||||
id: get-user-id
|
id: get-user-id
|
||||||
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
|
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
|
||||||
@@ -102,8 +102,8 @@ jobs:
|
|||||||
id: app-token
|
id: app-token
|
||||||
with:
|
with:
|
||||||
# required
|
# required
|
||||||
app-id: ${{ vars.APP_ID }}
|
client-id: ${{ vars.GITHUB_APP_CLIENT_ID }}
|
||||||
private-key: ${{ secrets.PRIVATE_KEY }}
|
private-key: ${{ secrets.GITHUB_APP_PRIVATE_KEY }}
|
||||||
- name: Get GitHub App User ID
|
- name: Get GitHub App User ID
|
||||||
id: get-user-id
|
id: get-user-id
|
||||||
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
|
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
|
||||||
@@ -138,10 +138,10 @@ jobs:
|
|||||||
- uses: actions/create-github-app-token@v3
|
- uses: actions/create-github-app-token@v3
|
||||||
id: app-token
|
id: app-token
|
||||||
with:
|
with:
|
||||||
app-id: ${{ vars.APP_ID }}
|
client-id: ${{ vars.GITHUB_APP_CLIENT_ID }}
|
||||||
private-key: ${{ secrets.PRIVATE_KEY }}
|
private-key: ${{ secrets.GITHUB_APP_PRIVATE_KEY }}
|
||||||
owner: ${{ github.repository_owner }}
|
owner: ${{ github.repository_owner }}
|
||||||
- uses: peter-evans/create-or-update-comment@v3
|
- uses: peter-evans/create-or-update-comment@v4
|
||||||
with:
|
with:
|
||||||
token: ${{ steps.app-token.outputs.token }}
|
token: ${{ steps.app-token.outputs.token }}
|
||||||
issue-number: ${{ github.event.issue.number }}
|
issue-number: ${{ github.event.issue.number }}
|
||||||
@@ -160,13 +160,13 @@ jobs:
|
|||||||
- uses: actions/create-github-app-token@v3
|
- uses: actions/create-github-app-token@v3
|
||||||
id: app-token
|
id: app-token
|
||||||
with:
|
with:
|
||||||
app-id: ${{ vars.APP_ID }}
|
client-id: ${{ vars.GITHUB_APP_CLIENT_ID }}
|
||||||
private-key: ${{ secrets.PRIVATE_KEY }}
|
private-key: ${{ secrets.GITHUB_APP_PRIVATE_KEY }}
|
||||||
owner: ${{ github.repository_owner }}
|
owner: ${{ github.repository_owner }}
|
||||||
repositories: |
|
repositories: |
|
||||||
repo1
|
repo1
|
||||||
repo2
|
repo2
|
||||||
- uses: peter-evans/create-or-update-comment@v3
|
- uses: peter-evans/create-or-update-comment@v4
|
||||||
with:
|
with:
|
||||||
token: ${{ steps.app-token.outputs.token }}
|
token: ${{ steps.app-token.outputs.token }}
|
||||||
issue-number: ${{ github.event.issue.number }}
|
issue-number: ${{ github.event.issue.number }}
|
||||||
@@ -185,10 +185,10 @@ jobs:
|
|||||||
- uses: actions/create-github-app-token@v3
|
- uses: actions/create-github-app-token@v3
|
||||||
id: app-token
|
id: app-token
|
||||||
with:
|
with:
|
||||||
app-id: ${{ vars.APP_ID }}
|
client-id: ${{ vars.GITHUB_APP_CLIENT_ID }}
|
||||||
private-key: ${{ secrets.PRIVATE_KEY }}
|
private-key: ${{ secrets.GITHUB_APP_PRIVATE_KEY }}
|
||||||
owner: another-owner
|
owner: another-owner
|
||||||
- uses: peter-evans/create-or-update-comment@v3
|
- uses: peter-evans/create-or-update-comment@v4
|
||||||
with:
|
with:
|
||||||
token: ${{ steps.app-token.outputs.token }}
|
token: ${{ steps.app-token.outputs.token }}
|
||||||
issue-number: ${{ github.event.issue.number }}
|
issue-number: ${{ github.event.issue.number }}
|
||||||
@@ -210,11 +210,11 @@ jobs:
|
|||||||
- uses: actions/create-github-app-token@v3
|
- uses: actions/create-github-app-token@v3
|
||||||
id: app-token
|
id: app-token
|
||||||
with:
|
with:
|
||||||
app-id: ${{ vars.APP_ID }}
|
client-id: ${{ vars.GITHUB_APP_CLIENT_ID }}
|
||||||
private-key: ${{ secrets.PRIVATE_KEY }}
|
private-key: ${{ secrets.GITHUB_APP_PRIVATE_KEY }}
|
||||||
owner: ${{ github.repository_owner }}
|
owner: ${{ github.repository_owner }}
|
||||||
permission-issues: write
|
permission-issues: write
|
||||||
- uses: peter-evans/create-or-update-comment@v3
|
- uses: peter-evans/create-or-update-comment@v4
|
||||||
with:
|
with:
|
||||||
token: ${{ steps.app-token.outputs.token }}
|
token: ${{ steps.app-token.outputs.token }}
|
||||||
issue-number: ${{ github.event.issue.number }}
|
issue-number: ${{ github.event.issue.number }}
|
||||||
@@ -252,8 +252,8 @@ jobs:
|
|||||||
- uses: actions/create-github-app-token@v3
|
- uses: actions/create-github-app-token@v3
|
||||||
id: app-token
|
id: app-token
|
||||||
with:
|
with:
|
||||||
app-id: ${{ vars.APP_ID }}
|
client-id: ${{ vars.GITHUB_APP_CLIENT_ID }}
|
||||||
private-key: ${{ secrets.PRIVATE_KEY }}
|
private-key: ${{ secrets.GITHUB_APP_PRIVATE_KEY }}
|
||||||
owner: ${{ matrix.owners-and-repos.owner }}
|
owner: ${{ matrix.owners-and-repos.owner }}
|
||||||
repositories: ${{ join(matrix.owners-and-repos.repos) }}
|
repositories: ${{ join(matrix.owners-and-repos.repos) }}
|
||||||
- uses: octokit/[email protected]
|
- uses: octokit/[email protected]
|
||||||
@@ -281,7 +281,7 @@ jobs:
|
|||||||
id: create_token
|
id: create_token
|
||||||
uses: actions/create-github-app-token@v3
|
uses: actions/create-github-app-token@v3
|
||||||
with:
|
with:
|
||||||
app-id: ${{ vars.GHES_APP_ID }}
|
client-id: ${{ vars.GHES_APP_CLIENT_ID }}
|
||||||
private-key: ${{ secrets.GHES_APP_PRIVATE_KEY }}
|
private-key: ${{ secrets.GHES_APP_PRIVATE_KEY }}
|
||||||
owner: ${{ vars.GHES_INSTALLATION_ORG }}
|
owner: ${{ vars.GHES_INSTALLATION_ORG }}
|
||||||
github-api-url: ${{ vars.GITHUB_API_URL }}
|
github-api-url: ${{ vars.GITHUB_API_URL }}
|
||||||
@@ -310,15 +310,18 @@ If you set `HTTP_PROXY` or `HTTPS_PROXY`, also set `NODE_USE_ENV_PROXY: "1"` on
|
|||||||
NO_PROXY: github.example.com
|
NO_PROXY: github.example.com
|
||||||
NODE_USE_ENV_PROXY: "1"
|
NODE_USE_ENV_PROXY: "1"
|
||||||
with:
|
with:
|
||||||
app-id: ${{ vars.APP_ID }}
|
client-id: ${{ vars.GITHUB_APP_CLIENT_ID }}
|
||||||
private-key: ${{ secrets.PRIVATE_KEY }}
|
private-key: ${{ secrets.GITHUB_APP_PRIVATE_KEY }}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Inputs
|
## Inputs
|
||||||
|
|
||||||
### `app-id`
|
### `client-id` or `app-id`
|
||||||
|
|
||||||
**Required:** GitHub App ID.
|
**Required:** GitHub App Client ID.
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> The legacy `app-id` input is also accepted, but `client-id` is recommended.
|
||||||
|
|
||||||
### `private-key`
|
### `private-key`
|
||||||
|
|
||||||
@@ -331,14 +334,14 @@ steps:
|
|||||||
- name: Decode the GitHub App Private Key
|
- name: Decode the GitHub App Private Key
|
||||||
id: decode
|
id: decode
|
||||||
run: |
|
run: |
|
||||||
private_key=$(echo "${{ secrets.PRIVATE_KEY }}" | base64 -d | awk 'BEGIN {ORS="\\n"} {print}' | head -c -2) &> /dev/null
|
private_key=$(echo "${{ secrets.GITHUB_APP_PRIVATE_KEY }}" | base64 -d | awk 'BEGIN {ORS="\\n"} {print}' | head -c -2) &> /dev/null
|
||||||
echo "::add-mask::$private_key"
|
echo "::add-mask::$private_key"
|
||||||
echo "private-key=$private_key" >> "$GITHUB_OUTPUT"
|
echo "private-key=$private_key" >> "$GITHUB_OUTPUT"
|
||||||
- name: Generate GitHub App Token
|
- name: Generate GitHub App Token
|
||||||
id: app-token
|
id: app-token
|
||||||
uses: actions/create-github-app-token@v3
|
uses: actions/create-github-app-token@v3
|
||||||
with:
|
with:
|
||||||
app-id: ${{ vars.APP_ID }}
|
client-id: ${{ vars.GITHUB_APP_CLIENT_ID }}
|
||||||
private-key: ${{ steps.decode.outputs.private-key }}
|
private-key: ${{ steps.decode.outputs.private-key }}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
+13
-1
@@ -5,9 +5,13 @@ branding:
|
|||||||
icon: "lock"
|
icon: "lock"
|
||||||
color: "gray-dark"
|
color: "gray-dark"
|
||||||
inputs:
|
inputs:
|
||||||
|
client-id:
|
||||||
|
description: "GitHub App Client ID"
|
||||||
|
required: false
|
||||||
app-id:
|
app-id:
|
||||||
description: "GitHub App ID"
|
description: "GitHub App ID"
|
||||||
required: true
|
required: false
|
||||||
|
deprecationMessage: "Use 'client-id' instead."
|
||||||
private-key:
|
private-key:
|
||||||
description: "GitHub App private key"
|
description: "GitHub App private key"
|
||||||
required: true
|
required: true
|
||||||
@@ -31,6 +35,10 @@ inputs:
|
|||||||
description: "The level of permission to grant the access token for GitHub Actions workflows, workflow runs, and artifacts. Can be set to 'read' or 'write'."
|
description: "The level of permission to grant the access token for GitHub Actions workflows, workflow runs, and artifacts. Can be set to 'read' or 'write'."
|
||||||
permission-administration:
|
permission-administration:
|
||||||
description: "The level of permission to grant the access token for repository creation, deletion, settings, teams, and collaborators creation. Can be set to 'read' or 'write'."
|
description: "The level of permission to grant the access token for repository creation, deletion, settings, teams, and collaborators creation. Can be set to 'read' or 'write'."
|
||||||
|
permission-artifact-metadata:
|
||||||
|
description: "The level of permission to grant the access token to create and retrieve build artifact metadata records. Can be set to 'read' or 'write'."
|
||||||
|
permission-attestations:
|
||||||
|
description: "The level of permission to create and retrieve the access token for repository attestations. Can be set to 'read' or 'write'."
|
||||||
permission-checks:
|
permission-checks:
|
||||||
description: "The level of permission to grant the access token for checks on code. Can be set to 'read' or 'write'."
|
description: "The level of permission to grant the access token for checks on code. Can be set to 'read' or 'write'."
|
||||||
permission-codespaces:
|
permission-codespaces:
|
||||||
@@ -43,6 +51,8 @@ inputs:
|
|||||||
description: "The level of permission to grant the access token to manage Dependabot secrets. Can be set to 'read' or 'write'."
|
description: "The level of permission to grant the access token to manage Dependabot secrets. Can be set to 'read' or 'write'."
|
||||||
permission-deployments:
|
permission-deployments:
|
||||||
description: "The level of permission to grant the access token for deployments and deployment statuses. Can be set to 'read' or 'write'."
|
description: "The level of permission to grant the access token for deployments and deployment statuses. Can be set to 'read' or 'write'."
|
||||||
|
permission-discussions:
|
||||||
|
description: "The level of permission to grant the access token for discussions and related comments and labels. Can be set to 'read' or 'write'."
|
||||||
permission-email-addresses:
|
permission-email-addresses:
|
||||||
description: "The level of permission to grant the access token to manage the email addresses belonging to a user. Can be set to 'read' or 'write'."
|
description: "The level of permission to grant the access token to manage the email addresses belonging to a user. Can be set to 'read' or 'write'."
|
||||||
permission-enterprise-custom-properties-for-organizations:
|
permission-enterprise-custom-properties-for-organizations:
|
||||||
@@ -61,6 +71,8 @@ inputs:
|
|||||||
description: "The level of permission to grant the access token for issues and related comments, assignees, labels, and milestones. Can be set to 'read' or 'write'."
|
description: "The level of permission to grant the access token for issues and related comments, assignees, labels, and milestones. Can be set to 'read' or 'write'."
|
||||||
permission-members:
|
permission-members:
|
||||||
description: "The level of permission to grant the access token for organization teams and members. Can be set to 'read' or 'write'."
|
description: "The level of permission to grant the access token for organization teams and members. Can be set to 'read' or 'write'."
|
||||||
|
permission-merge-queues:
|
||||||
|
description: "The level of permission to grant the access token to manage the merge queues for a repository. Can be set to 'read' or 'write'."
|
||||||
permission-metadata:
|
permission-metadata:
|
||||||
description: "The level of permission to grant the access token to search repositories, list collaborators, and access repository metadata. Can be set to 'read' or 'write'."
|
description: "The level of permission to grant the access token to search repositories, list collaborators, and access repository metadata. Can be set to 'read' or 'write'."
|
||||||
permission-organization-administration:
|
permission-organization-administration:
|
||||||
|
|||||||
Vendored
+12006
-10874
File diff suppressed because one or more lines are too long
Vendored
+11874
-10789
File diff suppressed because one or more lines are too long
+3
-3
@@ -2,7 +2,7 @@ import pRetry from "p-retry";
|
|||||||
// @ts-check
|
// @ts-check
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} appId
|
* @param {string} clientId
|
||||||
* @param {string} privateKey
|
* @param {string} privateKey
|
||||||
* @param {string} owner
|
* @param {string} owner
|
||||||
* @param {string[]} repositories
|
* @param {string[]} repositories
|
||||||
@@ -13,7 +13,7 @@ import pRetry from "p-retry";
|
|||||||
* @param {boolean} skipTokenRevoke
|
* @param {boolean} skipTokenRevoke
|
||||||
*/
|
*/
|
||||||
export async function main(
|
export async function main(
|
||||||
appId,
|
clientId,
|
||||||
privateKey,
|
privateKey,
|
||||||
owner,
|
owner,
|
||||||
repositories,
|
repositories,
|
||||||
@@ -70,7 +70,7 @@ export async function main(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const auth = createAppAuth({
|
const auth = createAppAuth({
|
||||||
appId,
|
appId: clientId,
|
||||||
privateKey,
|
privateKey,
|
||||||
request,
|
request,
|
||||||
});
|
});
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import core from "@actions/core";
|
import * as core from "@actions/core";
|
||||||
import { request } from "@octokit/request";
|
import { request } from "@octokit/request";
|
||||||
|
|
||||||
// Get the GitHub API URL from the action input and remove any trailing slash
|
// Get the GitHub API URL from the action input and remove any trailing slash
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// @ts-check
|
// @ts-check
|
||||||
|
|
||||||
import core from "@actions/core";
|
import * as core from "@actions/core";
|
||||||
import { createAppAuth } from "@octokit/auth-app";
|
import { createAppAuth } from "@octokit/auth-app";
|
||||||
|
|
||||||
import { getPermissionsFromInputs } from "./lib/get-permissions-from-inputs.js";
|
import { getPermissionsFromInputs } from "./lib/get-permissions-from-inputs.js";
|
||||||
@@ -18,7 +18,10 @@ if (!process.env.GITHUB_REPOSITORY_OWNER) {
|
|||||||
async function run() {
|
async function run() {
|
||||||
ensureNativeProxySupport();
|
ensureNativeProxySupport();
|
||||||
|
|
||||||
const appId = core.getInput("app-id");
|
const clientId = core.getInput("client-id") || core.getInput("app-id");
|
||||||
|
if (!clientId) {
|
||||||
|
throw new Error("Either 'client-id' or 'app-id' input must be set");
|
||||||
|
}
|
||||||
const privateKey = core.getInput("private-key");
|
const privateKey = core.getInput("private-key");
|
||||||
const owner = core.getInput("owner");
|
const owner = core.getInput("owner");
|
||||||
const repositories = core
|
const repositories = core
|
||||||
@@ -32,7 +35,7 @@ async function run() {
|
|||||||
const permissions = getPermissionsFromInputs(process.env);
|
const permissions = getPermissionsFromInputs(process.env);
|
||||||
|
|
||||||
return main(
|
return main(
|
||||||
appId,
|
clientId,
|
||||||
privateKey,
|
privateKey,
|
||||||
owner,
|
owner,
|
||||||
repositories,
|
repositories,
|
||||||
|
|||||||
Generated
+318
-573
File diff suppressed because it is too large
Load Diff
+12
-12
@@ -2,7 +2,7 @@
|
|||||||
"name": "create-github-app-token",
|
"name": "create-github-app-token",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "3.0.0-beta.5",
|
"version": "3.1.0",
|
||||||
"description": "GitHub Action for creating a GitHub App Installation Access Token",
|
"description": "GitHub Action for creating a GitHub App Installation Access Token",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=24.4.0"
|
"node": ">=24.4.0"
|
||||||
@@ -16,19 +16,18 @@
|
|||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.11.1",
|
"@actions/core": "^3.0.0",
|
||||||
"@octokit/auth-app": "^8.1.2",
|
"@octokit/auth-app": "^8.2.0",
|
||||||
"@octokit/request": "^10.0.3",
|
"@octokit/request": "^10.0.8",
|
||||||
"p-retry": "^7.1.0",
|
"p-retry": "^8.0.0"
|
||||||
"undici": "^7.16.0"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@octokit/openapi": "^21.0.0",
|
"@octokit/openapi": "^22.0.0",
|
||||||
"c8": "^10.1.3",
|
"c8": "^11.0.0",
|
||||||
"dotenv": "^17.3.1",
|
"esbuild": "^0.27.4",
|
||||||
"esbuild": "^0.27.3",
|
"open-cli": "^9.0.0",
|
||||||
"open-cli": "^8.0.0",
|
"undici": "^7.24.6",
|
||||||
"yaml": "^2.8.2"
|
"yaml": "^2.8.3"
|
||||||
},
|
},
|
||||||
"release": {
|
"release": {
|
||||||
"branches": [
|
"branches": [
|
||||||
@@ -44,6 +43,7 @@
|
|||||||
"@semantic-release/release-notes-generator",
|
"@semantic-release/release-notes-generator",
|
||||||
"@semantic-release/github",
|
"@semantic-release/github",
|
||||||
"@semantic-release/npm",
|
"@semantic-release/npm",
|
||||||
|
"semantic-release-plugin-github-breaking-version-tag",
|
||||||
[
|
[
|
||||||
"@semantic-release/git",
|
"@semantic-release/git",
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
// @ts-check
|
// @ts-check
|
||||||
|
|
||||||
import core from "@actions/core";
|
import * as core from "@actions/core";
|
||||||
|
|
||||||
import { post } from "./lib/post.js";
|
import { post } from "./lib/post.js";
|
||||||
import request, { ensureNativeProxySupport } from "./lib/request.js";
|
import request, { ensureNativeProxySupport } from "./lib/request.js";
|
||||||
|
|||||||
@@ -19,6 +19,22 @@
|
|||||||
"write"
|
"write"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"artifact_metadata": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The level of permission to grant the access token to create and retrieve build artifact metadata records.",
|
||||||
|
"enum": [
|
||||||
|
"read",
|
||||||
|
"write"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"attestations": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The level of permission to create and retrieve the access token for repository attestations.",
|
||||||
|
"enum": [
|
||||||
|
"read",
|
||||||
|
"write"
|
||||||
|
]
|
||||||
|
},
|
||||||
"checks": {
|
"checks": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "The level of permission to grant the access token for checks on code.",
|
"description": "The level of permission to grant the access token for checks on code.",
|
||||||
@@ -59,6 +75,14 @@
|
|||||||
"write"
|
"write"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"discussions": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The level of permission to grant the access token for discussions and related comments and labels.",
|
||||||
|
"enum": [
|
||||||
|
"read",
|
||||||
|
"write"
|
||||||
|
]
|
||||||
|
},
|
||||||
"environments": {
|
"environments": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "The level of permission to grant the access token for managing repository environments.",
|
"description": "The level of permission to grant the access token for managing repository environments.",
|
||||||
@@ -75,6 +99,14 @@
|
|||||||
"write"
|
"write"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"merge_queues": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "The level of permission to grant the access token to manage the merge queues for a repository.",
|
||||||
|
"enum": [
|
||||||
|
"read",
|
||||||
|
"write"
|
||||||
|
]
|
||||||
|
},
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "The level of permission to grant the access token to search repositories, list collaborators, and access repository metadata.",
|
"description": "The level of permission to grant the access token to search repositories, list collaborators, and access repository metadata.",
|
||||||
|
|||||||
+2
-2
@@ -32,5 +32,5 @@ node --test --test-update-snapshots tests/index.js
|
|||||||
|
|
||||||
We have tests both for the `main.js` and `post.js` scripts.
|
We have tests both for the `main.js` and `post.js` scripts.
|
||||||
|
|
||||||
- If you do not expect an error, take [main-token-permissions-set.test.js](tests/main-token-permissions-set.test.js) as a starting point.
|
- If you do not expect an error, take [main-token-permissions-set.test.js](main-token-permissions-set.test.js) as a starting point.
|
||||||
- If your test has an expected error, take [main-missing-app-id.test.js](tests/main-missing-app-id.test.js) as a starting point.
|
- If your test has an expected error, take [main-missing-client-and-app-id.test.js](main-missing-client-and-app-id.test.js) as a starting point.
|
||||||
|
|||||||
@@ -1,3 +1,41 @@
|
|||||||
|
exports[`action-deprecated-inputs.test.js > stdout 1`] = `
|
||||||
|
app-id — Use 'client-id' instead.
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`main-app-id-fallback.test.js > stdout 1`] = `
|
||||||
|
Inputs 'owner' and 'repositories' are not set. Creating token for this repository (actions/create-github-app-token).
|
||||||
|
::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a
|
||||||
|
|
||||||
|
::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a
|
||||||
|
|
||||||
|
::set-output name=installation-id::123456
|
||||||
|
|
||||||
|
::set-output name=app-slug::github-actions
|
||||||
|
::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a
|
||||||
|
::save-state name=expiresAt::2016-07-11T22:14:10Z
|
||||||
|
--- REQUESTS ---
|
||||||
|
GET /repos/actions/create-github-app-token/installation
|
||||||
|
POST /app/installations/123456/access_tokens
|
||||||
|
{"repositories":["create-github-app-token"]}
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`main-client-id-precedence.test.js > stdout 1`] = `
|
||||||
|
Inputs 'owner' and 'repositories' are not set. Creating token for this repository (actions/create-github-app-token).
|
||||||
|
::add-mask::ghs_16C7e42F292c6912E7710c838347Ae178B4a
|
||||||
|
|
||||||
|
::set-output name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a
|
||||||
|
|
||||||
|
::set-output name=installation-id::123456
|
||||||
|
|
||||||
|
::set-output name=app-slug::github-actions
|
||||||
|
::save-state name=token::ghs_16C7e42F292c6912E7710c838347Ae178B4a
|
||||||
|
::save-state name=expiresAt::2016-07-11T22:14:10Z
|
||||||
|
--- REQUESTS ---
|
||||||
|
GET /repos/actions/create-github-app-token/installation
|
||||||
|
POST /app/installations/123456/access_tokens
|
||||||
|
{"repositories":["create-github-app-token"]}
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`main-custom-github-api-url.test.js > stdout 1`] = `
|
exports[`main-custom-github-api-url.test.js > stdout 1`] = `
|
||||||
Inputs 'owner' and 'repositories' are set. Creating token for the following repositories:
|
Inputs 'owner' and 'repositories' are set. Creating token for the following repositories:
|
||||||
|
|
||||||
@@ -17,6 +55,14 @@ POST /api/v3/app/installations/123456/access_tokens
|
|||||||
{"repositories":["create-github-app-token"]}
|
{"repositories":["create-github-app-token"]}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
exports[`main-missing-client-and-app-id.test.js > stderr 1`] = `
|
||||||
|
Either 'client-id' or 'app-id' input must be set
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`main-missing-client-and-app-id.test.js > stdout 1`] = `
|
||||||
|
::error::Either 'client-id' or 'app-id' input must be set
|
||||||
|
`;
|
||||||
|
|
||||||
exports[`main-missing-owner.test.js > stderr 1`] = `
|
exports[`main-missing-owner.test.js > stderr 1`] = `
|
||||||
GITHUB_REPOSITORY_OWNER missing, must be set to '<owner>'
|
GITHUB_REPOSITORY_OWNER missing, must be set to '<owner>'
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import { DEFAULT_ENV, test } from "./main.js";
|
||||||
|
|
||||||
|
// Verify `main` falls back to `app-id` when `client-id` is not set
|
||||||
|
await test(
|
||||||
|
() => {},
|
||||||
|
{
|
||||||
|
...DEFAULT_ENV,
|
||||||
|
"INPUT_CLIENT-ID": "",
|
||||||
|
"INPUT_APP-ID": "123456",
|
||||||
|
}
|
||||||
|
);
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import { DEFAULT_ENV, test } from "./main.js";
|
||||||
|
|
||||||
|
// Verify `client-id` takes precedence when both `client-id` and `app-id` are set
|
||||||
|
await test(
|
||||||
|
() => {},
|
||||||
|
{
|
||||||
|
...DEFAULT_ENV,
|
||||||
|
"INPUT_CLIENT-ID": "Iv1.0123456789abcdef",
|
||||||
|
"INPUT_APP-ID": "123456",
|
||||||
|
}
|
||||||
|
);
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import { DEFAULT_ENV } from "./main.js";
|
||||||
|
|
||||||
|
for (const [key, value] of Object.entries({
|
||||||
|
...DEFAULT_ENV,
|
||||||
|
"INPUT_CLIENT-ID": "",
|
||||||
|
"INPUT_APP-ID": "",
|
||||||
|
})) {
|
||||||
|
process.env[key] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Log only the error message, not the full stack trace, because the stack
|
||||||
|
// trace contains environment-specific paths and ANSI codes that differ
|
||||||
|
// between local and CI environments.
|
||||||
|
const _error = console.error;
|
||||||
|
console.error = (err) => _error(err?.message ?? err);
|
||||||
|
|
||||||
|
// Verify `main` exits with an error when neither `client-id` nor `app-id` is set.
|
||||||
|
const { default: promise } = await import("../main.js");
|
||||||
|
await promise;
|
||||||
|
process.exitCode = 0;
|
||||||
+1
-1
@@ -9,7 +9,7 @@ export const DEFAULT_ENV = {
|
|||||||
// https://docs.github.com/actions/creating-actions/metadata-syntax-for-github-actions#example-specifying-inputs
|
// https://docs.github.com/actions/creating-actions/metadata-syntax-for-github-actions#example-specifying-inputs
|
||||||
"INPUT_GITHUB-API-URL": "https://api.github.com",
|
"INPUT_GITHUB-API-URL": "https://api.github.com",
|
||||||
"INPUT_SKIP-TOKEN-REVOKE": "false",
|
"INPUT_SKIP-TOKEN-REVOKE": "false",
|
||||||
"INPUT_APP-ID": "123456",
|
"INPUT_CLIENT-ID": "Iv1.0123456789abcdef",
|
||||||
// This key is invalidated. It’s from https://github.com/octokit/auth-app.js/issues/465#issuecomment-1564998327.
|
// This key is invalidated. It’s from https://github.com/octokit/auth-app.js/issues/465#issuecomment-1564998327.
|
||||||
"INPUT_PRIVATE-KEY": `-----BEGIN RSA PRIVATE KEY-----
|
"INPUT_PRIVATE-KEY": `-----BEGIN RSA PRIVATE KEY-----
|
||||||
MIIEowIBAAKCAQEA280nfuUM9w00Ib9E2rvZJ6Qu3Ua3IqR34ZlK53vn/Iobn2EL
|
MIIEowIBAAKCAQEA280nfuUM9w00Ib9E2rvZJ6Qu3Ua3IqR34ZlK53vn/Iobn2EL
|
||||||
|
|||||||
Reference in New Issue
Block a user