Access file from GitHub repo during deployment

I know this must exist but I’m having a difficult time finding it in the docs.

After a commit is made to our master branch I want to trigger CircleCI to deploy (easy). The deployment is this: I need it to take a file from the GitHub Repo that was just committed to and upload it to a Google Cloud Storage bucket.

The uploading to GCS is easy (and documented), I just can’t find out how to access the file in my GitHub repo from CircleCI. What am I missing here?

Hi @KidA001 ,

In order to make files in your repository available in your container on CircleCI, you will need to add the checkout stop to your job definition:

steps:
  - checkout

By default, this will place the repository in the ~/project directory on the container.
When uploading to GCS, you would need to specify the correct file path inside of this directory for the file you wish to upload.

You can also specify a specific directory to use by including the working_directory key for your job:

steps:
  - checkout
working_directory: ~/my-app

More information can be found on this page:

https://circleci.com/docs/2.0/configuration-reference/#lessjobnamegreater

Let me know if you have any more questions, or would like clarification on anything.

1 Like