Skip to content

Commit

Permalink
fix(setup-git-credentials): expose all app credentials as outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
EdieLemoine committed Jan 16, 2023
1 parent 7506a6c commit 6809088
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 18 deletions.
60 changes: 48 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Will use every patch update within `v2.1.x`.

[Source](setup-app-credentials/action.yml)

This action creates a GitHub token for a [GitHub app].
Generate credentials and git committer details for a [GitHub app].

##### Example

Expand All @@ -88,6 +88,24 @@ This action creates a GitHub token for a [GitHub app].
token: ${{ steps.setup-app-credentials.outputs.token }}
```

##### Inputs

| Required | Name | Description | Example | Default |
|----------|---------------|-----------------------------|----------------------------------|---------|
| Yes | `app-id` | The app ID of the app. | `${{ secrets.APP_ID }}` ||
| Yes | `private-key` | The private key of the app. | `${{ secrets.APP_PRIVATE_KEY }}` ||

##### Outputs

| Name | Description | Example |
|-----------------------|------------------------------------------|----------------------------------------|
| `name` | The name of the app. | `my-app` |
| `token` | The GitHub token of the app. | `ghp_1234567890` |
| `git-author-name` | The name to use as GIT_AUTHOR_NAME. | `my-app[bot]` |
| `git-author-email` | The email to use as GIT_AUTHOR_EMAIL. | `my-app[bot]@users.noreply.github.com` |
| `git-committer-name` | The name to use as GIT_COMMITTER_NAME. | `my-app[bot]` |
| `git-committer-email` | The email to use as GIT_COMMITTER_EMAIL. | `my-app[bot]@users.noreply.github.com` |

See also [setup-git-credentials] for setting up git using a [GitHub app].

### Node
Expand Down Expand Up @@ -129,7 +147,7 @@ For use with Yarn 1.

##### Inputs

| required | name | description | Example | Default |
| Required | Name | Description | Example | Default |
|----------|----------------|------------------------------------|--------------------------------------|---------|
| No | `node-version` | The Node.js version to use | `18` | `18` |
| No | `yarn-args` | Arguments to use with yarn install | `--frozen-lockfile --ignore-scripts` | ` ` |
Expand All @@ -156,7 +174,7 @@ For use with Yarn 2 (berry).

##### Inputs

| required | name | description | Example | Default |
| Required | Name | Description | Example | Default |
|----------|----------------|------------------------------------|---------------------------------|---------|
| No | `node-version` | The Node.js version to use | `18` | `18` |
| No | `yarn-args` | Arguments to use with yarn install | `--immutable --immutable-cache` | ` ` |
Expand All @@ -182,7 +200,7 @@ For use with Yarn 2 (berry).

##### Inputs

| required | name | description | Example | Default |
| Required | Name | Description | Example | Default |
|----------|----------------|------------------------------------|--------------------------------------|---------------------|
| No | `node-version` | The Node.js version to use | `18` | `18` |
| No | `pnpm-version` | The pnpm version to use | `7.4.0` | `7.6.0` |
Expand Down Expand Up @@ -260,7 +278,7 @@ jobs based on git ref and tag.

##### Inputs

| required | name | description | Example | Default |
| Required | Name | Description | Example | Default |
|----------|---------------|----------------------------------------------|-------------------------------------------|--------------------------|
| Yes | `image` | Image name | `my-name/my-image` ||
| Yes | `key` | Cache key | `my-image-${{ hashFiles('Dockerfile') }}` | `${{ github.workflow }}` |
Expand All @@ -272,7 +290,7 @@ jobs based on git ref and tag.

##### Outputs

| name | description | Example |
| Name | Description | Example |
|----------------|-----------------------------|-------------------------------|
| `tagged-image` | Created image name with tag | `my-name/my-image:1639002200` |
| `tag` | Tag of the created image | `1639002200` |
Expand Down Expand Up @@ -301,7 +319,7 @@ jobs using a registry.

##### Inputs

| required | name | description | Example | Default |
| Required | Name | Description | Example | Default |
|----------|---------------------|------------------------------------|---------------------------------------|--------------|
| Yes | `image` | Image name | `my-name/my-image` ||
| No | `dockerfile` | Path to dockerfile | `./docker/prod.Dockerfile` | `Dockerfile` |
Expand All @@ -313,7 +331,7 @@ jobs using a registry.

##### Outputs

| name | description | Example |
| Name | Description | Example |
|----------------|-----------------------------|-------------------------------|
| `tagged-image` | Created image name with tag | `my-name/my-image:1639002200` |
| `tag` | Tag of the created image | `1639002200` |
Expand Down Expand Up @@ -342,15 +360,15 @@ installed if using any non-built-in [semantic-release] plugins.

##### Inputs

| required | name | description | Example | Default |
| Required | Name | Description | Example | Default |
|----------|-------------------------|---------------------------------------------|-------------------------------|-----------|
| Yes | `token` | GitHub Personal access token | `${{ secrets.GITHUB_TOKEN }}` ||
| No | `semantic-release-args` | Semantic release arguments | `'true` | `'false'` |
| No | `write-summary` | Write a summary to the GitHub action output | `'true` | `'false'` |

