title: Is it possible to get $pwd value from Bazel .bzl rule?
body: <p>I am trying to get a value of the full current directory path from within .bzl rule. I have tried following:</p>
  
  <ol>
  <li><p><code>ctx.host_configuration.default_shell_env.PATH</code> returns <code>"/Users/[user_name]/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:...</code></p></li>
  <li><p><code>ctx.bin_dir.path</code> returns <code>bazel-out/local-fastbuild/bin</code></p></li>
  <li><code>pwd = ctx.expand_make_variables("cmd", "$$PWD", {})</code> returns string <code>$PWD</code> - I don't think this rule is helpful for me, but may be just using it wrong.</li>
  </ol>
  
  <p>What I need is the directory under which the cmd that runs Bazel .bzl rule is running. For example: <code>/Users/[user_name]/git/workspace/path/to/bazel/rule.bzl</code> or at least first part of the path prior to the WORKSPACE directory.</p>
  
  <p>I can't use <code>pwd</code> because I need this value before I call <code>ctx.actions.run_shell()</code></p>
  
  <p>Are there no attributes in Bazel configurations that hold this value?</p>