Skip to content

Commit

Permalink
Add: Add README for set-github-user and add repository input
Browse files Browse the repository at this point in the history
Document the usage of the set-github-user action and allow to specify
the to be used repository.
  • Loading branch information
bjoernricks committed May 12, 2023
1 parent 768f487 commit 7637f1c
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
34 changes: 34 additions & 0 deletions set-github-user/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Setup GitHub User in a Repository

GitHub Action to setup the user for a repository. Can be used to push content
to GitHub.

## Example

```yml
name: Setup GitHub User

on:
pull_request:

jobs:
setup-pontos:
name: Setup
runs-on: ubuntu-latest
steps:
- uses: greenbone/actions/setup-github-user@v2
with:
user: ${{ vars.user }}
mail: ${{ vars.mail }}
token: ${{ secrets.TOKEN }}

```

## Action Configuration

|Input Variable|Description| |
|--------------|-----------|-|
| user | GitHub user name on behalf of whom the actions will be executed. | Required |
| mail | Mail address for the given GitHub user. | Required |
| token | The GitHub user's token (PAT) | Optional (default: `${{ github.token }}`) |
| repository | GitHub repository to use | Optional (default: `${{ github.repository }}`) |
7 changes: 5 additions & 2 deletions set-github-user/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ inputs:
required: true
token:
description: "The GitHub user's token (PAT)"
required: true
default: ${{ github.token }}
repository:
description: "GitHub repository to use"
default: ${{ github.repository }}

runs:
using: "composite"
Expand All @@ -26,5 +29,5 @@ runs:
run: |
git config --global user.name "${{ inputs.user }}"
git config --global user.email "${{ inputs.mail }}"
git remote set-url origin https://${{ inputs.token }}@github.com/${{ github.repository }}
git remote set-url origin https://${{ inputs.token }}@github.com/${{ inputs.repository }}
shell: bash

0 comments on commit 7637f1c

Please sign in to comment.