GitHub Commit

Commit allows you to commit the source code to a GitHub repository directly from the Draftbit builder interface.

Setup steps in GitHub

Create a repository

To commit the source code, you will have to Login into your GitHub account.

  • Initially, create a new repository from your GitHub account.
  • After logging in, click the + plus button in the top bar to open a dropdown menu.
  • In the dropdown menu, select New repository. This will open the Create a new Repository section.
  • In this section, enter the name of the repository. Add a description (optional).
  • Then, select the type of repository. GitHub offers two types of repositories: Public and Private. The source code under the Public repository is available to view to anyone.
  • Optionally, you can select any option under Initialize this repository.
  • Click Create repository.
900

Create a GitHub Token

The second step is to create a Personal Access Token. GitHub recommends using a personal access token instead of the password of the GitHub account when communicating with third-party services (in this case, Draftbit).

A personal access token can be invoked anytime by the GitHub account owner.

  • Click the avatar icon in your GitHub account to open a dropdown menu.
  • From the dropdown menu, select Settings.
  • On Settings page, from the left menu bar, go to Developer Settings. Under it, select Personal Access Token.
  • Select the Generate new token.
  • Add a reference to the app under Note.
  • Make sure to check everything under Select Scopes > repo. This will allow the access token to connect the repository with the Draftbit app.
  • On the next screen, the personal access token is shown. Do not close this window yet. In the next step, you will need this token to add to your Draftbit app.

📘

Revoke the personal access token

You can delete the personal access token from your GitHub account at any time. Do note that, once you delete the personal access token that is used in the Draftbit app, you will not be able to push changes to the repository.

Setup Steps in Draftbit

Now, you need to add the GitHub repo URL, the main branch name of the repository, and the personal access token in the Draftbit app.

  • Go to Project Settings > GitHub .
  • Add the repository URL, add the name of the branch and then add the personal access token (from the previous step).
  • To commit the source code of the Draftbit app to the GitHub repository, from the top bar, click the button Publish (You need to set your project live to activate this button).
  • Then in the dropdown under Github section enter a "commit" message. The commit message helps you recognize what changes of your app are being stored in the GitHub repository.
  • After adding the commit message, click the button Commit.

You can verify the changes pushed to the repository by going to the repository URL.

Once the GitHub repository and Draftbit app are connected, you can repeat the process of committing changes in your app.