Skip to content

Commit

Permalink
feat(remote): replace env variable in include remote URL
Browse files Browse the repository at this point in the history
  • Loading branch information
vmaerten committed Apr 29, 2024
1 parent ddd9964 commit 90e8904
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion taskfile/node_http.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"io"
"net/http"
"net/url"
"os"
"path/filepath"
"time"

Expand All @@ -29,7 +30,8 @@ func NewHTTPNode(
opts ...NodeOption,
) (*HTTPNode, error) {
base := NewBaseNode(dir, opts...)
url, err := url.Parse(entrypoint)
entrypointWithEnv := os.ExpandEnv(entrypoint)
url, err := url.Parse(entrypointWithEnv)
if err != nil {
return nil, err
}
Expand Down
11 changes: 11 additions & 0 deletions website/docs/experiments/remote_taskfiles.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,17 @@ tasks:
and you run `task my-remote-namespace:hello`, it will print the text: "Hello
from the remote Taskfile!" to your console.

You can also reference environment variable in your URL to have authentication, for example :

```yaml
version: '3'
includes:
my-remote-namespace: https://${TOKEN}@raw.githubusercontent.com/my-org/my-repo/main/Taskfile.yml
```

`TOKEN=my-token task my-remote-namespace:hello` will be resolved by Task to `https://my-token@raw.githubusercontent.com/my-org/my-repo/main/Taskfile.yml`

## Security

Running commands from sources that you do not control is always a potential
Expand Down

0 comments on commit 90e8904

Please sign in to comment.