Skip to content
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
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,12 @@ git-xargs --github-org my-github-org \

When executing commands or scripts, `git-xargs` will register the following environment variables for use by commands or scripts based on the arguments and flags provided:

| Env var | Value
| ------------------ | ---------------------------
| `XARGS_DRY_RUN` | Whether the `--dry-run` flag was provided to `git-xargs`; options are `true`, `false`
| `XARGS_REPO_NAME` | Name of the target repository being processed
| `XARGS_REPO_OWNER` | Owner of the target repository being processed
| Env var | Value
| ---------------------- | ---------------------------
| `XARGS_DRY_RUN` | Whether the `--dry-run` flag was provided to `git-xargs`; options are `true`, `false`
| `XARGS_REPO_NAME` | Name of the target repository being processed
| `XARGS_REPO_OWNER` | Owner of the target repository being processed
| `XARGS_REPO_DIRECTORY` | Directory of the target repository being processed

## Debugging runtime errors

Expand Down
3 changes: 2 additions & 1 deletion data/test/_testscripts/test-env-vars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@

echo "XARGS_DRY_RUN=$XARGS_DRY_RUN"
echo "XARGS_REPO_NAME=$XARGS_REPO_NAME"
echo "XARGS_REPO_OWNER=$XARGS_REPO_OWNER"
echo "XARGS_REPO_OWNER=$XARGS_REPO_OWNER"
echo "XARGS_REPO_DIRECTORY=$XARGS_REPO_DIRECTORY"
1 change: 1 addition & 0 deletions repository/repo-operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ func executeCommandWithLogger(config *config.GitXargsConfig, repositoryDir strin
cmd.Env = append(cmd.Env, fmt.Sprintf("XARGS_DRY_RUN=%t", config.DryRun))
cmd.Env = append(cmd.Env, fmt.Sprintf("XARGS_REPO_NAME=%s", repo.GetName()))
cmd.Env = append(cmd.Env, fmt.Sprintf("XARGS_REPO_OWNER=%s", repo.GetOwner().GetLogin()))
cmd.Env = append(cmd.Env, fmt.Sprintf("XARGS_REPO_DIRECTORY=%s", repositoryDir))

logger.WithFields(logrus.Fields{
"Repo": repo.GetName(),
Expand Down