Source

Implementation

Provisioner Type

Resource Type

Flavor

Tool

dns-in-codespace

Prerequisites for dns-in-codespace:

  • Have gh installed, this provisioner is using the GitHub CLI to get the name of the current GitHub Codespace.
Get the forwarded port URL in current GitHub Codespace on port 80

type: dns
expected_outputs:
  - host
  - url

10-dns-in-codespace.provisioners.yaml (view on GitHub) :

- uri: cmd://bash#dns-in-codespace
  type: dns
  description: Get the forwarded port URL in current GitHub Codespace on port 80
  args:
  - -c
  - |
    set -eu -o pipefail
    CODESPACE_NAME=$(gh codespace view --json name | jq -r .name)
    HOST=${CODESPACE_NAME}-80.app.github.dev
    URL=https://${HOST}
    OUTPUTS='{"resource_outputs":{"host":"%s", "url":"%s"},"manifests":[]}'
    printf "$OUTPUTS" "$HOST" "$URL"    
  expected_outputs:
    - host
    - url