-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update repository workflows and Dockerfile
- Loading branch information
Showing
7 changed files
with
150 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM mcr.microsoft.com/devcontainers/base:focal | ||
|
||
# Install Node.js using apt-get | ||
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ | ||
&& apt-get -y install --no-install-recommends nodejs npm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// For format details, see https://aka.ms/devcontainer.json. For config options, see the | ||
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu | ||
{ | ||
"name": "devcontainer", | ||
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile | ||
"dockerFile": "Dockerfile", | ||
"features": { | ||
"ghcr.io/devcontainers/features/github-cli:1": {}, | ||
"ghcr.io/devcontainers/features/azure-cli:1": {}, | ||
"ghcr.io/devcontainers-contrib/features/powershell:1": {}, | ||
}, | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"GitHub.copilot", | ||
"ms-vscode.azurecli", | ||
"ms-vscode.PowerShell" | ||
], | ||
"settings": { | ||
"terminal.integrated.shell.linux": "/usr/local/lib/pwsh", | ||
"powershell.powerShellAdditionalExePaths": { | ||
"pwsh": "/usr/local/lib/pwsh/pwsh" | ||
}, | ||
"editor.trimAutoWhitespace": true, | ||
"files.trimTrailingWhitespace": true | ||
} | ||
} | ||
}, | ||
|
||
// Use 'forwardPorts' to make a list of ports inside the container available locally. | ||
// "forwardPorts": [], | ||
|
||
// Use 'postCreateCommand' to run commands after the container is created. | ||
// "postCreateCommand": "pwsh -Command { ./devcontainer/postCreateCommand.ps1; }" | ||
|
||
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. | ||
// "remoteUser": "root" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#!/bin/bash | ||
|
||
# Generate JWT for Github App | ||
# | ||
# Found at https://gist.github.com/carestad/bed9cb8140d28fe05e67e15f667d98ad from Alexander Karlstad: | ||
# | ||
# Inspired by implementation by Will Haley at: | ||
# http://willhaley.com/blog/generate-jwt-with-bash/ | ||
# From: | ||
# https://stackoverflow.com/questions/46657001/how-do-you-create-an-rs256-jwt-assertion-with-bash-shell-scripting | ||
|
||
thisdir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
set -o pipefail | ||
|
||
# Change these variables: | ||
app_id=$1 | ||
app_private_key="$2" | ||
|
||
# Shared content to use as template | ||
header='{ | ||
"alg": "RS256", | ||
"typ": "JWT" | ||
}' | ||
payload_template='{}' | ||
|
||
build_payload() { | ||
jq -c \ | ||
--arg iat_str "$(date +%s)" \ | ||
--arg app_id "${app_id}" \ | ||
' | ||
($iat_str | tonumber) as $iat | ||
| .iat = $iat | ||
| .exp = ($iat + 300) | ||
| .iss = ($app_id | tonumber) | ||
' <<< "${payload_template}" | tr -d '\n' | ||
} | ||
|
||
b64enc() { openssl enc -base64 -A | tr '+/' '-_' | tr -d '='; } | ||
json() { jq -c . | LC_CTYPE=C tr -d '\n'; } | ||
rs256_sign() { openssl dgst -binary -sha256 -sign <(printf '%s\n' "$1"); } | ||
|
||
sign() { | ||
local algo payload sig | ||
algo=${1:-RS256}; algo=${algo^^} | ||
payload=$(build_payload) || return | ||
signed_content="$(json <<<"$header" | b64enc).$(json <<<"$payload" | b64enc)" | ||
sig=$(printf %s "$signed_content" | rs256_sign "$app_private_key" | b64enc) | ||
printf '%s.%s\n' "${signed_content}" "${sig}" | ||
} | ||
|
||
sign |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters