Skip to content

Commit

Permalink
feat: repository name scope (#6)
Browse files Browse the repository at this point in the history
* repository name

* small fix

* test

* test

* test

* test

* test

* test
  • Loading branch information
ostk0069 authored Jan 23, 2023
1 parent 17ac4fb commit eb55195
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ app_id|ID of the GitHub App|Yes|- |string
base64_private_key|Base64 encoded Private key of the GitHub App|Yes|- |string
env_name|Enable to Customize Token ENV Name|No|GITHUB_APP_TOKEN |string
installation_id|The ID of the installation for which the token will be requested (defaults to the ID of the repository's installation)|Yes|- |integer
repository_name|GitHub Repository Name|No|"" |string
## Resources
Expand Down
5 changes: 5 additions & 0 deletions src/commands/fetch-token.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ parameters:
type: string
default: GITHUB_APP_TOKEN
description: "Enable to Customize Token ENV Name"
repository_name:
type: string
default: ""
description: "GitHub Repository Name"
steps:
- jq/install
- run:
Expand All @@ -36,6 +40,7 @@ steps:
-H "Authorization: Bearer ${jwt}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/app/installations/<< parameters.installation_id >>/access_tokens" \
$([[ -n "<< parameters.repository_name >>" ]] && echo "-d '{"repository":"<< parameters.repository_name >>"}'" || echo "") \
| jq -r ".token"
)
echo "export << parameters.env_name >>=${installation_token}" >> $BASH_ENV

0 comments on commit eb55195

Please sign in to comment.