How to contribute into google-stacks repo from Cloud Shell #

  1. Creating a personal access token. Minimum required scopes are repo, read:org, workflow. Save this generated personal token in safe place (you can use it for future cloud shell sessions)

  2. Login to github with gh tool using a generated personal token:

    gh auth login -h

    gh tool will ask you to select some options. Select next one:

    ? What is your preferred protocol for Git operations? HTTPS
    ? Authenticate Git with your GitHub credentials? Yes
    ? How would you like to authenticate GitHub CLI? Paste an authentication token

    Use gh tool as git credentials helper

    gh auth setup-git
  3. Configure git client

    Set git user name and email manually

    git config --global "<your_user_name>"
    git config --global "<your_user_email>"

    or use your Github user name and email as <your_github_username>

    git config --global "$(gh api | jq -crM '.login')"
    git config --global "$(echo "$(git config --global")"

    or use your current GCP user name and email

    git config --global "$(gcloud auth list --verbosity=none --filter=status:ACTIVE --format="json(account)" | jq -cMr '. | first | . account')"
    git config --global "$(echo "${USER/_/ }" | sed -e 's/^./\U&/g;  s/ ./\U&/g')"
  4. Before making changes create git branch

    git checkout -b <your_branch_name>

    Make your changes and commit them

    git add -A .
    git commit -m "<your_commit_message>"
  5. Create Github Pull Request

    gh pr create --title "<your_pr_title>" --body "<your_pr_description>"

    gh tool will ask you a question Where should we push the '<your_branch_name>' branch? select Create a fork of agilestacks/google-stacks. Calling gh pr create will create a fork repo in your Github account, push your branch changes and create a PR in agilestacks/google-stacks.