Working with GitHub and ActiveState

By linking together GitHub and ActiveState, you can streamline your development and decrease the time needed to start working on your project, share your project and repo with others, or onboard new team members/employees.

If you intend on sharing your ActiveState project with others, make sure that the project is set to Public and not Private, or that those you want to share it with are already a part of your organization. Integrating your ActiveState project and your Github repo can be done at any time in your project’s development.

To link the account you will need an ActiveState project and an active Github account with a repository (repo) or branch you want to link to your project.

The following will show you how to get the most out of your ActiveState and GitHub accounts.

  1. Adding the link to your Github repo into your project settings.
  2. Linking your GitHub account to your ActiveState account
  3. Importing your project’s activestate.yaml file into your Github repo.
  4. Fetching your project requirements from GitHub

  1. Find the URL of the GitHub repo you want to connect to your ActiveState project.
  2. Log in to your ActiveState Platform account.
  3. Go to the Project Settings tab of your project.
  4. In the “GitHub Repo URL” field paste the link to your repo.

alt_text

  1. Click Save Changes.

Now anyone who activates that project on their machine using the state activate <orgname>/<username> command will also pull that git repo into their project folder. One command will fetch both your repo and runtime.

Your GitHub repo will only be pulled down to your project folder on the initial activation of your project. To update your project use the state pull command, and to update your repo use the git pull command. Git commands will work in your activated state even if there is no Git client on your local machine, as your project will have a Git client included.

Linking your GitHub account to your ActiveState account

After adding the link to your GitHub repo, you can link or unlink your ActiveState account with your GitHub repository at any time. Currently a GitHub account and only be linked to one ActiveState account at a time.

To link your accounts while logged in to the Platform

  1. Go to the drop down displaying your user name.
  2. Click Account Settings > Linked Accounts.
  3. Click the Link your Github Account.

alt_text

Your ActiveState and GitHub accounts are now successfully linked. Checking out the project will also pull down the linked repo. Pushing and pulling changes to the repo or your project can be done using the git push and git pull and state push and state pull commands respectively.

To unlink your accounts at any time follow the steps above and click the Unlink your GitHub account. After unlinking, the GitHub account can now be linked to a different ActiveState account that has added the GitHub repo URL in the project settings.

Adding your activestate.yaml file to your GutHub repo

  1. Open your local ActiveState project folder to find the activestate.yaml file.
  2. Go to the Git repo you want to connect to your ActiveState project and import the activestate.yaml from your project folder into the repo.

alt_text

And you’re done. Now anyone who clones that repo can activate the runtime by opening a command terminal, going to the cloned working directory, and entering state activate to activate the runtime.

To update your project use the state pull command and to update your repo use the git pull command in your command terminal. Git commands will work in your activated state even if there is no Git client on your local machine, as your project will have a Git client included. Now other members of your team only need to clone the repo to begin working with the ActiveState project directly.

Fetching your project requirements from GitHub

When creating a new Python, Perl, or Ruby project, you can directly import your project requirements from an existing GitHub repository. ActiveState will only scan the root directory for a valid requirements file and will not store ANY other data from the linked repo.

To import an existing requirements file from your GitHub repo and use it to create an ActiveState project

  1. From the Projects tab, click the + New Project.
  2. If you have linked your ActiveState account with an existing GitHub repo you will see a button to Scan a Repository. If you have not previously linked a GitHub repo to your ActiveState account, enter the URL into the field provided and follow the prompts to complete the link.

alt_text

  1. After selecting the repo containing your project’s requirements file, click Scan repo. The requirements file must be in the root folder of the repo in order to be successfully detected by ActiveState.

alt_text

  1. Once the scan is successful, you will see a “success” notification as well as a summary of which project requirements were found in the GitHub repo. Click Continue to complete the import and finish creating your project.

alt_text

Your new project will now have all packages, with correct version numbers as specified in the requirements file, included prior to building.

If you received an error when scanning the repo, make sure the repo contains a valid requirements file (information on requirements files can be found here) and existing language files for the scanner to detect.


Where do I go from here?

After linking your ActiveState project to an existing Github repo you can integrate your IDE with your ActiveState runtime.