Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge from upstream #19

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ jobs:
checkout:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: navikt/github-app-token-generator@v1
id: get-token
with:
private-key: ${{ secrets.PRIVATE_KEY }}
app-id: ${{ secrets.APP_ID }}
private-key: "${{ secrets.PRIVATE_KEY }}"
app-id: "${{ secrets.APP_ID }}"

- name: Check out an other repo
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: owner/repo
token: ${{ steps.get-token.outputs.token }}
Expand All @@ -36,7 +36,7 @@ The installation ID that is used during the creation of the access token is crea
uses: navikt/github-app-token-generator@v1
id: get-token
with:
private-key: ${{ secrets.PRIVATE_KEY }}
app-id: ${{ secrets.APP_ID }}
private-key: "${{ secrets.PRIVATE_KEY }}"
app-id: "${{ secrets.APP_ID }}"
repo: some/repo
```
20 changes: 17 additions & 3 deletions get-installation-access-token.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
#!/bin/sh -e
export PRIVATE_KEY=${1:?Usage: ${0} <private-key> <app-id>}
export APP_ID=${2:?Usage: ${0} <private-key> <app-id>}

export PRIVATE_KEY="$1"
export APP_ID="$2"

if [ -z "$PRIVATE_KEY" ]; then
echo "Private key not specified."
echo "Usage: ${0} <private-key> <app-id>"
exit 1
fi

if [ -z "$APP_ID" ]; then
echo "Application ID not specified."
echo "Usage: ${0} <private-key> <app-id>"
exit 1
fi

repo=${GITHUB_REPOSITORY:?Missing required GITHUB_REPOSITORY environment variable}

[ -n "$INPUT_REPO" ] && repo="$INPUT_REPO"
Expand All @@ -25,4 +39,4 @@ if [ "$token" = "null" ]; then
exit 1
fi

echo "::set-output name=token::${token}"
echo "token=${token}" >> "$GITHUB_OUTPUT"