Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
# Conflicts:
#	dist/index.js
#	package-lock.json
#	package.json
#	src/github_app.ts
  • Loading branch information
glenn-kim committed Jul 4, 2023
2 parents 15dcf46 + d6c057a commit 4c00bcd
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ We use organization install to access private repositories in organization.
# - `contents-ro` : git checkout permission
# - `contents-rw` : git commit and permission, it contains contents-ro also
# - `actions-rw` : github actions(workflow) read and execute permission
# - `checks-rw` : github checks read and write permission
# - `administration-ro` : github administration read only permission
# - `pull-requests-rw` : github pull-requests read and write permission
# - `issues-ro` : github issues read only permission
# - `issues-rw` : github issues read and write permission
#
# default "contents-ro", only checkout
app_permission: "contents-ro"
Expand Down
3 changes: 3 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ inputs:
- `actions-rw` : github actions(workflow) read and execute permission
- `checks-rw` : github checks read and write permission
- `administration-ro` : github administration read only permission
- `pull-requests-rw` : github pull-requests read and write permission
- `issues-ro` : github issues read only permission
- `issues-rw` : github issues read and write permission
default: "contents-ro"
checkout:
description: |
Expand Down
12 changes: 10 additions & 2 deletions src/github_app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ type Permission = {
actions: "write" | undefined;
checks: "write" | undefined;
administration: "read" | undefined;
pull_requests: "write" | undefined;
issues: "read" | "write" | undefined;
};
type Input = {
appId: string;
Expand Down Expand Up @@ -50,7 +52,13 @@ export const prepareInput = (): Input => {
: undefined,
actions: hasPermission("actions-rw") ? "write" : undefined,
checks: hasPermission("checks-rw") ? "write" : undefined,
administration: hasPermission("administration-ro") ? "read" : undefined
administration: hasPermission("administration-ro") ? "read" : undefined,
pull_requests: hasPermission("pull-requests-rw") ? "write" : undefined,
issues: hasPermission("issues-rw")
? "write"
: hasPermission("issues-ro")
? "read"
: undefined,
};

return {
Expand All @@ -68,7 +76,7 @@ export const installationToken = async (input: Input) => {
request: request.defaults({
// GITHUB_API_URL is part of GitHub Actions' built-in environment variables.
// See https://docs.github.com/en/actions/reference/environment-variables#default-environment-variables.
baseUrl: env.GITHUB_API_URL || "https://api.github.com"
baseUrl: env.GITHUB_API_URL
})
});

Expand Down

0 comments on commit 4c00bcd

Please sign in to comment.