##### Outputs

| name | description | example |
| Name | Description | Example |
|--------------------|------------------------------------|---------|
| `version` | The new version | `1.2.3` |
| `previous-version` | The previous version | `1.2.2` |
Expand Down Expand Up @@ -391,6 +409,24 @@ Set up git credentials and authenticate as a [GitHub app].
private-key: ${{ secrets.GITHUB_APP_PRIVATE_KEY }}
```

##### Inputs

| Required | Name | Description | Example | Default |
|----------|---------------|-----------------------------|----------------------------------|---------|
| true | `app-id` | The app ID of the app. | `${{ secrets.APP_ID }}` ||
| true | `private-key` | The private key of the app. | `${{ secrets.APP_PRIVATE_KEY }}` ||

##### Outputs

| Name | Description | Example |
|-----------------------|------------------------------------------|----------------------------------------|
| `name` | The name of the app. | `my-app` |
| `token` | The GitHub token of the app. | `ghp_1234567890` |
| `git-author-name` | The name to use as GIT_AUTHOR_NAME. | `my-app[bot]` |
| `git-author-email` | The email to use as GIT_AUTHOR_EMAIL. | `my-app[bot]@users.noreply.github.com` |
| `git-committer-name` | The name to use as GIT_COMMITTER_NAME. | `my-app[bot]` |
| `git-committer-email` | The email to use as GIT_COMMITTER_EMAIL. | `my-app[bot]@users.noreply.github.com` |

#### rebase

[Source](rebase/action.yml)
Expand All @@ -399,7 +435,7 @@ Rebase two branches and push.

##### Inputs

| required | name | description | Example | Default |
| Required | Name | Description | Example | Default |
|----------|----------|--------------------------------------|--------------------------------|----------|
| Yes | `target` | Target branch you wish to update. | `develop` ||
| Yes | `base` | Base branch to use to rebase target. | `main` ||
Expand Down Expand Up @@ -428,7 +464,7 @@ GitHub actions.

##### Inputs

| required | name | description | Example | Default |
| Required | Name | Description | Example | Default |
|----------|---------|---------------------------|---------|---------|
| No | `minor` | Update the major version. | `true` | `true` |
| No | `major` | Update the minor version. | `true` | `false` |
Expand Down
2 changes: 1 addition & 1 deletion setup-app-credentials/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ outputs:
value: ${{ steps.create-outputs.outputs.name }}

token:
description: 'The token of the app.'
description: 'The GitHub token of the app.'
value: ${{ steps.create-outputs.outputs.token }}

git-author-name:
Expand Down
35 changes: 30 additions & 5 deletions setup-git-credentials/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,43 @@ inputs:
description: 'The private key of the app.'
required: true

outputs:
name:
description: 'The name of the app.'
value: ${{ steps.create-outputs.outputs.name }}

token:
description: 'The GitHub token of the app.'
value: ${{ steps.create-outputs.outputs.token }}

git-author-name:
description: 'The name to use as GIT_AUTHOR_NAME.'
value: ${{ steps.create-outputs.outputs.git-author-name }}

git-author-email:
description: 'The email to use as GIT_AUTHOR_EMAIL.'
value: ${{ steps.create-outputs.outputs.git-author-email }}

git-committer-name:
description: 'The name to use as GIT_COMMITTER_NAME.'
value: ${{ steps.create-outputs.outputs.git-committer-name }}

git-committer-email:
description: 'The email to use as GIT_COMMITTER_EMAIL.'
value: ${{ steps.create-outputs.outputs.git-committer-email }}

runs:
using: composite
steps:
- uses: myparcelnl/actions/setup-app-credentials@v3
id: app-credentials
id: create-outputs
with:
app-id: ${{ inputs.app-id }}
private-key: ${{ inputs.private-key }}

- uses: oleksiyrudenko/gha-git-credentials@v2.1
with:
token: ${{ app-credentials.token }}
name: ${{ app-credentials.git-author-name }}
email: ${{ app-credentials.git-author-email }}
actor: ${{ app-credentials.git-author-name }}
token: ${{ steps.create-outputs.outputs.token }}
name: ${{ steps.create-outputs.outputs.git-author-name }}
email: ${{ steps.create-outputs.outputs.git-author-email }}
actor: ${{ steps.create-outputs.outputs.git-author-name }}

0 comments on commit 6809088

Please sign in to comment.