Github - GradedJestRisk/cicd-training GitHub Wiki
Generate SSH key
ssh-keygen -t rsa -b 4096 -C $COMMENT -f $KEY_FILE_PREFIX
I suggest, to revoke on a fine-grain basis, to create one key :
- per Github account;
- per laptop.
I suggest
- as $COMMENT:
$GITHUB_USER_IDENTIFIER@$LAPTOP_DESCRIPTION
- as $KEY_FILE_PREFIX
id_rsa-$COMMENT
It will generate:
- public key as $KEY_FILE_PREFIX.pub
- private key as $KEY_FILE_PREFIX (no extension)
Add public key to Github (UI)
Add private key to agent
ssh-add $KEY_FILE_PREFIX
git clone [email protected]:$USER_IDENTIFIER/$REPOSITORY_NAME.git
Some organizations doesn't allow SSH, so you should use https
.
To clone a public repository using https
git clone https://github.com/$USER_IDENTIFIER/$REPOSITORY_NAME.git
To clone a private repository using https
- create a PAT with repositoring cloning scope
- supply PAT in
clone
git clone https://$USER_IDENTIFIER:$PAT@github.com/$USER_IDENTIFIER/$REPOSITORY_NAME.git
Download file from repository with curl
curl https://raw.githubusercontent.com/<REPO>/<BRANCH>/<PATH> --output <LOCAL_FILE_NAME>
curl https://raw.githubusercontent.com/adroste/gitlab-clone-group/main/gitlab-clone-group.py --output gitlab-clone-group.py
Add link to
- a file
$FILE
- in a path
$PATH
- from a commit
$COMMIT_SHA
- to a line
$LINE
https://github.com/$OWNER/$REPOSITORY/blob/$COMMIT_SHA/$PATH/$FILE#L$LINE
All markdown files owned by me
owner:GradedJestRisk jq path:*.md
https://docs.github.com/en/search-github/github-code-search/understanding-github-code-search-syntax
To clone a repository, a PAT should have scopes :
- metadata
- content
Overwrite default permissions, to prevent merging with failing tests
name: automerge check
on:
pull_request:
types:
- labeled
check_suite:
types:
- completed
permissions:
contents: read
pull-requests: write
jobs:
automerge:
runs-on: ubuntu-latest
steps:
- name: automerge
uses: "pascalgn/[email protected]"
env:
GITHUB_TOKEN: "${{ secrets.PIX_SERVICE_ACTIONS_TOKEN }}"
GITHUB_TOKEN: "${{ github.token }}"
MERGE_LABELS: ":rocket: Ready to Merge"
MERGE_COMMIT_MESSAGE: "pull-request-title"
UPDATE_LABELS: ":rocket: Ready to Merge"