Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e715b04a11 |
@@ -0,0 +1,17 @@
|
|||||||
|
name: 'Publish Immutable Action'
|
||||||
|
|
||||||
|
on:
|
||||||
|
release:
|
||||||
|
types: [published]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
id-token: write
|
||||||
|
packages: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v6
|
||||||
|
- name: Publish Immutable Action
|
||||||
|
uses: actions/[email protected]
|
||||||
@@ -26,6 +26,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
node-version-file: package.json
|
node-version-file: package.json
|
||||||
|
|
||||||
|
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm run build
|
- run: npm run build
|
||||||
- uses: ./
|
- uses: ./
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
- beta
|
|
||||||
pull_request:
|
pull_request:
|
||||||
merge_group:
|
merge_group:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
@@ -34,7 +33,7 @@ jobs:
|
|||||||
name: end-to-end
|
name: end-to-end
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
# 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 == 'merge_group' || github.event.pull_request.head.repo.owner.login == github.event.pull_request.base.repo.owner.login
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v6
|
||||||
- uses: actions/setup-node@v6
|
- uses: actions/setup-node@v6
|
||||||
@@ -54,28 +53,3 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
route: GET /installation/repositories
|
route: GET /installation/repositories
|
||||||
- run: echo '${{ steps.get-repository.outputs.data }}'
|
- run: echo '${{ steps.get-repository.outputs.data }}'
|
||||||
|
|
||||||
end-to-end-proxy:
|
|
||||||
name: end-to-end with unreachable proxy
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
# 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
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v6
|
|
||||||
- uses: actions/setup-node@v6
|
|
||||||
with:
|
|
||||||
node-version-file: package.json
|
|
||||||
cache: 'npm'
|
|
||||||
- run: npm ci
|
|
||||||
- run: npm run build
|
|
||||||
- uses: ./ # Uses the action in the root directory
|
|
||||||
continue-on-error: true
|
|
||||||
id: test
|
|
||||||
env:
|
|
||||||
NODE_USE_ENV_PROXY: "1"
|
|
||||||
https_proxy: http://127.0.0.1:9
|
|
||||||
with:
|
|
||||||
app-id: ${{ vars.TEST_APP_ID }}
|
|
||||||
private-key: ${{ secrets.TEST_APP_PRIVATE_KEY }}
|
|
||||||
- name: Assert action failed through unreachable proxy
|
|
||||||
run: test "${{ steps.test.outcome }}" = "failure"
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ jobs:
|
|||||||
run: node scripts/update-permission-inputs.js
|
run: node scripts/update-permission-inputs.js
|
||||||
- name: Commit changes
|
- name: Commit changes
|
||||||
id: auto-commit
|
id: auto-commit
|
||||||
uses: stefanzweifel/git-auto-commit-action@04702edda442b2e678b25b537cec683a1493fcb9 # v7.1.0
|
uses: stefanzweifel/git-auto-commit-action@778341af668090896ca464160c2def5d1d1a3eb0 # v6.0.1
|
||||||
with:
|
with:
|
||||||
commit_message: ${{ env.COMMIT_MESSAGE }}
|
commit_message: ${{ env.COMMIT_MESSAGE }}
|
||||||
- name: Update PR title
|
- name: Update PR title
|
||||||
|
|||||||
@@ -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 Client ID in your repository variables](https://docs.github.com/actions/how-tos/write-workflows/choose-what-workflows-do/use-variables#defining-configuration-variables-for-multiple-workflows) (example: `APP_CLIENT_ID`).
|
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`).
|
||||||
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: `APP_PRIVATE_KEY`).
|
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`).
|
||||||
|
|
||||||
> [!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.
|
||||||
@@ -28,11 +28,11 @@ jobs:
|
|||||||
hello-world:
|
hello-world:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/create-github-app-token@v3
|
- uses: actions/create-github-app-token@v2
|
||||||
id: app-token
|
id: app-token
|
||||||
with:
|
with:
|
||||||
client-id: ${{ vars.APP_CLIENT_ID }}
|
app-id: ${{ vars.APP_ID }}
|
||||||
private-key: ${{ secrets.APP_PRIVATE_KEY }}
|
private-key: ${{ secrets.PRIVATE_KEY }}
|
||||||
- uses: ./actions/staging-tests
|
- uses: ./actions/staging-tests
|
||||||
with:
|
with:
|
||||||
token: ${{ steps.app-token.outputs.token }}
|
token: ${{ steps.app-token.outputs.token }}
|
||||||
@@ -47,19 +47,19 @@ jobs:
|
|||||||
auto-format:
|
auto-format:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/create-github-app-token@v3
|
- uses: actions/create-github-app-token@v2
|
||||||
id: app-token
|
id: app-token
|
||||||
with:
|
with:
|
||||||
# required
|
# required
|
||||||
client-id: ${{ vars.APP_CLIENT_ID }}
|
app-id: ${{ vars.APP_ID }}
|
||||||
private-key: ${{ secrets.APP_PRIVATE_KEY }}
|
private-key: ${{ secrets.PRIVATE_KEY }}
|
||||||
- uses: actions/checkout@v6
|
- uses: actions/checkout@v4
|
||||||
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@v6
|
- uses: creyD/prettier_action@v4.3
|
||||||
with:
|
with:
|
||||||
github_token: ${{ steps.app-token.outputs.token }}
|
github_token: ${{ steps.app-token.outputs.token }}
|
||||||
```
|
```
|
||||||
@@ -73,12 +73,12 @@ jobs:
|
|||||||
auto-format:
|
auto-format:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/create-github-app-token@v3
|
- uses: actions/create-github-app-token@v2
|
||||||
id: app-token
|
id: app-token
|
||||||
with:
|
with:
|
||||||
# required
|
# required
|
||||||
client-id: ${{ vars.APP_CLIENT_ID }}
|
app-id: ${{ vars.APP_ID }}
|
||||||
private-key: ${{ secrets.APP_PRIVATE_KEY }}
|
private-key: ${{ secrets.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"
|
||||||
@@ -98,12 +98,12 @@ jobs:
|
|||||||
auto-format:
|
auto-format:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/create-github-app-token@v3
|
- uses: actions/create-github-app-token@v2
|
||||||
id: app-token
|
id: app-token
|
||||||
with:
|
with:
|
||||||
# required
|
# required
|
||||||
client-id: ${{ vars.APP_CLIENT_ID }}
|
app-id: ${{ vars.APP_ID }}
|
||||||
private-key: ${{ secrets.APP_PRIVATE_KEY }}
|
private-key: ${{ secrets.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"
|
||||||
@@ -135,13 +135,13 @@ jobs:
|
|||||||
hello-world:
|
hello-world:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/create-github-app-token@v3
|
- uses: actions/create-github-app-token@v2
|
||||||
id: app-token
|
id: app-token
|
||||||
with:
|
with:
|
||||||
client-id: ${{ vars.APP_CLIENT_ID }}
|
app-id: ${{ vars.APP_ID }}
|
||||||
private-key: ${{ secrets.APP_PRIVATE_KEY }}
|
private-key: ${{ secrets.PRIVATE_KEY }}
|
||||||
owner: ${{ github.repository_owner }}
|
owner: ${{ github.repository_owner }}
|
||||||
- uses: peter-evans/create-or-update-comment@v4
|
- uses: peter-evans/create-or-update-comment@v3
|
||||||
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 }}
|
||||||
@@ -157,16 +157,16 @@ jobs:
|
|||||||
hello-world:
|
hello-world:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/create-github-app-token@v3
|
- uses: actions/create-github-app-token@v2
|
||||||
id: app-token
|
id: app-token
|
||||||
with:
|
with:
|
||||||
client-id: ${{ vars.APP_CLIENT_ID }}
|
app-id: ${{ vars.APP_ID }}
|
||||||
private-key: ${{ secrets.APP_PRIVATE_KEY }}
|
private-key: ${{ secrets.PRIVATE_KEY }}
|
||||||
owner: ${{ github.repository_owner }}
|
owner: ${{ github.repository_owner }}
|
||||||
repositories: |
|
repositories: |
|
||||||
repo1
|
repo1
|
||||||
repo2
|
repo2
|
||||||
- uses: peter-evans/create-or-update-comment@v4
|
- uses: peter-evans/create-or-update-comment@v3
|
||||||
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 }}
|
||||||
@@ -182,13 +182,13 @@ jobs:
|
|||||||
hello-world:
|
hello-world:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/create-github-app-token@v3
|
- uses: actions/create-github-app-token@v2
|
||||||
id: app-token
|
id: app-token
|
||||||
with:
|
with:
|
||||||
client-id: ${{ vars.APP_CLIENT_ID }}
|
app-id: ${{ vars.APP_ID }}
|
||||||
private-key: ${{ secrets.APP_PRIVATE_KEY }}
|
private-key: ${{ secrets.PRIVATE_KEY }}
|
||||||
owner: another-owner
|
owner: another-owner
|
||||||
- uses: peter-evans/create-or-update-comment@v4
|
- uses: peter-evans/create-or-update-comment@v3
|
||||||
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 }}
|
||||||
@@ -207,14 +207,14 @@ jobs:
|
|||||||
hello-world:
|
hello-world:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/create-github-app-token@v3
|
- uses: actions/create-github-app-token@v2
|
||||||
id: app-token
|
id: app-token
|
||||||
with:
|
with:
|
||||||
client-id: ${{ vars.APP_CLIENT_ID }}
|
app-id: ${{ vars.APP_ID }}
|
||||||
private-key: ${{ secrets.APP_PRIVATE_KEY }}
|
private-key: ${{ secrets.PRIVATE_KEY }}
|
||||||
owner: ${{ github.repository_owner }}
|
owner: ${{ github.repository_owner }}
|
||||||
permission-issues: write
|
permission-issues: write
|
||||||
- uses: peter-evans/create-or-update-comment@v4
|
- uses: peter-evans/create-or-update-comment@v3
|
||||||
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 }}
|
||||||
@@ -249,11 +249,11 @@ jobs:
|
|||||||
owners-and-repos: ${{ fromJson(needs.set-matrix.outputs.matrix) }}
|
owners-and-repos: ${{ fromJson(needs.set-matrix.outputs.matrix) }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/create-github-app-token@v3
|
- uses: actions/create-github-app-token@v2
|
||||||
id: app-token
|
id: app-token
|
||||||
with:
|
with:
|
||||||
client-id: ${{ vars.APP_CLIENT_ID }}
|
app-id: ${{ vars.APP_ID }}
|
||||||
private-key: ${{ secrets.APP_PRIVATE_KEY }}
|
private-key: ${{ secrets.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]
|
||||||
@@ -279,9 +279,9 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Create GitHub App token
|
- name: Create GitHub App token
|
||||||
id: create_token
|
id: create_token
|
||||||
uses: actions/create-github-app-token@v3
|
uses: actions/create-github-app-token@v2
|
||||||
with:
|
with:
|
||||||
client-id: ${{ vars.GHES_APP_CLIENT_ID }}
|
app-id: ${{ vars.GHES_APP_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 }}
|
||||||
@@ -296,32 +296,11 @@ jobs:
|
|||||||
GITHUB_TOKEN: ${{ steps.create_token.outputs.token }}
|
GITHUB_TOKEN: ${{ steps.create_token.outputs.token }}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Proxy support
|
|
||||||
|
|
||||||
This action relies on Node.js native proxy support.
|
|
||||||
|
|
||||||
If you set `HTTP_PROXY` or `HTTPS_PROXY`, also set `NODE_USE_ENV_PROXY: "1"` on the action step so Node.js honors those variables. If you need proxy bypass rules, set `NO_PROXY` alongside them.
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
- uses: actions/create-github-app-token@v3
|
|
||||||
id: app-token
|
|
||||||
env:
|
|
||||||
HTTPS_PROXY: http://proxy.example.com:8080
|
|
||||||
NO_PROXY: github.example.com
|
|
||||||
NODE_USE_ENV_PROXY: "1"
|
|
||||||
with:
|
|
||||||
client-id: ${{ vars.APP_CLIENT_ID }}
|
|
||||||
private-key: ${{ secrets.APP_PRIVATE_KEY }}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Inputs
|
## Inputs
|
||||||
|
|
||||||
### `client-id` or `app-id`
|
### `app-id`
|
||||||
|
|
||||||
**Required:** GitHub App Client ID.
|
**Required:** GitHub App ID.
|
||||||
|
|
||||||
> [!NOTE]
|
|
||||||
> The legacy `app-id` input is also accepted, but `client-id` is recommended.
|
|
||||||
|
|
||||||
### `private-key`
|
### `private-key`
|
||||||
|
|
||||||
@@ -334,14 +313,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.APP_PRIVATE_KEY }}" | base64 -d | awk 'BEGIN {ORS="\\n"} {print}' | head -c -2) &> /dev/null
|
private_key=$(echo "${{ secrets.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@v2
|
||||||
with:
|
with:
|
||||||
client-id: ${{ vars.APP_CLIENT_ID }}
|
app-id: ${{ vars.APP_ID }}
|
||||||
private-key: ${{ steps.decode.outputs.private-key }}
|
private-key: ${{ steps.decode.outputs.private-key }}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
+2
-14
@@ -5,13 +5,9 @@ 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: false
|
required: true
|
||||||
deprecationMessage: "Use 'client-id' instead."
|
|
||||||
private-key:
|
private-key:
|
||||||
description: "GitHub App private key"
|
description: "GitHub App private key"
|
||||||
required: true
|
required: true
|
||||||
@@ -35,10 +31,6 @@ 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:
|
||||||
@@ -51,8 +43,6 @@ 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:
|
||||||
@@ -71,8 +61,6 @@ 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:
|
||||||
@@ -148,6 +136,6 @@ outputs:
|
|||||||
app-slug:
|
app-slug:
|
||||||
description: "GitHub App slug"
|
description: "GitHub App slug"
|
||||||
runs:
|
runs:
|
||||||
using: "node24"
|
using: "node20"
|
||||||
main: "dist/main.cjs"
|
main: "dist/main.cjs"
|
||||||
post: "dist/post.cjs"
|
post: "dist/post.cjs"
|
||||||
|
|||||||
Vendored
+32808
-11566
File diff suppressed because one or more lines are too long
Vendored
+32714
-11412
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} clientId
|
* @param {string} appId
|
||||||
* @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(
|
||||||
clientId,
|
appId,
|
||||||
privateKey,
|
privateKey,
|
||||||
owner,
|
owner,
|
||||||
repositories,
|
repositories,
|
||||||
@@ -70,7 +70,7 @@ export async function main(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const auth = createAppAuth({
|
const auth = createAppAuth({
|
||||||
appId: clientId,
|
appId,
|
||||||
privateKey,
|
privateKey,
|
||||||
request,
|
request,
|
||||||
});
|
});
|
||||||
|
|||||||
+30
-25
@@ -1,36 +1,41 @@
|
|||||||
import * as core from "@actions/core";
|
import core from "@actions/core";
|
||||||
import { request } from "@octokit/request";
|
import { request } from "@octokit/request";
|
||||||
|
import { ProxyAgent, fetch as undiciFetch } from "undici";
|
||||||
|
|
||||||
// Get the GitHub API URL from the action input and remove any trailing slash
|
|
||||||
const baseUrl = core.getInput("github-api-url").replace(/\/$/, "");
|
const baseUrl = core.getInput("github-api-url").replace(/\/$/, "");
|
||||||
|
|
||||||
const proxyEnvironmentKeys = [
|
// https://docs.github.com/actions/hosting-your-own-runners/managing-self-hosted-runners/using-a-proxy-server-with-self-hosted-runners
|
||||||
"https_proxy",
|
const proxyUrl =
|
||||||
"HTTPS_PROXY",
|
process.env.https_proxy ||
|
||||||
"http_proxy",
|
process.env.HTTPS_PROXY ||
|
||||||
"HTTP_PROXY",
|
process.env.http_proxy ||
|
||||||
];
|
process.env.HTTP_PROXY;
|
||||||
|
|
||||||
function proxyEnvironmentConfigured() {
|
/* c8 ignore start */
|
||||||
return proxyEnvironmentKeys.some((key) => process.env[key]);
|
// Native support for proxies in Undici is under consideration: https://github.com/nodejs/undici/issues/1650
|
||||||
}
|
// Until then, we need to use a custom fetch function to add proxy support.
|
||||||
|
const proxyFetch = (url, options) => {
|
||||||
function nativeProxySupportEnabled() {
|
const urlHost = new URL(url).hostname;
|
||||||
return process.env.NODE_USE_ENV_PROXY === "1";
|
const noProxy = (process.env.no_proxy || process.env.NO_PROXY || "").split(
|
||||||
}
|
",",
|
||||||
|
|
||||||
export function ensureNativeProxySupport() {
|
|
||||||
if (!proxyEnvironmentConfigured() || nativeProxySupportEnabled()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new Error(
|
|
||||||
"A proxy environment variable is set, but Node.js native proxy support is not enabled. Set NODE_USE_ENV_PROXY=1 for this action step.",
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (!noProxy.includes(urlHost)) {
|
||||||
|
options = {
|
||||||
|
...options,
|
||||||
|
dispatcher: new ProxyAgent(String(proxyUrl)),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Configure the default settings for GitHub API requests
|
return undiciFetch(url, options);
|
||||||
|
};
|
||||||
|
/* c8 ignore stop */
|
||||||
|
|
||||||
export default request.defaults({
|
export default request.defaults({
|
||||||
headers: { "user-agent": "actions/create-github-app-token" },
|
headers: {
|
||||||
|
"user-agent": "actions/create-github-app-token",
|
||||||
|
},
|
||||||
baseUrl,
|
baseUrl,
|
||||||
|
/* c8 ignore next */
|
||||||
|
request: proxyUrl ? { fetch: proxyFetch } : {},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
// @ts-check
|
||||||
|
|
||||||
|
import { spawn } from "node:child_process";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wraps a function to automatically enable Node.js proxy support when proxy
|
||||||
|
* environment variables are detected. If proxy env vars are set but
|
||||||
|
* `NODE_USE_ENV_PROXY` is not `"1"`, spawns a child process with
|
||||||
|
* `NODE_USE_ENV_PROXY=1` to enable native proxy support.
|
||||||
|
*
|
||||||
|
* @param {() => Promise<void>} run
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*
|
||||||
|
* @see https://github.com/nodejs/node/blob/4612c793cb9007a91cb3fd82afe518440473826e/lib/internal/process/pre_execution.js#L168-L187
|
||||||
|
*/
|
||||||
|
export async function runWithProxy(run) {
|
||||||
|
const httpProxyEnvVars = [
|
||||||
|
"https_proxy",
|
||||||
|
"HTTPS_PROXY",
|
||||||
|
"http_proxy",
|
||||||
|
"HTTP_PROXY",
|
||||||
|
];
|
||||||
|
const nodeHasProxySupportEnabled = process.env.NODE_USE_ENV_PROXY === "1";
|
||||||
|
const shouldUseProxy = httpProxyEnvVars.some((v) => process.env[v]);
|
||||||
|
|
||||||
|
if (!nodeHasProxySupportEnabled && shouldUseProxy) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const child = spawn(process.execPath, process.argv.slice(1), {
|
||||||
|
env: { ...process.env, NODE_USE_ENV_PROXY: "1" },
|
||||||
|
stdio: "inherit",
|
||||||
|
});
|
||||||
|
child.on("exit", (code) => {
|
||||||
|
process.exitCode = code;
|
||||||
|
if (code !== 0) {
|
||||||
|
reject(new Error(`Child process exited with code ${code}`));
|
||||||
|
} else {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return run();
|
||||||
|
}
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
// @ts-check
|
// @ts-check
|
||||||
|
|
||||||
import * as core from "@actions/core";
|
import 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";
|
||||||
import { main } from "./lib/main.js";
|
import { main } from "./lib/main.js";
|
||||||
import request, { ensureNativeProxySupport } from "./lib/request.js";
|
import request from "./lib/request.js";
|
||||||
|
import { runWithProxy } from "./lib/run-with-proxy.js";
|
||||||
|
|
||||||
if (!process.env.GITHUB_REPOSITORY) {
|
if (!process.env.GITHUB_REPOSITORY) {
|
||||||
throw new Error("GITHUB_REPOSITORY missing, must be set to '<owner>/<repo>'");
|
throw new Error("GITHUB_REPOSITORY missing, must be set to '<owner>/<repo>'");
|
||||||
@@ -15,13 +16,9 @@ if (!process.env.GITHUB_REPOSITORY_OWNER) {
|
|||||||
throw new Error("GITHUB_REPOSITORY_OWNER missing, must be set to '<owner>'");
|
throw new Error("GITHUB_REPOSITORY_OWNER missing, must be set to '<owner>'");
|
||||||
}
|
}
|
||||||
|
|
||||||
async function run() {
|
// Export promise for testing
|
||||||
ensureNativeProxySupport();
|
export default runWithProxy(async () => {
|
||||||
|
const appId = core.getInput("app-id");
|
||||||
const clientId = core.getInput("client-id") || core.getInput("app-id");
|
|
||||||
if (!clientId) {
|
|
||||||
throw new Error("The 'client-id' (or deprecated 'app-id') input must be set to a non-empty string. If using a secret or variable, ensure it is available in this workflow context.");
|
|
||||||
}
|
|
||||||
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
|
||||||
@@ -35,7 +32,7 @@ async function run() {
|
|||||||
const permissions = getPermissionsFromInputs(process.env);
|
const permissions = getPermissionsFromInputs(process.env);
|
||||||
|
|
||||||
return main(
|
return main(
|
||||||
clientId,
|
appId,
|
||||||
privateKey,
|
privateKey,
|
||||||
owner,
|
owner,
|
||||||
repositories,
|
repositories,
|
||||||
@@ -44,12 +41,9 @@ async function run() {
|
|||||||
createAppAuth,
|
createAppAuth,
|
||||||
request,
|
request,
|
||||||
skipTokenRevoke,
|
skipTokenRevoke,
|
||||||
);
|
).catch((error) => {
|
||||||
}
|
|
||||||
|
|
||||||
// Export promise for testing
|
|
||||||
export default run().catch((error) => {
|
|
||||||
/* c8 ignore next 3 */
|
/* c8 ignore next 3 */
|
||||||
console.error(error);
|
console.error(error);
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|||||||
Generated
+2317
-389
File diff suppressed because it is too large
Load Diff
+18
-14
@@ -2,32 +2,36 @@
|
|||||||
"name": "create-github-app-token",
|
"name": "create-github-app-token",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "3.1.1",
|
"version": "2.2.1",
|
||||||
"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": ">=20"
|
||||||
},
|
},
|
||||||
"packageManager": "[email protected]",
|
"packageManager": "[email protected]",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "esbuild main.js post.js --bundle --outdir=dist --out-extension:.js=.cjs --platform=node --packages=bundle",
|
"build": "esbuild main.js post.js --bundle --outdir=dist --out-extension:.js=.cjs --platform=node --target=node20.0.0 --packages=bundle",
|
||||||
"test": "c8 --100 node --test tests/index.js",
|
"test": "c8 --100 ava tests/index.js",
|
||||||
"coverage": "c8 report --reporter html",
|
"coverage": "c8 report --reporter html",
|
||||||
"postcoverage": "open-cli coverage/index.html"
|
"postcoverage": "open-cli coverage/index.html"
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^3.0.0",
|
"@actions/core": "^1.11.1",
|
||||||
"@octokit/auth-app": "^8.2.0",
|
"@octokit/auth-app": "^8.1.2",
|
||||||
"@octokit/request": "^10.0.8",
|
"@octokit/request": "^10.0.3",
|
||||||
"p-retry": "^8.0.0"
|
"p-retry": "^7.1.0",
|
||||||
|
"undici": "^7.16.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@octokit/openapi": "^22.0.0",
|
"@octokit/openapi": "^21.0.0",
|
||||||
"c8": "^11.0.0",
|
"@sinonjs/fake-timers": "^15.0.0",
|
||||||
"esbuild": "^0.27.4",
|
"ava": "^6.4.1",
|
||||||
"open-cli": "^9.0.0",
|
"c8": "^10.1.3",
|
||||||
"undici": "^7.24.6",
|
"dotenv": "^17.2.3",
|
||||||
"yaml": "^2.8.3"
|
"esbuild": "^0.25.10",
|
||||||
|
"execa": "^9.6.0",
|
||||||
|
"open-cli": "^8.0.0",
|
||||||
|
"yaml": "^2.8.1"
|
||||||
},
|
},
|
||||||
"release": {
|
"release": {
|
||||||
"branches": [
|
"branches": [
|
||||||
|
|||||||
@@ -1,18 +1,16 @@
|
|||||||
// @ts-check
|
// @ts-check
|
||||||
|
|
||||||
import * as core from "@actions/core";
|
import 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 from "./lib/request.js";
|
||||||
|
import { runWithProxy } from "./lib/run-with-proxy.js";
|
||||||
|
|
||||||
async function run() {
|
// Export promise for testing
|
||||||
ensureNativeProxySupport();
|
export default runWithProxy(async () => {
|
||||||
|
return post(core, request).catch((error) => {
|
||||||
return post(core, request);
|
|
||||||
}
|
|
||||||
|
|
||||||
run().catch((error) => {
|
|
||||||
/* c8 ignore next 3 */
|
/* c8 ignore next 3 */
|
||||||
console.error(error);
|
console.error(error);
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|||||||
@@ -19,22 +19,6 @@
|
|||||||
"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.",
|
||||||
@@ -75,14 +59,6 @@
|
|||||||
"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.",
|
||||||
@@ -99,14 +75,6 @@
|
|||||||
"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.",
|
||||||
|
|||||||
+6
-12
@@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
Add one test file per scenario. You can run them in isolation with:
|
Add one test file per scenario. You can run them in isolation with:
|
||||||
|
|
||||||
```
|
```bash
|
||||||
node tests/post-token-set.test.js
|
node tests/post-token-set.test.js
|
||||||
```
|
```
|
||||||
|
|
||||||
All tests are run together in [tests/index.js](index.js), which can be executed with Node's built-in test runner
|
All tests are run together in [tests/index.js](index.js), which can be executed with ava
|
||||||
|
|
||||||
```
|
```
|
||||||
node --test tests/index.js
|
npx ava tests/index.js
|
||||||
```
|
```
|
||||||
|
|
||||||
or with npm
|
or with npm
|
||||||
@@ -20,17 +20,11 @@ npm test
|
|||||||
|
|
||||||
## How the tests work
|
## How the tests work
|
||||||
|
|
||||||
The output from the tests is captured into a snapshot ([tests/index.js.snapshot](index.js.snapshot)). It includes all requests sent by our scripts to verify it's working correctly and to prevent regressions.
|
The output from the tests is captured into a snapshot ([tests/snapshots/index.js.md](snapshots/index.js.md)). It includes all requests sent by our scripts to verify it's working correctly and to prevent regressions.
|
||||||
|
|
||||||
To update snapshots after an intentional change:
|
|
||||||
|
|
||||||
```
|
|
||||||
node --test --test-update-snapshots tests/index.js
|
|
||||||
```
|
|
||||||
|
|
||||||
## How to add a new test
|
## How to add a new test
|
||||||
|
|
||||||
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](main-token-permissions-set.test.js) as a starting point.
|
- 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 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.
|
- 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.
|
||||||
|
|||||||
+19
-38
@@ -1,23 +1,15 @@
|
|||||||
import { readdirSync } from "node:fs";
|
import { readdirSync } from "node:fs";
|
||||||
import { execFile } from "node:child_process";
|
|
||||||
import { promisify } from "node:util";
|
|
||||||
|
|
||||||
import { snapshot, test } from "node:test";
|
import test from "ava";
|
||||||
|
import { execa } from "execa";
|
||||||
const execFileAsync = promisify(execFile);
|
|
||||||
|
|
||||||
// Serialize strings as-is so multiline output is human-readable in snapshots
|
|
||||||
snapshot.setDefaultSnapshotSerializers([
|
|
||||||
(value) => (typeof value === "string" ? value : undefined),
|
|
||||||
]);
|
|
||||||
|
|
||||||
// Get all files in tests directory
|
// Get all files in tests directory
|
||||||
const files = readdirSync("tests");
|
const files = readdirSync("tests");
|
||||||
|
|
||||||
// Files to ignore
|
// Files to ignore
|
||||||
const ignore = ["index.js", "index.js.snapshot", "main.js", "README.md"];
|
const ignore = ["index.js", "main.js", "README.md", "snapshots"];
|
||||||
|
|
||||||
const testFiles = files.filter((file) => !ignore.includes(file)).sort();
|
const testFiles = files.filter((file) => !ignore.includes(file));
|
||||||
|
|
||||||
// Throw an error if there is a file that does not end with test.js in the tests directory
|
// Throw an error if there is a file that does not end with test.js in the tests directory
|
||||||
for (const file of testFiles) {
|
for (const file of testFiles) {
|
||||||
@@ -26,31 +18,20 @@ for (const file of testFiles) {
|
|||||||
}
|
}
|
||||||
test(file, async (t) => {
|
test(file, async (t) => {
|
||||||
// Override Actions environment variables that change `core`’s behavior
|
// Override Actions environment variables that change `core`’s behavior
|
||||||
const {
|
const env = {
|
||||||
GITHUB_OUTPUT,
|
GITHUB_OUTPUT: undefined,
|
||||||
GITHUB_STATE,
|
GITHUB_STATE: undefined,
|
||||||
HTTP_PROXY,
|
};
|
||||||
HTTPS_PROXY,
|
const { stderr, stdout } = await execa(
|
||||||
http_proxy,
|
"node",
|
||||||
https_proxy,
|
[
|
||||||
NO_PROXY,
|
"--experimental-test-module-mocks",
|
||||||
no_proxy,
|
"--disable-warning=ExperimentalWarning",
|
||||||
NODE_OPTIONS,
|
`tests/${file}`,
|
||||||
NODE_USE_ENV_PROXY,
|
],
|
||||||
...env
|
{ env },
|
||||||
} = process.env;
|
);
|
||||||
const { stderr, stdout } = await execFileAsync("node", [`tests/${file}`], {
|
t.snapshot(stderr, "stderr");
|
||||||
env,
|
t.snapshot(stdout, "stdout");
|
||||||
});
|
|
||||||
const trimmedStderr = stderr.replace(/\r?\n$/, "");
|
|
||||||
const trimmedStdout = stdout.replace(/\r?\n$/, "");
|
|
||||||
await t.test("stderr", (t) => {
|
|
||||||
if (trimmedStderr) t.assert.snapshot(trimmedStderr);
|
|
||||||
else t.assert.strictEqual(trimmedStderr, "");
|
|
||||||
});
|
|
||||||
await t.test("stdout", (t) => {
|
|
||||||
if (trimmedStdout) t.assert.snapshot(trimmedStdout);
|
|
||||||
else t.assert.strictEqual(trimmedStdout, "");
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,320 +0,0 @@
|
|||||||
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`] = `
|
|
||||||
Inputs 'owner' and 'repositories' are set. Creating token for the following repositories:
|
|
||||||
|
|
||||||
- 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 /api/v3/repos/actions/create-github-app-token/installation
|
|
||||||
POST /api/v3/app/installations/123456/access_tokens
|
|
||||||
{"repositories":["create-github-app-token"]}
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`main-missing-client-and-app-id.test.js > stderr 1`] = `
|
|
||||||
The 'client-id' (or deprecated 'app-id') input must be set to a non-empty string. If using a secret or variable, ensure it is available in this workflow context.
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`main-missing-client-and-app-id.test.js > stdout 1`] = `
|
|
||||||
::error::The 'client-id' (or deprecated 'app-id') input must be set to a non-empty string. If using a secret or variable, ensure it is available in this workflow context.
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`main-missing-owner.test.js > stderr 1`] = `
|
|
||||||
GITHUB_REPOSITORY_OWNER missing, must be set to '<owner>'
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`main-missing-repository.test.js > stderr 1`] = `
|
|
||||||
GITHUB_REPOSITORY missing, must be set to '<owner>/<repo>'
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`main-private-key-with-escaped-newlines.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-proxy-requires-native-support.test.js > stderr 1`] = `
|
|
||||||
A proxy environment variable is set, but Node.js native proxy support is not enabled. Set NODE_USE_ENV_PROXY=1 for this action step.
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`main-proxy-requires-native-support.test.js > stdout 1`] = `
|
|
||||||
::error::A proxy environment variable is set, but Node.js native proxy support is not enabled. Set NODE_USE_ENV_PROXY=1 for this action step.
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`main-repo-skew.test.js > stderr 1`] = `
|
|
||||||
'Issued at' claim ('iat') must be an Integer representing the time that the assertion was issued.
|
|
||||||
[@octokit/auth-app] GitHub API time and system time are different by 30 seconds. Retrying request with the difference accounted for.
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`main-repo-skew.test.js > stdout 1`] = `
|
|
||||||
Inputs 'owner' and 'repositories' are set. Creating token for the following repositories:
|
|
||||||
|
|
||||||
- actions/failed-repo
|
|
||||||
::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/failed-repo/installation
|
|
||||||
GET /repos/actions/failed-repo/installation
|
|
||||||
POST /app/installations/123456/access_tokens
|
|
||||||
{"repositories":["failed-repo"]}
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`main-token-get-owner-set-fail-response.test.js > stdout 1`] = `
|
|
||||||
Input 'repositories' is not set. Creating token for all repositories owned by smockle.
|
|
||||||
Failed to create token for "smockle" (attempt 1): GitHub API not available
|
|
||||||
::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 /users/smockle/installation
|
|
||||||
GET /users/smockle/installation
|
|
||||||
POST /app/installations/123456/access_tokens
|
|
||||||
null
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`main-token-get-owner-set-repo-fail-response.test.js > stdout 1`] = `
|
|
||||||
Inputs 'owner' and 'repositories' are set. Creating token for the following repositories:
|
|
||||||
|
|
||||||
- actions/failed-repo
|
|
||||||
Failed to create token for "failed-repo" (attempt 1): GitHub API not available
|
|
||||||
::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/failed-repo/installation
|
|
||||||
GET /repos/actions/failed-repo/installation
|
|
||||||
POST /app/installations/123456/access_tokens
|
|
||||||
{"repositories":["failed-repo"]}
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`main-token-get-owner-set-repo-set-to-many-newline.test.js > stdout 1`] = `
|
|
||||||
Inputs 'owner' and 'repositories' are set. Creating token for the following repositories:
|
|
||||||
|
|
||||||
- actions/create-github-app-token
|
|
||||||
- actions/toolkit
|
|
||||||
- actions/checkout
|
|
||||||
::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","toolkit","checkout"]}
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`main-token-get-owner-set-repo-set-to-many.test.js > stdout 1`] = `
|
|
||||||
Inputs 'owner' and 'repositories' are set. Creating token for the following repositories:
|
|
||||||
|
|
||||||
- actions/create-github-app-token
|
|
||||||
- actions/toolkit
|
|
||||||
- actions/checkout
|
|
||||||
::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","toolkit","checkout"]}
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`main-token-get-owner-set-repo-set-to-one.test.js > stdout 1`] = `
|
|
||||||
Inputs 'owner' and 'repositories' are set. Creating token for the following repositories:
|
|
||||||
|
|
||||||
- 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-token-get-owner-set-repo-unset.test.js > stdout 1`] = `
|
|
||||||
Input 'repositories' is not set. Creating token for all repositories owned by actions.
|
|
||||||
::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 /users/actions/installation
|
|
||||||
POST /app/installations/123456/access_tokens
|
|
||||||
null
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`main-token-get-owner-unset-repo-set.test.js > stdout 1`] = `
|
|
||||||
No 'owner' input provided. Using default owner 'actions' to create token for the following repositories:
|
|
||||||
- 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-token-get-owner-unset-repo-unset.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-token-permissions-set.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"],"permissions":{"issues":"write","pull_requests":"read"}}
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`post-proxy-requires-native-support.test.js > stderr 1`] = `
|
|
||||||
A proxy environment variable is set, but Node.js native proxy support is not enabled. Set NODE_USE_ENV_PROXY=1 for this action step.
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`post-proxy-requires-native-support.test.js > stdout 1`] = `
|
|
||||||
::error::A proxy environment variable is set, but Node.js native proxy support is not enabled. Set NODE_USE_ENV_PROXY=1 for this action step.
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`post-revoke-token-fail-response.test.js > stdout 1`] = `
|
|
||||||
::warning::Token revocation failed:
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`post-token-expired.test.js > stdout 1`] = `
|
|
||||||
Token expired, skipping token revocation
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`post-token-set.test.js > stdout 1`] = `
|
|
||||||
Token revoked
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`post-token-skipped.test.js > stdout 1`] = `
|
|
||||||
Token revocation was skipped
|
|
||||||
`;
|
|
||||||
|
|
||||||
exports[`post-token-unset.test.js > stdout 1`] = `
|
|
||||||
Token is not set
|
|
||||||
`;
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
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",
|
|
||||||
}
|
|
||||||
);
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
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",
|
|
||||||
}
|
|
||||||
);
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
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;
|
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
// Verify that `runWithProxy()` calls the callback directly (no child process)
|
||||||
|
// when `NODE_USE_ENV_PROXY` is already set to `"1"`, even with proxy env vars set.
|
||||||
|
import assert from "node:assert";
|
||||||
|
import { runWithProxy } from "../lib/run-with-proxy.js";
|
||||||
|
|
||||||
|
process.env.https_proxy = "http://proxy.example.com";
|
||||||
|
process.env.NODE_USE_ENV_PROXY = "1";
|
||||||
|
|
||||||
|
let callbackCalled = false;
|
||||||
|
|
||||||
|
await runWithProxy(async () => {
|
||||||
|
callbackCalled = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
assert(callbackCalled, "callback was called directly without spawning");
|
||||||
|
|
||||||
|
delete process.env.NODE_USE_ENV_PROXY;
|
||||||
|
delete process.env.https_proxy;
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
// Verify that `main.js` rejects when the child process exits with a non-zero code.
|
||||||
|
import assert from "node:assert";
|
||||||
|
import { mock } from "node:test";
|
||||||
|
|
||||||
|
mock.module("node:child_process", {
|
||||||
|
namedExports: {
|
||||||
|
spawn() {
|
||||||
|
return {
|
||||||
|
on(event, callback) {
|
||||||
|
if (event === "exit") callback(1);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
process.env.GITHUB_REPOSITORY = "actions/create-github-app-token";
|
||||||
|
process.env.GITHUB_REPOSITORY_OWNER = "actions";
|
||||||
|
process.env.https_proxy = "http://proxy.example.com";
|
||||||
|
delete process.env.NODE_USE_ENV_PROXY;
|
||||||
|
|
||||||
|
const { default: runPromise } = await import("../main.js");
|
||||||
|
|
||||||
|
await assert.rejects(runPromise, {
|
||||||
|
message: "Child process exited with code 1",
|
||||||
|
});
|
||||||
|
assert.equal(process.exitCode, 1, "process exit code is 1");
|
||||||
|
|
||||||
|
// Reset for other tests
|
||||||
|
process.exitCode = 0;
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
process.env.GITHUB_REPOSITORY = "actions/create-github-app-token";
|
|
||||||
process.env.GITHUB_REPOSITORY_OWNER = "actions";
|
|
||||||
process.env.HTTPS_PROXY = "http://127.0.0.1:3128";
|
|
||||||
|
|
||||||
const originalConsoleError = console.error;
|
|
||||||
console.error = (...args) => {
|
|
||||||
originalConsoleError(
|
|
||||||
...args.map((arg) => (arg instanceof Error ? arg.message : arg)),
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
await import("../main.js");
|
|
||||||
await new Promise((resolve) => setImmediate(resolve));
|
|
||||||
process.exitCode = 0;
|
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
// Verify that `main.js` spawns a child process when a proxy env var is set
|
||||||
|
// and `NODE_USE_ENV_PROXY` is not set.
|
||||||
|
import assert from "node:assert";
|
||||||
|
import { mock } from "node:test";
|
||||||
|
|
||||||
|
let spawnArgs;
|
||||||
|
|
||||||
|
mock.module("node:child_process", {
|
||||||
|
namedExports: {
|
||||||
|
spawn(command, args, options) {
|
||||||
|
spawnArgs = { command, args, options };
|
||||||
|
return {
|
||||||
|
on(event, callback) {
|
||||||
|
if (event === "exit") callback(0);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
process.env.GITHUB_REPOSITORY = "actions/create-github-app-token";
|
||||||
|
process.env.GITHUB_REPOSITORY_OWNER = "actions";
|
||||||
|
process.env.https_proxy = "http://proxy.example.com";
|
||||||
|
delete process.env.NODE_USE_ENV_PROXY;
|
||||||
|
|
||||||
|
const { default: runPromise } = await import("../main.js");
|
||||||
|
await runPromise;
|
||||||
|
|
||||||
|
assert(spawnArgs, "spawn was called");
|
||||||
|
assert.equal(
|
||||||
|
spawnArgs.options.env.NODE_USE_ENV_PROXY,
|
||||||
|
"1",
|
||||||
|
"NODE_USE_ENV_PROXY is set to '1' in child env",
|
||||||
|
);
|
||||||
|
assert.equal(spawnArgs.options.stdio, "inherit", "stdio is inherited");
|
||||||
|
assert.equal(process.exitCode, 0, "process exit code is 0");
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { mock } from "node:test";
|
|
||||||
|
|
||||||
import { test } from "./main.js";
|
import { test } from "./main.js";
|
||||||
|
|
||||||
|
import { install } from "@sinonjs/fake-timers";
|
||||||
|
|
||||||
// Verify `main` retry when the clock has drifted.
|
// Verify `main` retry when the clock has drifted.
|
||||||
await test((mockPool) => {
|
await test((mockPool) => {
|
||||||
process.env.INPUT_OWNER = "actions";
|
process.env.INPUT_OWNER = "actions";
|
||||||
@@ -11,7 +11,7 @@ await test((mockPool) => {
|
|||||||
const mockInstallationId = "123456";
|
const mockInstallationId = "123456";
|
||||||
const mockAppSlug = "github-actions";
|
const mockAppSlug = "github-actions";
|
||||||
|
|
||||||
mock.timers.enable({ apis: ["Date"], now: 0 });
|
install({ now: 0, toFake: ["Date"] });
|
||||||
|
|
||||||
mockPool
|
mockPool
|
||||||
.intercept({
|
.intercept({
|
||||||
@@ -59,6 +59,4 @@ await test((mockPool) => {
|
|||||||
};
|
};
|
||||||
})
|
})
|
||||||
.times(2);
|
.times(2);
|
||||||
}).finally(() => {
|
|
||||||
mock.timers.reset();
|
|
||||||
});
|
});
|
||||||
|
|||||||
+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_CLIENT-ID": "Iv1.0123456789abcdef",
|
"INPUT_APP-ID": "123456",
|
||||||
// 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
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
// Verify that `runWithProxy()` calls the callback directly (no child process)
|
||||||
|
// when `NODE_USE_ENV_PROXY` is already set to `"1"`, even with proxy env vars set.
|
||||||
|
// This ensures post.js would also follow the callback path.
|
||||||
|
import assert from "node:assert";
|
||||||
|
import { runWithProxy } from "../lib/run-with-proxy.js";
|
||||||
|
|
||||||
|
process.env.HTTP_PROXY = "http://proxy.example.com";
|
||||||
|
process.env.NODE_USE_ENV_PROXY = "1";
|
||||||
|
|
||||||
|
let callbackCalled = false;
|
||||||
|
|
||||||
|
await runWithProxy(async () => {
|
||||||
|
callbackCalled = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
assert(callbackCalled, "callback was called directly without spawning");
|
||||||
|
|
||||||
|
delete process.env.NODE_USE_ENV_PROXY;
|
||||||
|
delete process.env.HTTP_PROXY;
|
||||||
|
|
||||||
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
process.env["INPUT_GITHUB-API-URL"] = "https://api.github.com";
|
|
||||||
process.env.HTTPS_PROXY = "http://127.0.0.1:3128";
|
|
||||||
|
|
||||||
const originalConsoleError = console.error;
|
|
||||||
console.error = (...args) => {
|
|
||||||
originalConsoleError(
|
|
||||||
...args.map((arg) => (arg instanceof Error ? arg.message : arg)),
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
await import("../post.js");
|
|
||||||
await new Promise((resolve) => setImmediate(resolve));
|
|
||||||
process.exitCode = 0;
|
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
// Verify that `post.js` spawns a child process when a proxy env var is set
|
||||||
|
// and `NODE_USE_ENV_PROXY` is not set.
|
||||||
|
import assert from "node:assert";
|
||||||
|
import { mock } from "node:test";
|
||||||
|
|
||||||
|
let spawnArgs;
|
||||||
|
|
||||||
|
mock.module("node:child_process", {
|
||||||
|
namedExports: {
|
||||||
|
spawn(command, args, options) {
|
||||||
|
spawnArgs = { command, args, options };
|
||||||
|
return {
|
||||||
|
on(event, callback) {
|
||||||
|
if (event === "exit") callback(0);
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
process.env.https_proxy = "http://proxy.example.com";
|
||||||
|
delete process.env.NODE_USE_ENV_PROXY;
|
||||||
|
|
||||||
|
const { default: runPromise } = await import("../post.js");
|
||||||
|
await runPromise;
|
||||||
|
|
||||||
|
assert(spawnArgs, "spawn was called");
|
||||||
|
assert.equal(
|
||||||
|
spawnArgs.options.env.NODE_USE_ENV_PROXY,
|
||||||
|
"1",
|
||||||
|
"NODE_USE_ENV_PROXY is set to '1' in child env",
|
||||||
|
);
|
||||||
|
assert.equal(spawnArgs.options.stdio, "inherit", "stdio is inherited");
|
||||||
|
assert.equal(process.exitCode, 0, "process exit code is 0");
|
||||||
@@ -0,0 +1,434 @@
|
|||||||
|
# Snapshot report for `tests/index.js`
|
||||||
|
|
||||||
|
The actual snapshot is saved in `index.js.snap`.
|
||||||
|
|
||||||
|
Generated by [AVA](https://avajs.dev).
|
||||||
|
|
||||||
|
## action-deprecated-inputs.test.js
|
||||||
|
|
||||||
|
> stderr
|
||||||
|
|
||||||
|
''
|
||||||
|
|
||||||
|
> stdout
|
||||||
|
|
||||||
|
''
|
||||||
|
|
||||||
|
## main-custom-github-api-url.test.js
|
||||||
|
|
||||||
|
> stderr
|
||||||
|
|
||||||
|
''
|
||||||
|
|
||||||
|
> stdout
|
||||||
|
|
||||||
|
`Inputs 'owner' and 'repositories' are set. Creating token for the following repositories:␊
|
||||||
|
␊
|
||||||
|
- 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 /api/v3/repos/actions/create-github-app-token/installation␊
|
||||||
|
POST /api/v3/app/installations/123456/access_tokens␊
|
||||||
|
{"repositories":["create-github-app-token"]}`
|
||||||
|
|
||||||
|
## main-missing-owner.test.js
|
||||||
|
|
||||||
|
> stderr
|
||||||
|
|
||||||
|
'GITHUB_REPOSITORY_OWNER missing, must be set to \'<owner>\''
|
||||||
|
|
||||||
|
> stdout
|
||||||
|
|
||||||
|
''
|
||||||
|
|
||||||
|
## main-missing-repository.test.js
|
||||||
|
|
||||||
|
> stderr
|
||||||
|
|
||||||
|
'GITHUB_REPOSITORY missing, must be set to \'<owner>/<repo>\''
|
||||||
|
|
||||||
|
> stdout
|
||||||
|
|
||||||
|
''
|
||||||
|
|
||||||
|
## main-private-key-with-escaped-newlines.test.js
|
||||||
|
|
||||||
|
> stderr
|
||||||
|
|
||||||
|
''
|
||||||
|
|
||||||
|
> stdout
|
||||||
|
|
||||||
|
`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"]}`
|
||||||
|
|
||||||
|
## main-proxy-already-enabled.test.js
|
||||||
|
|
||||||
|
> stderr
|
||||||
|
|
||||||
|
''
|
||||||
|
|
||||||
|
> stdout
|
||||||
|
|
||||||
|
''
|
||||||
|
|
||||||
|
## main-proxy-child-error.test.js
|
||||||
|
|
||||||
|
> stderr
|
||||||
|
|
||||||
|
''
|
||||||
|
|
||||||
|
> stdout
|
||||||
|
|
||||||
|
''
|
||||||
|
|
||||||
|
## main-proxy-spawns-child.test.js
|
||||||
|
|
||||||
|
> stderr
|
||||||
|
|
||||||
|
''
|
||||||
|
|
||||||
|
> stdout
|
||||||
|
|
||||||
|
''
|
||||||
|
|
||||||
|
## main-repo-skew.test.js
|
||||||
|
|
||||||
|
> stderr
|
||||||
|
|
||||||
|
`'Issued at' claim ('iat') must be an Integer representing the time that the assertion was issued.␊
|
||||||
|
[@octokit/auth-app] GitHub API time and system time are different by 30 seconds. Retrying request with the difference accounted for.`
|
||||||
|
|
||||||
|
> stdout
|
||||||
|
|
||||||
|
`Inputs 'owner' and 'repositories' are set. Creating token for the following repositories:␊
|
||||||
|
␊
|
||||||
|
- actions/failed-repo␊
|
||||||
|
::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/failed-repo/installation␊
|
||||||
|
GET /repos/actions/failed-repo/installation␊
|
||||||
|
POST /app/installations/123456/access_tokens␊
|
||||||
|
{"repositories":["failed-repo"]}`
|
||||||
|
|
||||||
|
## main-token-get-owner-set-fail-response.test.js
|
||||||
|
|
||||||
|
> stderr
|
||||||
|
|
||||||
|
''
|
||||||
|
|
||||||
|
> stdout
|
||||||
|
|
||||||
|
`Input 'repositories' is not set. Creating token for all repositories owned by smockle.␊
|
||||||
|
Failed to create token for "smockle" (attempt 1): GitHub API not available␊
|
||||||
|
::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 /users/smockle/installation␊
|
||||||
|
GET /users/smockle/installation␊
|
||||||
|
POST /app/installations/123456/access_tokens␊
|
||||||
|
null`
|
||||||
|
|
||||||
|
## main-token-get-owner-set-repo-fail-response.test.js
|
||||||
|
|
||||||
|
> stderr
|
||||||
|
|
||||||
|
''
|
||||||
|
|
||||||
|
> stdout
|
||||||
|
|
||||||
|
`Inputs 'owner' and 'repositories' are set. Creating token for the following repositories:␊
|
||||||
|
␊
|
||||||
|
- actions/failed-repo␊
|
||||||
|
Failed to create token for "failed-repo" (attempt 1): GitHub API not available␊
|
||||||
|
::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/failed-repo/installation␊
|
||||||
|
GET /repos/actions/failed-repo/installation␊
|
||||||
|
POST /app/installations/123456/access_tokens␊
|
||||||
|
{"repositories":["failed-repo"]}`
|
||||||
|
|
||||||
|
## main-token-get-owner-set-repo-set-to-many-newline.test.js
|
||||||
|
|
||||||
|
> stderr
|
||||||
|
|
||||||
|
''
|
||||||
|
|
||||||
|
> stdout
|
||||||
|
|
||||||
|
`Inputs 'owner' and 'repositories' are set. Creating token for the following repositories:␊
|
||||||
|
␊
|
||||||
|
- actions/create-github-app-token␊
|
||||||
|
- actions/toolkit␊
|
||||||
|
- actions/checkout␊
|
||||||
|
::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","toolkit","checkout"]}`
|
||||||
|
|
||||||
|
## main-token-get-owner-set-repo-set-to-many.test.js
|
||||||
|
|
||||||
|
> stderr
|
||||||
|
|
||||||
|
''
|
||||||
|
|
||||||
|
> stdout
|
||||||
|
|
||||||
|
`Inputs 'owner' and 'repositories' are set. Creating token for the following repositories:␊
|
||||||
|
␊
|
||||||
|
- actions/create-github-app-token␊
|
||||||
|
- actions/toolkit␊
|
||||||
|
- actions/checkout␊
|
||||||
|
::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","toolkit","checkout"]}`
|
||||||
|
|
||||||
|
## main-token-get-owner-set-repo-set-to-one.test.js
|
||||||
|
|
||||||
|
> stderr
|
||||||
|
|
||||||
|
''
|
||||||
|
|
||||||
|
> stdout
|
||||||
|
|
||||||
|
`Inputs 'owner' and 'repositories' are set. Creating token for the following repositories:␊
|
||||||
|
␊
|
||||||
|
- 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"]}`
|
||||||
|
|
||||||
|
## main-token-get-owner-set-repo-unset.test.js
|
||||||
|
|
||||||
|
> stderr
|
||||||
|
|
||||||
|
''
|
||||||
|
|
||||||
|
> stdout
|
||||||
|
|
||||||
|
`Input 'repositories' is not set. Creating token for all repositories owned by actions.␊
|
||||||
|
::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 /users/actions/installation␊
|
||||||
|
POST /app/installations/123456/access_tokens␊
|
||||||
|
null`
|
||||||
|
|
||||||
|
## main-token-get-owner-unset-repo-set.test.js
|
||||||
|
|
||||||
|
> stderr
|
||||||
|
|
||||||
|
''
|
||||||
|
|
||||||
|
> stdout
|
||||||
|
|
||||||
|
`No 'owner' input provided. Using default owner 'actions' to create token for the following repositories:␊
|
||||||
|
- 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"]}`
|
||||||
|
|
||||||
|
## main-token-get-owner-unset-repo-unset.test.js
|
||||||
|
|
||||||
|
> stderr
|
||||||
|
|
||||||
|
''
|
||||||
|
|
||||||
|
> stdout
|
||||||
|
|
||||||
|
`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"]}`
|
||||||
|
|
||||||
|
## main-token-permissions-set.test.js
|
||||||
|
|
||||||
|
> stderr
|
||||||
|
|
||||||
|
''
|
||||||
|
|
||||||
|
> stdout
|
||||||
|
|
||||||
|
`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"],"permissions":{"issues":"write","pull_requests":"read"}}`
|
||||||
|
|
||||||
|
## post-proxy-already-enabled.test.js
|
||||||
|
|
||||||
|
> stderr
|
||||||
|
|
||||||
|
''
|
||||||
|
|
||||||
|
> stdout
|
||||||
|
|
||||||
|
''
|
||||||
|
|
||||||
|
## post-proxy-spawns-child.test.js
|
||||||
|
|
||||||
|
> stderr
|
||||||
|
|
||||||
|
''
|
||||||
|
|
||||||
|
> stdout
|
||||||
|
|
||||||
|
''
|
||||||
|
|
||||||
|
## post-revoke-token-fail-response.test.js
|
||||||
|
|
||||||
|
> stderr
|
||||||
|
|
||||||
|
''
|
||||||
|
|
||||||
|
> stdout
|
||||||
|
|
||||||
|
'::warning::Token revocation failed: '
|
||||||
|
|
||||||
|
## post-token-expired.test.js
|
||||||
|
|
||||||
|
> stderr
|
||||||
|
|
||||||
|
''
|
||||||
|
|
||||||
|
> stdout
|
||||||
|
|
||||||
|
'Token expired, skipping token revocation'
|
||||||
|
|
||||||
|
## post-token-set.test.js
|
||||||
|
|
||||||
|
> stderr
|
||||||
|
|
||||||
|
''
|
||||||
|
|
||||||
|
> stdout
|
||||||
|
|
||||||
|
'Token revoked'
|
||||||
|
|
||||||
|
## post-token-skipped.test.js
|
||||||
|
|
||||||
|
> stderr
|
||||||
|
|
||||||
|
''
|
||||||
|
|
||||||
|
> stdout
|
||||||
|
|
||||||
|
'Token revocation was skipped'
|
||||||
|
|
||||||
|
## post-token-unset.test.js
|
||||||
|
|
||||||
|
> stderr
|
||||||
|
|
||||||
|
''
|
||||||
|
|
||||||
|
> stdout
|
||||||
|
|
||||||
|
'Token is not set'
|
||||||
Binary file not shown.
Reference in New Issue
Block a user