# Get GitHub Path

**URL:** https://drone.discourse.group/t/get-github-path/3940
**Category:** Drone Support
**Created:** [May 7, 2019, 2:53pm UTC](https://drone.discourse.group/t/get-github-path/3940 "2019-05-07T14:53:43Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Rizbe](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/rizbe/32/4986_2.png) [@Rizbe](https://drone.discourse.group/u/Rizbe)
#### Post date: [May 7, 2019, 2:53pm UTC](https://drone.discourse.group/t/get-github-path/3940/1 "2019-05-07T14:53:43Z")

</div>

Looking to Automate Terraform using Done. One of the issues I have run into is that I don’t see a way to get the GitHub path of the files changed

For example:

repo:rds/main.tf  
repo:es/main.tf

Depending on what file was changed, would like to cd into that path and run Terraform.

---

<div class="post-metadata">

### Author: ![kodelint](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/kodelint/32/4886_2.png) [@kodelint](https://drone.discourse.group/u/kodelint)
#### Post date: [June 10, 2020, 11:45pm UTC](https://drone.discourse.group/t/get-github-path/3940/2 "2020-06-10T23:45:40Z")

</div>

@Rizbe I have done something similar but instead of asking drone about the changed files I used git to give me that information.

```auto
---
kind: pipeline
type: docker
name: terraform-run-my-repo

workspace:
  path: my-repo
steps:
- name: validate
  image: docker-searchops-images-release.dr.corp.adobe.com/ci-runner:v1.13
  pull: true
  environment:
    AWS_ACCESS_KEY_ID:
      from_secret: AWS_ACCESS_KEY_ID
    AWS_SECRET_ACCESS_KEY:
      from_secret: STG_AWS_SECRET_ACCESS_KEY
    GIT_TOKEN:
      from_secret: GIT_TOKEN

  commands:
    - cd my-repo
    - git fetch --no-tags origin +${DRONE_COMMIT_REF}
    - git checkout -qf FETCH_HEAD
    - ci plan SecurityGroups
  when:
    event:
    - pull_request

```

The `script` which does that for me is the `ci` script which has 2 fucntions

```auto
get_commited_files() {
    git diff-tree --no-commit-id --name-only --diff-filter=d -r ${DRONE_COMMIT_HASH} > /drone/src/.commited_files.tmp
}

get_commited_files_after_merge() {
    git log -m -1 --name-only --diff-filter=d --pretty="format:" ${DRONE_COMMIT_HASH} > /drone/src/.commited_files.tmp
}

```
