diff --git a/content/actions/guides/index.md b/content/actions/guides/index.md index 723602026e70..7f7c0b84bb4c 100644 --- a/content/actions/guides/index.md +++ b/content/actions/guides/index.md @@ -72,7 +72,6 @@ includeGuides: - /actions/guides/commenting-on-an-issue-when-a-label-is-added - /actions/guides/moving-assigned-issues-on-project-boards - /actions/guides/removing-a-label-when-a-card-is-added-to-a-project-board-column - - /actions/guides/managing-github-actions-with-github-cli - /code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/automating-dependabot-with-github-actions - /code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/keeping-your-actions-up-to-date-with-dependabot children: @@ -109,6 +108,6 @@ children: - /commenting-on-an-issue-when-a-label-is-added - /moving-assigned-issues-on-project-boards - /removing-a-label-when-a-card-is-added-to-a-project-board-column - - /managing-github-actions-with-github-cli + - /using-github-cli-in-workflows --- diff --git a/content/actions/guides/managing-github-actions-with-github-cli.md b/content/actions/guides/managing-github-actions-with-github-cli.md deleted file mode 100644 index 5cfbd504a883..000000000000 --- a/content/actions/guides/managing-github-actions-with-github-cli.md +++ /dev/null @@ -1,38 +0,0 @@ ---- -title: Managing GitHub Actions with GitHub CLI -intro: 'You can use {% data variables.product.prodname_cli %} to interact with {% data variables.product.prodname_actions %}.' -product: '{% data reusables.gated-features.actions %}' -versions: - fpt: '*' - ghes: '*' - ghae: '*' -type: overview -topics: - - Workflows -shortTitle: GitHub CLI & GitHub Actions ---- - -{% data reusables.actions.enterprise-beta %} -{% data reusables.actions.enterprise-github-hosted-runners %} -{% data reusables.actions.ae-beta %} - -## Setting up {% data variables.product.prodname_cli %} - -{% data reusables.cli.download-update-cli %} {% data reusables.cli.actions-cli-version %} {% data reusables.cli.cli-manual %} - -{% data reusables.cli.cli-auth %} - -{% data reusables.cli.cli-repo %} - -## Managing {% data variables.product.prodname_actions %} with {% data variables.product.prodname_cli %} - -To view all available commands related to {% data variables.product.prodname_actions %}, run `gh actions`. - -For more information on using commands in specific scenarios, see the following procedures: - -- "[Re-running a workflow](/actions/managing-workflow-runs/re-running-a-workflow#re-run-a-workflow-through-github-cli)" -- "[Manually running a workflow](/actions/managing-workflow-runs/manually-running-a-workflow#running-a-workflow-using-github-cli)" -- "[Downloading workflow artifacts](/actions/managing-workflow-runs/downloading-workflow-artifacts#download-artifacts-through-github-cli)" -- "[Using workflow run logs](/actions/managing-workflow-runs/using-workflow-run-logs#viewing-logs-through-github-cli)" -- "[Viewing workflow run history](/actions/managing-workflow-runs/viewing-workflow-run-history#viewing-workflow-run-history-with-github-cli)"{% ifversion fpt or ghes > 2.22 or ghae %} -- "[Disabling and enabling a workflow](/actions/managing-workflow-runs/disabling-and-enabling-a-workflow#disabling-and-enabling-workflows-through-github-cli)"{% endif %} diff --git a/content/actions/guides/using-github-cli-in-workflows.md b/content/actions/guides/using-github-cli-in-workflows.md new file mode 100644 index 000000000000..225097ac6567 --- /dev/null +++ b/content/actions/guides/using-github-cli-in-workflows.md @@ -0,0 +1,69 @@ +--- +title: Using GitHub CLI in workflows +shortTitle: GitHub CLI in workflows +intro: 'You can script with {% data variables.product.prodname_cli %} in {% data variables.product.prodname_actions %} workflows.' +versions: + fpt: '*' + ghes: '>=2.22' + ghae: '*' +topics: + - CLI + - Workflows +type: how_to +--- + +{% data reusables.cli.cli-learn-more %} + +{% data variables.product.prodname_cli %} is preinstalled on all {% data variables.product.prodname_dotcom %}-hosted runners. For each step that uses {% data variables.product.prodname_cli %}, you must set an environment variable called `GITHUB_TOKEN` to a token with the required scopes. + +You can execute any {% data variables.product.prodname_cli %} command. For example, this workflow uses the `gh issue comment` subcommand to add a comment when an issue is opened. + +```yaml{:copy} +name: Comment when opened +on: + issues: + types: + - opened +jobs: + comment: + runs-on: ubuntu-latest + steps: + - run: gh issue comment $ISSUE --body "Thank you for opening this issue!" + env: + GITHUB_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %} + ISSUE: {% raw %}${{ github.event.issue.html_url }}{% endraw %} +``` + +You can also execute API calls through {% data variables.product.prodname_cli %}. For example, this workflow first uses the `gh api` subcommand to query the GraphQL API and parse the result. Then it stores the result in an environment variable that it can access in a later step. In the second step, it uses the `gh issue create` subcommand to create an issue containing the information from the first step. + +```yaml{:copy} +name: Report remaining open issues +on: + schedule: + # Daily at 8:20 UTC + - cron: '20 8 * * *' +jobs: + track_pr: + runs-on: ubuntu-latest + steps: + - run: | + numOpenIssues="$(gh api graphql -F owner=$OWNER -F name=$REPO -f query=' + query($name: String!, $owner: String!) { + repository(owner: $owner, name: $name) { + issues(states:OPEN){ + totalCount + } + } + } + ' --jq '.data.repository.issues.totalCount')" + + echo 'NUM_OPEN_ISSUES='$numOpenIssues >> $GITHUB_ENV + env: + GITHUB_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %} + OWNER: {% raw %}${{ github.repository_owner }}{% endraw %} + REPO: {% raw %}${{ github.event.repository.name }}{% endraw %} + - run: | + gh issue create --title "Issue report" --body "$NUM_OPEN_ISSUES issues remaining" --repo $GITHUB_REPOSITORY + env: + GITHUB_TOKEN: {% raw %}${{ secrets.GITHUB_TOKEN }}{% endraw %} +``` diff --git a/content/actions/managing-workflow-runs/disabling-and-enabling-a-workflow.md b/content/actions/managing-workflow-runs/disabling-and-enabling-a-workflow.md index 1413d3d6deae..52156410910c 100644 --- a/content/actions/managing-workflow-runs/disabling-and-enabling-a-workflow.md +++ b/content/actions/managing-workflow-runs/disabling-and-enabling-a-workflow.md @@ -30,7 +30,7 @@ Temporarily disabling a workflow can be useful in many scenarios. These are a fe You can also disable and enable a workflow using the REST API. For more information, see the "[Actions REST API](/rest/reference/actions#workflows)." -### Disabling a workflow +## Disabling a workflow {% include tool-switcher %} @@ -51,9 +51,7 @@ The disabled workflow is marked {% octicon "stop" aria-label="The stop icon" %} {% cli %} -{% data reusables.cli.download-cli %} - -{% data reusables.actions.actions-cli %} +{% data reusables.cli.cli-learn-more %} To disable a workflow, use the `workflow disable` subcommand. Replace `workflow` with either the name, ID, or file name of the workflow you want to disable. For example, `"Link Checker"`, `1234567`, or `"link-check-test.yml"`. If you don't specify a workflow, {% data variables.product.prodname_cli %} returns an interactive menu for you to choose a workflow. @@ -63,7 +61,7 @@ gh workflow disable workflow {% endcli %} -### Enabling a workflow +## Enabling a workflow {% include tool-switcher %} @@ -82,8 +80,6 @@ You can re-enable a workflow that was previously disabled. {% cli %} -{% data reusables.actions.actions-cli %} - To enable a workflow, use the `workflow enable` subcommand. Replace `workflow` with either the name, ID, or file name of the workflow you want to enable. For example, `"Link Checker"`, `1234567`, or `"link-check-test.yml"`. If you don't specify a workflow, {% data variables.product.prodname_cli %} returns an interactive menu for you to choose a workflow. ```shell diff --git a/content/actions/managing-workflow-runs/downloading-workflow-artifacts.md b/content/actions/managing-workflow-runs/downloading-workflow-artifacts.md index 124af8ebb4e2..5330e6bd3d9b 100644 --- a/content/actions/managing-workflow-runs/downloading-workflow-artifacts.md +++ b/content/actions/managing-workflow-runs/downloading-workflow-artifacts.md @@ -37,9 +37,7 @@ shortTitle: Download workflow artifacts {% cli %} -{% data reusables.cli.download-cli %} - -{% data reusables.actions.actions-cli %} +{% data reusables.cli.cli-learn-more %} {% data variables.product.prodname_cli %} will download each artifact into separate directories based on the artifact name. If only a single artifact is specified, it will be extracted into the current directory. diff --git a/content/actions/managing-workflow-runs/manually-running-a-workflow.md b/content/actions/managing-workflow-runs/manually-running-a-workflow.md index 26f92a7640db..d7f3c7d0cbfb 100644 --- a/content/actions/managing-workflow-runs/manually-running-a-workflow.md +++ b/content/actions/managing-workflow-runs/manually-running-a-workflow.md @@ -19,7 +19,7 @@ To run a workflow manually, the workflow must be configured to run on the `workf {% data reusables.repositories.permissions-statement-write %} -### Running a workflow +## Running a workflow {% include tool-switcher %} @@ -38,9 +38,7 @@ To run a workflow manually, the workflow must be configured to run on the `workf {% cli %} -{% data reusables.cli.download-cli %} - -{% data reusables.actions.actions-cli %} +{% data reusables.cli.cli-learn-more %} To run a workflow, use the `workflow run` subcommand. Replace the `workflow` parameter with either the name, ID, or file name of the workflow you want to run. For example, `"Link Checker"`, `1234567`, or `"link-check-test.yml"`. If you don't specify a workflow, {% data variables.product.prodname_cli %} returns an interactive menu for you to choose a workflow. @@ -74,7 +72,7 @@ gh run watch {% endcli %} -### Running a workflow using the REST API +## Running a workflow using the REST API When using the REST API, you configure the `inputs` and `ref` as request body parameters. If the inputs are omitted, the default values defined in the workflow file are used. diff --git a/content/actions/managing-workflow-runs/re-running-a-workflow.md b/content/actions/managing-workflow-runs/re-running-a-workflow.md index d6905e17095d..e69a020338a9 100644 --- a/content/actions/managing-workflow-runs/re-running-a-workflow.md +++ b/content/actions/managing-workflow-runs/re-running-a-workflow.md @@ -29,9 +29,7 @@ Re-running a workflow uses the same `GITHUB_SHA` (commit SHA) and `GITHUB_REF` ( {% cli %} -{% data reusables.cli.download-cli %} - -{% data reusables.actions.actions-cli %} +{% data reusables.cli.cli-learn-more %} To re-run a failed workflow run, use the `run rerun` subcommand. Replace `run-id` with the ID of the failed run that you want to re-run. If you don't specify a `run-id`, {% data variables.product.prodname_cli %} returns an interactive menu for you to choose a recent failed run. diff --git a/content/actions/managing-workflow-runs/using-workflow-run-logs.md b/content/actions/managing-workflow-runs/using-workflow-run-logs.md index 11b15bd0b149..ce72a76f6ac7 100644 --- a/content/actions/managing-workflow-runs/using-workflow-run-logs.md +++ b/content/actions/managing-workflow-runs/using-workflow-run-logs.md @@ -112,7 +112,7 @@ After the logs have been deleted, the **Delete all logs** button is removed to i ## Viewing logs with {% data variables.product.prodname_cli %} -{% data reusables.actions.actions-cli %} +{% data reusables.cli.cli-learn-more %} To view the log for a specific job, use the `run view` subcommand. Replace `run-id` with the ID of run that you want to view logs for. {% data variables.product.prodname_cli %} returns an interactive menu for you to choose a job from the run. If you don't specify `run-id`, {% data variables.product.prodname_cli %} returns an interactive menu for you to choose a recent run, and then returns another interactive menu for you to choose a job from the run. diff --git a/content/actions/managing-workflow-runs/viewing-workflow-run-history.md b/content/actions/managing-workflow-runs/viewing-workflow-run-history.md index afee223083cf..8bc5bc51bdc9 100644 --- a/content/actions/managing-workflow-runs/viewing-workflow-run-history.md +++ b/content/actions/managing-workflow-runs/viewing-workflow-run-history.md @@ -28,9 +28,7 @@ shortTitle: View workflow run history {% cli %} -{% data reusables.cli.download-cli %} - -{% data reusables.actions.actions-cli %} +{% data reusables.cli.cli-learn-more %} ### Viewing recent workflow runs diff --git a/content/actions/reference/encrypted-secrets.md b/content/actions/reference/encrypted-secrets.md index f0e6fff9c2cc..0b0d1fae48ec 100644 --- a/content/actions/reference/encrypted-secrets.md +++ b/content/actions/reference/encrypted-secrets.md @@ -58,10 +58,20 @@ You can also manage secrets using the REST API. For more information, see "[Secr When generating credentials, we recommend that you grant the minimum permissions possible. For example, instead of using personal credentials, use [deploy keys](/developers/overview/managing-deploy-keys#deploy-keys) or a service account. Consider granting read-only permissions if that's all that is needed, and limit access as much as possible. When generating a personal access token (PAT), select the fewest scopes necessary. +{% note %} + +**Note:** You can use the REST API to manage secrets. For more information, see "[{% data variables.product.prodname_actions %} secrets API](/rest/reference/actions#secrets)." + +{% endnote %} + ## Creating encrypted secrets for a repository {% data reusables.github-actions.permissions-statement-secrets-repository %} +{% include tool-switcher %} + +{% webui %} + {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.github-actions.sidebar-secret %} @@ -72,11 +82,27 @@ When generating credentials, we recommend that you grant the minimum permissions If your repository {% ifversion fpt or ghes > 3.0 or ghae %}has environment secrets or {% endif %}can access secrets from the parent organization, then those secrets are also listed on this page. -{% note %} +{% endwebui %} -**Note:** Users with collaborator access can use the REST API to manage secrets for a repository. For more information, see "[{% data variables.product.prodname_actions %} secrets API](/rest/reference/actions#secrets)." +{% cli %} -{% endnote %} +{% data reusables.cli.cli-learn-more %} + +To add a repository secret, use the `gh secret set` subcommand. Replace `secret-name` with the name of your secret. + +```shell +gh secret set secret-name +``` + +The CLI will prompt you to enter a secret value. Alternatively, you can read the value of the secret from a file. + +```shell +gh secret set secret-name < secret.txt +``` + +To list all secrets for the repository, use the `gh secret list` subcommand. + +{% endcli %} {% ifversion fpt or ghes > 3.0 or ghae %} @@ -84,14 +110,37 @@ If your repository {% ifversion fpt or ghes > 3.0 or ghae %}has environment secr {% data reusables.github-actions.permissions-statement-secrets-environment %} +{% include tool-switcher %} + +{% webui %} + {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.github-actions.sidebar-environment %} 1. Click on the environment that you want to add a secret to. -1. Under **Environment secrets**, click **Add secret**. -1. Type a name for your secret in the **Name** input box. -1. Enter the value for your secret. -1. Click **Add secret**. +2. Under **Environment secrets**, click **Add secret**. +3. Type a name for your secret in the **Name** input box. +4. Enter the value for your secret. +5. Click **Add secret**. + +{% endwebui %} + +{% cli %} + +To add a secret for an environment, use the `gh secret set` subcommand with the `--env` or `-e` flag followed by the environment name. + +```shell +gh secret set --env environment-name secret-name +``` + +To list all secrets for an environment, use the `gh secret list` subcommand with the `--env` or `-e` flag followed by the environment name. + +```shell +gh secret list --env environment-name +``` + +{% endcli %} + {% endif %} ## Creating encrypted secrets for an organization @@ -100,6 +149,10 @@ When creating a secret in an organization, you can use a policy to limit which r {% data reusables.github-actions.permissions-statement-secrets-organization %} +{% include tool-switcher %} + +{% webui %} + {% data reusables.organizations.navigate-to-org %} {% data reusables.organizations.org_settings %} {% data reusables.github-actions.sidebar-secret %} @@ -109,6 +162,46 @@ When creating a secret in an organization, you can use a policy to limit which r 1. From the **Repository access** dropdown list, choose an access policy. 1. Click **Add secret**. +{% endwebui %} + +{% cli %} + +{% note %} + +**Note:** By default, {% data variables.product.prodname_cli %} authenticates with the `repo` and `read:org` scopes. To manage organization secrets, you must additionally authorize the `admin:org` scope. + +``` +gh auth login --scopes "admin:org" +``` + +{% endnote %} + +To add a secret for an organization, use the `gh secret set` subcommand with the `--org` or `-o` flag followed by the organization name. + +```shell +gh secret set --org organization-name secret-name +``` + +By default, the secret is only available to private repositories. To specify that the secret should be available to all repositories within the organization, use the `--visibility` or `-v` flag. + +```shell +gh secret set --org organization-name secret-name --visibility all +``` + +To specify that the secret should be available to selected repositories within the organization, use the `--repos` or `-r` flag. + +```shell +gh secret set --org organization-name secret-name --repos repo-name-1,repo-name-2" +``` + +To list all secrets for an organization, use the `gh secret list` subcommand with the `--org` or `-o` flag followed by the organization name. + +```shell +gh secret list --org organization-name +``` + +{% endcli %} + ## Reviewing access to organization-level secrets You can check which access policies are being applied to a secret in your organization. diff --git a/content/get-started/getting-started-with-git/about-remote-repositories.md b/content/get-started/getting-started-with-git/about-remote-repositories.md index eb6c1fc60b95..130daa04d044 100644 --- a/content/get-started/getting-started-with-git/about-remote-repositories.md +++ b/content/get-started/getting-started-with-git/about-remote-repositories.md @@ -84,7 +84,7 @@ When you `git clone`, `git fetch`, `git pull`, or `git push` to a remote reposit ## Cloning with {% data variables.product.prodname_cli %} -You can also install {% data variables.product.prodname_cli %} to use {% data variables.product.product_name %} workflows in your terminal. For more information, the [{% data variables.product.prodname_cli %}](https://cli.github.com/manual/) documentation. +You can also install {% data variables.product.prodname_cli %} to use {% data variables.product.product_name %} workflows in your terminal. For more information, see "[About {% data variables.product.prodname_cli %}](/github-cli/github-cli/about-github-cli)." {% endif %} diff --git a/content/get-started/getting-started-with-git/caching-your-github-credentials-in-git.md b/content/get-started/getting-started-with-git/caching-your-github-credentials-in-git.md index c334bebc3e79..4c9689bd749a 100644 --- a/content/get-started/getting-started-with-git/caching-your-github-credentials-in-git.md +++ b/content/get-started/getting-started-with-git/caching-your-github-credentials-in-git.md @@ -7,7 +7,7 @@ redirect_from: - /github/using-git/caching-your-github-credentials-in-git - /github/getting-started-with-github/caching-your-github-credentials-in-git - /github/getting-started-with-github/getting-started-with-git/caching-your-github-credentials-in-git -intro: 'If you''re [cloning {% data variables.product.product_name %} repositories using HTTPS](/github/getting-started-with-github/about-remote-repositories), we recommend you use Git Credential Manager Core (GCM Core) to remember your credentials.' +intro: 'If you''re [cloning {% data variables.product.product_name %} repositories using HTTPS](/github/getting-started-with-github/about-remote-repositories), we recommend you use {% data variables.product.prodname_cli %} or Git Credential Manager Core (GCM Core) to remember your credentials.' versions: fpt: '*' ghes: '*' @@ -21,7 +21,20 @@ shortTitle: Caching credentials {% endtip %} -[Git Credential Manager Core](https://github.com/microsoft/Git-Credential-Manager-Core) (GCM Core) is our recommended way to store your credentials securely and connect to GitHub over HTTPS. With GCM Core, you don't have to manually [create and store a PAT](/github/authenticating-to-github/creating-a-personal-access-token), as GCM Core manages authentication on your behalf, including 2FA (two-factor authentication). +## {% data variables.product.prodname_cli %} + +{% data variables.product.prodname_cli %} will automatically store your Git credentials for you when you choose `HTTPS` as your preferred protocol for Git operations and answer "yes" to the prompt asking if you would like to authenticate to Git with your {% data variables.product.product_name %} credentials. + +1. [Install](https://github.com/cli/cli#installation) {% data variables.product.prodname_cli %} on macOS, Windows, or Linux. +2. In the command line, enter `gh auth login`, then follow the prompts. + - When prompted for your preferred protocol for Git operations, select `HTTPS`. + - When asked if you would like to authenticate to Git with your {% data variables.product.product_name %} credentials, enter `Y`. + +For more information about authenticating with {% data variables.product.prodname_cli %}, see [`gh auth login`](https://cli.github.com/manual/gh_auth_login). + +## Git Credential Manager Core + +[Git Credential Manager Core](https://github.com/microsoft/Git-Credential-Manager-Core) (GCM Core) is another way to store your credentials securely and connect to GitHub over HTTPS. With GCM Core, you don't have to manually [create and store a PAT](/github/authenticating-to-github/creating-a-personal-access-token), as GCM Core manages authentication on your behalf, including 2FA (two-factor authentication). {% mac %} diff --git a/content/get-started/quickstart/create-a-repo.md b/content/get-started/quickstart/create-a-repo.md index 13f9fa5e998e..3ce78ff69e6a 100644 --- a/content/get-started/quickstart/create-a-repo.md +++ b/content/get-started/quickstart/create-a-repo.md @@ -38,6 +38,10 @@ You can store a variety of projects in {% data variables.product.product_name %} {% endif %} +{% include tool-switcher %} + +{% webui %} + {% data reusables.repositories.create_new %} 2. Type a short, memorable name for your repository. For example, "hello-world". ![Field for entering a repository name](/assets/images/help/repository/create-repository-name.png) @@ -49,16 +53,29 @@ You can store a variety of projects in {% data variables.product.product_name %} Congratulations! You've successfully created your first repository, and initialized it with a *README* file. -{% ifversion fpt or ghes or ghae %} -{% tip %} +{% endwebui %} -**Tip**: You can also create repositories using the {% data variables.product.prodname_cli %}. For more information, see "[`gh repo create`](https://cli.github.com/manual/gh_repo_create)" in the {% data variables.product.prodname_cli %} documentation. +{% cli %} -{% endtip %} -{% endif %} +{% data reusables.cli.cli-learn-more %} + +1. In the command line, navigate to the directory where you would like to create a local clone of your new project. +2. To create a repository for your project, use the `gh repo create` subcommand. Replace `project-name` with the desired name for your repository. If you want your project to belong to an organization instead of to your user account, specify the organization name and project name with `organization-name/project-name`. + + ```shell + gh repo create project-name + ``` + +3. Follow the interactive prompts. To clone the repository locally, confirm yes when asked if you would like to clone the remote project directory. Alternatively, you can specify arguments to skip these prompts. For more information about possible arguments, see [the {% data variables.product.prodname_cli %} manual](https://cli.github.com/manual/gh_repo_create). + +{% endcli %} ## Commit your first change +{% include tool-switcher %} + +{% webui %} + A *[commit](/articles/github-glossary#commit)* is like a snapshot of all the files in your project at a particular point in time. When you created your new repository, you initialized it with a *README* file. *README* files are a great place to describe your project in more detail, or add some documentation such as how to install or use your project. The contents of your *README* file are automatically shown on the front page of your repository. @@ -77,12 +94,57 @@ Let's commit a change to the *README* file. {% data reusables.files.choose_commit_branch %} {% data reusables.files.propose_file_change %} +{% endwebui %} + +{% cli %} + +Now that you have created a project, you can start committing changes. + +*README* files are a great place to describe your project in more detail, or add some documentation such as how to install or use your project. The contents of your *README* file are automatically shown on the front page of your repository. Follow these steps to add a *README* file. + +1. In the command line, navigate to the root directory of your new project. (This directory was created when you ran the `gh repo create` command.) +1. Create a *README* file with some information about the project. + + ```shell + echo "info about this project" >> README.md + ``` + +1. Enter `git status`. You will see that you have an untracked `README.md` file. + + ```shell + $ git status + + Untracked files: + (use "git add ..." to include in what will be committed) + README.md + + nothing added to commit but untracked files present (use "git add" to track) + ``` + +1. Stage and commit the file. + + ```shell + git add README.md && git commit -m "Add README" + ``` + +1. Push the changes to your branch. + + ```shell + git push --set-upstream origin HEAD + ``` + +{% endcli %} + ## Celebrate Congratulations! You have now created a repository, including a *README* file, and created your first commit on {% data variables.product.product_location %}. +{% webui %} + You can now clone a {% data variables.product.product_name %} repository to create a local copy on your computer. From your local repository you can commit, and create a pull request to update the changes in the upstream repository. For more information, see "[Cloning a repository](/github/creating-cloning-and-archiving-repositories/cloning-a-repository)" and "[Set up Git](/articles/set-up-git)." +{% endwebui %} + You can find interesting projects and repositories on {% data variables.product.product_name %} and make changes to them by creating a fork of the repository. For more information see, "[Fork a repository](/articles/fork-a-repo)." Each repository in {% data variables.product.product_name %} is owned by a person or an organization. You can interact with the people, repositories, and organizations by connecting and following them on {% data variables.product.product_name %}. For more information see "[Be social](/articles/be-social)." diff --git a/content/get-started/quickstart/fork-a-repo.md b/content/get-started/quickstart/fork-a-repo.md index 8e18caf3dd40..dba267c6d06d 100644 --- a/content/get-started/quickstart/fork-a-repo.md +++ b/content/get-started/quickstart/fork-a-repo.md @@ -62,7 +62,7 @@ You might fork a project to propose changes to the upstream, or original, reposi {% cli %} -{% data reusables.cli.download-cli %} +{% data reusables.cli.cli-learn-more %} To create a fork of a repository, use the `gh repo fork` subcommand. @@ -111,7 +111,7 @@ Right now, you have a fork of the Spoon-Knife repository, but you don't have the {% cli %} -{% data reusables.cli.download-cli %} +{% data reusables.cli.cli-learn-more %} To create a clone of your fork, use the `--clone` flag. @@ -173,7 +173,7 @@ Now, you can keep your fork synced with the upstream repository with a few Git c {% cli %} -{% data reusables.cli.download-cli %} +{% data reusables.cli.cli-learn-more %} To configure a remote repository for the forked repository, use the `--remote` flag. diff --git a/content/get-started/quickstart/set-up-git.md b/content/get-started/quickstart/set-up-git.md index b3970a4c67dd..b71911292d44 100644 --- a/content/get-started/quickstart/set-up-git.md +++ b/content/get-started/quickstart/set-up-git.md @@ -25,7 +25,7 @@ topics: --- ## Using Git -To use Git on the command line, you'll need to download, install, and configure Git on your computer. {% ifversion fpt or ghes or ghae %} You can also install {% data variables.product.prodname_cli %} to use {% data variables.product.product_name %} from the command line. For more information on {% data variables.product.prodname_cli %}, see the [{% data variables.product.prodname_cli %}](https://cli.github.com/manual/) documentation.{% endif %} +To use Git on the command line, you'll need to download, install, and configure Git on your computer. You can also install {% data variables.product.prodname_cli %} to use {% data variables.product.product_name %} from the command line. For more information, see "[About {% data variables.product.prodname_cli %}](/github-cli/github-cli/about-github-cli)." If you want to work with Git locally, but don't want to use the command line, you can instead download and install the [{% data variables.product.prodname_desktop %}]({% data variables.product.desktop_link %}) client. For more information, see "[Installing and configuring {% data variables.product.prodname_desktop %}](/desktop/installing-and-configuring-github-desktop/)." @@ -46,6 +46,12 @@ If you don't need to work with files locally, {% data variables.product.product_ When you connect to a {% data variables.product.product_name %} repository from Git, you'll need to authenticate with {% data variables.product.product_name %} using either HTTPS or SSH. +{% note %} + +**Note:** You can authenticate to {% data variables.product.product_name %} using {% data variables.product.prodname_cli %}, for either HTTP or SSH. For more information, see [`gh auth login`](https://cli.github.com/manual/gh_auth_login). + +{% endnote %} + ### Connecting over HTTPS (recommended) If you [clone with HTTPS](/github/getting-started-with-github/about-remote-repositories/#cloning-with-https-urls), you can [cache your {% data variables.product.prodname_dotcom %} credentials in Git](/github/getting-started-with-github/caching-your-github-credentials-in-git) using a credential helper. diff --git a/content/get-started/using-github/github-cli.md b/content/get-started/using-github/github-cli.md index f69184873c2e..977d614119b1 100644 --- a/content/get-started/using-github/github-cli.md +++ b/content/get-started/using-github/github-cli.md @@ -1,35 +1,16 @@ --- title: GitHub CLI -intro: '{% data variables.product.prodname_cli %} is a command-line tool that brings pull requests, issues, {% data variables.product.prodname_actions %}, and other {% data variables.product.product_name %} features to your terminal, so you can do all your work in one place.' +intro: '{% data reusables.cli.cli-intro %}' versions: fpt: '*' ghes: '*' ghae: '*' topics: - CLI -redirect_from: - - /github/getting-started-with-github/github-cli - - /github/getting-started-with-github/using-github/github-cli --- -## About {% data variables.product.prodname_cli %} -{% data variables.product.prodname_cli %} is an open source tool for using {% data variables.product.product_name %} from your computer's command line. When you're working from the command line, you can use the {% data variables.product.prodname_cli %} to save time and avoid switching context. +{% data reusables.cli.about-cli %} -The {% data variables.product.prodname_cli %} includes {% data variables.product.prodname_dotcom %} features such as: +{% data reusables.cli.cli-features %} -- View, create, clone, and fork repositories -- Create, close, and list issues and pull requests -- Review, diff, and merge pull requests -- Run, view, and list workflows -- Create, list, view, and delete releases -- Create, edit, list, view, and delete gists - -For more information about what you can do with {% data variables.product.prodname_cli %}, see the [{% data variables.product.prodname_cli %} manual](https://cli.github.com/manual). - -## Installing {% data variables.product.prodname_cli %} - -View installation instructions {% data variables.product.prodname_cli %} for macOS, Windows, and Linux on the [{% data variables.product.prodname_cli %} page](https://cli.github.com). - -## Sharing feedback - -If you have feedback or feature requests, you can open an issue in the [`cli/cli` repository](https://github.com/cli/cli). +For more information, see "[{% data variables.product.prodname_cli %}](/github-cli)." diff --git a/content/github-cli/github-cli/about-github-cli.md b/content/github-cli/github-cli/about-github-cli.md new file mode 100644 index 000000000000..901a29d93958 --- /dev/null +++ b/content/github-cli/github-cli/about-github-cli.md @@ -0,0 +1,30 @@ +--- +title: About GitHub CLI +intro: '{% data reusables.cli.cli-intro %}' +versions: + fpt: '*' + ghes: '*' + ghae: '*' +topics: + - CLI +type: overview +redirect_from: + - /github/getting-started-with-github/github-cli + - /github/getting-started-with-github/using-github/github-cli + - /actions/guides/managing-github-actions-with-github-cli +--- +## About {% data variables.product.prodname_cli %} + +{% data reusables.cli.about-cli %} + +{% data reusables.cli.cli-features %} + +For more information about what you can do with {% data variables.product.prodname_cli %}, see the [{% data variables.product.prodname_cli %} manual](https://cli.github.com/manual). + +## Installing {% data variables.product.prodname_cli %} + +View installation instructions {% data variables.product.prodname_cli %} for macOS, Windows, and Linux on the [{% data variables.product.prodname_cli %} page](https://cli.github.com). + +## Sharing feedback + +If you have feedback or feature requests, you can open an issue in the [`cli/cli` repository](https://github.com/cli/cli). diff --git a/content/github-cli/github-cli/creating-github-cli-extensions.md b/content/github-cli/github-cli/creating-github-cli-extensions.md new file mode 100644 index 000000000000..6c3cb4783fa7 --- /dev/null +++ b/content/github-cli/github-cli/creating-github-cli-extensions.md @@ -0,0 +1,152 @@ +--- +title: Creating GitHub CLI extensions +intro: 'Learn how to share new {% data variables.product.prodname_cli %} commands with other users by creating custom extensions for {% data variables.product.prodname_cli %}.' +versions: + fpt: '*' + ghes: '*' + ghae: '*' +topics: + - CLI +--- + +## About {% data variables.product.prodname_cli %} extensions + +{% data reusables.cli.cli-extensions %} For more information about how to use {% data variables.product.prodname_cli %} extensions, see "[Using {% data variables.product.prodname_cli %} extensions](/github-cli/github-cli/using-github-cli-extensions)." + +You need a repository for each extension that you create. The repository name must start with `gh-`. The rest of the repository name is the name of the extension. At the root of the repository, there must be an executable file with the same name as the repository. This file will be executed when the extension is invoked. + +{% note %} + +**Note**: We recommend that the executable file is a bash script because bash is a widely available interpreter. You may use non-bash scripts, but the user must have the necessary interpreter installed in order to use the extension. + +{% endnote %} + +## Creating an extension with `gh extension create` + +You can use the `gh extension create` command to create a project for your extension, including a bash script that contains some starter code. + +1. Set up a new extension by using the `gh extension create` subcommand. Replace `EXTENSION-NAME` with the name of your extension. + + ```shell + gh extension create EXTENSION-NAME + ``` + +1. Follow the printed instructions to finalize and optionally publish your extension. + +## Creating an extension manually + +1. Create a local directory called `gh-EXTENSION-NAME` for your extension. Replace `EXTENSION-NAME` with the name of your extension. For example, `gh-whoami`. + +1. In the directory that you created, add an executable file with the same name as the directory. + + {% note %} + + **Note:** Make sure that your file is executable. On Unix, you can execute `chmod +x file_name` in the command line to make `file_name` executable. On Windows, you can run `git init -b main`, `git add file_name`, then `git update-index --chmod=+x file_name`. + + {% endnote %} + +1. Write your script in the executable file. For example: + + ```bash + #!/bin/bash + set -e + exec gh api user --jq '"You are @\(.login) (\(.name))."' + ``` + +1. From your directory, install the extension as a local extension. + + ```bash + gh extension install . + ``` + +1. Verify that your extension works. Replace `EXTENSION-NAME` with the name of your extension. For example, `whoami`. + + ```shell + gh EXTENSION-NAME + ``` + +1. From your directory, create a repository to publish your extension. Replace `EXTENSION-NAME` with the name of your extension. + + ```shell + git init -b main + gh repo create gh-EXTENSION-NAME --confirm + git add . && git commit -m "initial commit" && git push --set-upstream origin main + ``` + +1. Optionally, to help other users discover your extension, add the repository topic `gh-extension`. This will make the extension appear on the [`gh-extension` topic page](https://github.com/topics/gh-extension). For more information about how to add a repository topic, see "[Classifying your repository with topics](/github/administering-a-repository/managing-repository-settings/classifying-your-repository-with-topics)." + +## Tips for writing {% data variables.product.prodname_cli %} extensions + +### Handling arguments and flags + +All command line arguments following a `gh my-extension-name` command will be passed to the extension script. In a bash script, you can reference arguments with `$1`, `$2`, etc. You can use arguments to take user input or to modify the behavior of the script. + +For example, this script handles multiple flags. When the script is called with the `-h` or `--help` flag, the script prints help text instead of continuing execution. When the script is called with the `--name` flag, the script sets the next value after the flag to `name_arg`. When the script is called with the `--verbose` flag, the script prints a different greeting. + +```bash +#!/bin/bash +set -e + +verbose="" +name_arg="" +while [ $# -gt 0 ]; do + case "$1" in + --verbose) + verbose=1 + ;; + --name) + name_arg="$2" + shift + ;; + -h|--help) + echo "Add help text here." + exit 0 + ;; + esac + shift +done + +if [ -z "$name_arg" ] +then + echo "You haven't told us your name." +elif [ -z "$verbose" ] +then + echo "Hi $name_arg" +else + echo "Hello and welcome, $name_arg" +fi +``` + +### Calling core commands in non-interactive mode + +Some {% data variables.product.prodname_cli %} core commands will prompt the user for input. When scripting with those commands, a prompt is often undesirable. To avoid prompting, supply the necessary information explicitly via arguments. + +For example, to create an issue programmatically, specify the title and body: + +```bash +gh issue create --title "My Title" --body "Issue description" +``` + +### Fetching data programatically + +Many core commands support the `--json` flag for fetching data programatically. For example, to return a JSON object listing the number, title, and mergeability status of pull requests: +```bash +gh pr list --json number,title,mergeStateStatus +``` + +If there is not a core command to fetch specific data from GitHub, you can use the [`gh api`](https://cli.github.com/manual/gh_api) command to access the GitHub API. For example, to fetch information about the current user: +```bash +gh api user +``` + +All commands that output JSON data also have options to filter that data into something more immediately usable by scripts. For example, to get the current user's name: + +```bash +gh api user --jq '.name' +``` + +For more information, see [`gh help formatting`](https://cli.github.com/manual/gh_help_formatting). + +## Next steps + +To see more examples of {% data variables.product.prodname_cli %} extensions, look at [repositories with the `gh-extension` topic](https://github.com/topics/gh-extension). \ No newline at end of file diff --git a/content/github-cli/github-cli/github-cli-reference.md b/content/github-cli/github-cli/github-cli-reference.md new file mode 100644 index 000000000000..c6672ce62802 --- /dev/null +++ b/content/github-cli/github-cli/github-cli-reference.md @@ -0,0 +1,29 @@ +--- +title: GitHub CLI reference +intro: 'You can view all of the {% data variables.product.prodname_cli %} commands in your terminal or in the {% data variables.product.prodname_cli %} manual.' +versions: + fpt: '*' + ghes: '*' + ghae: '*' +topics: + - CLI +type: reference +--- + +To view all {% data variables.product.prodname_cli %} commands, see the [{% data variables.product.prodname_cli %} manual](https://cli.github.com/manual/gh_help_reference) or use the `reference` command. + +```shell +gh reference +``` + +To view the environment variables that can be used with {% data variables.product.prodname_cli %}, see the [{% data variables.product.prodname_cli %} manual](https://cli.github.com/manual/gh_help_environment) or use the `environment` command. + +```shell +gh environment +``` + +To view the configuration settings that can be used with {% data variables.product.prodname_cli %}, see the [{% data variables.product.prodname_cli %} manual](https://cli.github.com/manual/gh_config) or use the `config` command. + +```shell +gh config +``` diff --git a/content/github-cli/github-cli/index.md b/content/github-cli/github-cli/index.md new file mode 100644 index 000000000000..3a9e10f3eebf --- /dev/null +++ b/content/github-cli/github-cli/index.md @@ -0,0 +1,15 @@ +--- +title: GitHub CLI +shortTitle: GitHub CLI +intro: '{% data reusables.cli.about-cli %}' +versions: + fpt: '*' + ghes: '*' + ghae: '*' +children: + - /about-github-cli + - /quickstart + - /creating-github-cli-extensions + - /using-github-cli-extensions + - /github-cli-reference +--- diff --git a/content/github-cli/github-cli/quickstart.md b/content/github-cli/github-cli/quickstart.md new file mode 100644 index 000000000000..b80b47581c23 --- /dev/null +++ b/content/github-cli/github-cli/quickstart.md @@ -0,0 +1,46 @@ +--- +title: GitHub CLI quickstart +intro: 'Start using {% data variables.product.prodname_cli %} to work with {% data variables.product.company_short %} in the command line.' +versions: + fpt: '*' + ghes: '*' + ghae: '*' +topics: + - CLI +type: overview +allowTitleToDifferFromFilename: true +shortTitle: Quickstart +--- + +## About {% data variables.product.prodname_cli %} + +{% data reusables.cli.about-cli %} + +## Getting started + +1. [Install](https://github.com/cli/cli#installation) {% data variables.product.prodname_cli %} on macOS, Windows, or Linux. +1. In the command line, authenticate to {% data variables.product.company_short %}. + + ```shell + gh auth login + ``` + + {% ifversion not fpt %} + To authenticate to {% data variables.product.product_location %}, use the `--hostname` flag. + + ```shell + gh auth login --hostname hostname + ``` + + {% endif %} +1. Start working with {% data variables.product.company_short %} in the command line. For example, find an issue to work on with `gh issue status` or `gh issue list --assignee @me`. Create a pull request with `gh pr create`. Review a pull request with `gh pr checkout`, `gh pr diff` and `gh pr review`. + +## Next steps + +- Tell {% data variables.product.prodname_cli %} which text editor to use for commands that open a text editor. For example, enter `gh config set editor "code -w"` to set your preferred text editor to {% data variables.product.prodname_vscode %}. For more information, see [`gh config set`](https://cli.github.com/manual/gh_config_set). + +- Define aliases for commands that you commonly run. For example, if you run `gh alias set prd "pr create --draft"`, you will then be able to run `gh prd` to quickly open a draft pull request. For more information, see [`gh alias`](https://cli.github.com/manual/gh_alias). + +- Create or add custom commands with {% data variables.product.prodname_cli %} extensions. For more information, see "[Using {% data variables.product.prodname_cli %} extensions](/github-cli/github-cli/using-github-cli-extensions)" and "[Creating {% data variables.product.prodname_cli %} extensions](/github-cli/github-cli/creating-github-cli-extensions)." + +- For more information about all of the commands that you can run with {% data variables.product.prodname_cli %}, see "[{% data variables.product.prodname_cli %} reference](/github-cli/github-cli/github-cli-reference)." diff --git a/content/github-cli/github-cli/using-github-cli-extensions.md b/content/github-cli/github-cli/using-github-cli-extensions.md new file mode 100644 index 000000000000..c04aa82d5ffb --- /dev/null +++ b/content/github-cli/github-cli/using-github-cli-extensions.md @@ -0,0 +1,66 @@ +--- +title: Using GitHub CLI extensions +intro: 'Learn how to use custom extensions written by other {% data variables.product.prodname_cli %} users.' +versions: + fpt: '*' + ghes: '*' + ghae: '*' +topics: + - CLI +--- + +## About {% data variables.product.prodname_cli %} extensions + +{% note %} + +**Note:** Extensions outside of {% data variables.product.product_name %} and {% data variables.product.prodname_cli %} are not certified by {% data variables.product.product_name %} and are governed by separate terms of service, privacy policy, and support documentation. To mitigate risk when using third-party extensions, audit the source code of the extension before installing or updating the extension. + +{% endnote %} + +{% data reusables.cli.cli-extensions %} For more information about how to create {% data variables.product.prodname_cli %} extensions, see "[Creating {% data variables.product.prodname_cli %} extensions](/github-cli/github-cli/creating-github-cli-extensions)." + +Extensions are locally installed and are scoped to the user. Therefore, if you access {% data variables.product.prodname_cli %} from a different machine or another user accesses {% data variables.product.prodname_cli %} from the same machine, the extension will not be available. + +## Finding extensions + +You can find extensions by browsing [repositories with the `gh-extension` topic](https://github.com/topics/gh-extension). + +## Installing extensions + +To install an extension, use the `extensions install` subcommand. Replace the `owner/repo` parameter with the name of the extension, such as `octocat/gh-whoami`.{% ifversion ghes %} If the extension is on {% data variables.product.prodname_ghe_server %}, also include the hostname, such as `https://ghe.io/octocat/gh-whoami`.{% endif %} + +```shell +gh extension install owner/repo +``` + +If you already have an extension by the same name installed, the command will fail. For example, if you have installed `octocat/gh-whoami`, you must uninstall it before installing `hubot/gh-whoami`. + +## Viewing installed extensions + +To view all installed extensions, use the `extensions list` subcommand. The output will also tell you which extensions have updates available. + +```shell +gh extension list +``` + +## Updating extensions + +To update an extension, use the `extensions upgrade` subcommand. Replace the `extension` parameter with the name of the extension. + +```shell +gh extension upgrade extension +``` + +To update all installed extensions, use the `--all` flag. + +```shell +gh extension upgrade --all +``` + +## Uninstalling extensions + +To uninstall an extension, use the `extensions remove` subcommand. Replace the `extension` parameter with the name of the extension. + +```shell +gh extension remove extension +``` diff --git a/content/github-cli/index.md b/content/github-cli/index.md new file mode 100644 index 000000000000..faf849d27b8c --- /dev/null +++ b/content/github-cli/index.md @@ -0,0 +1,34 @@ +--- +title: GitHub CLI +shortTitle: GitHub CLI +intro: '{% data reusables.cli.about-cli %}' +versions: + fpt: '*' + ghes: '*' + ghae: '*' +children: + - /github-cli +introLinks: + overview: /github-cli/github-cli/about-github-cli + quickstart: /github-cli/github-cli/quickstart + reference: /github-cli/github-cli/github-cli-reference +featuredLinks: + guides: + - /github-cli/github-cli/creating-github-cli-extensions + - /github-cli/github-cli/using-github-cli-extensions + - /actions/guides/using-github-cli-in-workflows + popular: + - /github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request + - /issues/tracking-your-work-with-issues/creating-an-issue + - /github/authenticating-to-github/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account + - /get-started/quickstart/create-a-repo + - /github/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally + - /github/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/merging-a-pull-request + - /get-started/quickstart/fork-a-repo + - /github/creating-cloning-and-archiving-repositories/cloning-a-repository-from-github/cloning-a-repository + popularHeading: Popular CLI tasks +changelog: + label: cli +layout: product-landing +beta_product: false +--- diff --git a/content/github/administering-a-repository/finding-information-in-a-repository/using-search-to-filter-issues-and-pull-requests.md b/content/github/administering-a-repository/finding-information-in-a-repository/using-search-to-filter-issues-and-pull-requests.md index 043f3b298a85..0747c03bec68 100644 --- a/content/github/administering-a-repository/finding-information-in-a-repository/using-search-to-filter-issues-and-pull-requests.md +++ b/content/github/administering-a-repository/finding-information-in-a-repository/using-search-to-filter-issues-and-pull-requests.md @@ -1,6 +1,6 @@ --- title: Using search to filter issues and pull requests -intro: Every issues and pull requests view comes with a search bar for advanced filter management. +intro: You can use advanced filters to search for issues and pull requests that meet specific criteria. redirect_from: - /github/managing-your-work-on-github/finding-information-in-a-repository/using-search-to-filter-issues-and-pull-requests - /articles/using-search-to-filter-issues-and-pull-requests @@ -13,6 +13,13 @@ topics: - Pull requests shortTitle: Use search to filter --- + +## Searching for issues and pull requests + +{% include tool-switcher %} + +{% webui %} + The issues and pull requests search bar allows you to define your own custom filters and sort by a wide variety of criteria. You can find the search bar on each repository's **Issues** and **Pull requests** tabs and on your [Issues and Pull requests dashboards](/articles/viewing-all-of-your-issues-and-pull-requests). ![The issues and pull requests search bar](/assets/images/help/issues/issues_search_bar.png) @@ -23,6 +30,30 @@ The issues and pull requests search bar allows you to define your own custom fil {% endtip %} +{% endwebui %} + +{% cli %} + +{% data reusables.cli.cli-learn-more %} + +You can use the {% data variables.product.prodname_cli %} to search for issues or pull requests. Use the `gh issue list` or `gh pr list` subcommand along with the `--search` argument and a search query. + +For example, you can list, in order of date created, all issues that have no assignee and that have the label `help wanted` or `bug`. + +```shell +gh issue list --search 'no:assignee label:"help wanted",bug sort:created-asc' +``` + +You can also list all pull requests that mention the `octo-org/octo-team` team. + +```shell +gh pr list --search "team:octo-org/octo-team" +``` + +{% endcli %} + +## About search terms + With issue and pull request search terms, you can: - Filter issues and pull requests by author: `state:open type:issue author:octocat` diff --git a/content/github/administering-a-repository/releasing-projects-on-github/managing-releases-in-a-repository.md b/content/github/administering-a-repository/releasing-projects-on-github/managing-releases-in-a-repository.md index d563c5a54e0c..c4ec38cb7758 100644 --- a/content/github/administering-a-repository/releasing-projects-on-github/managing-releases-in-a-repository.md +++ b/content/github/administering-a-repository/releasing-projects-on-github/managing-releases-in-a-repository.md @@ -29,15 +29,11 @@ You can choose whether {% data variables.large_files.product_name_long %} ({% da {% endif %} {% endif %} -{% ifversion fpt or ghae or ghes %} -{% tip %} - -**Tip**: You can also manage releases using the {% data variables.product.prodname_cli %}. For more information, see "[`gh release`](https://cli.github.com/manual/gh_release)" in the {% data variables.product.prodname_cli %} documentation. +## Creating a release -{% endtip %} -{% endif %} +{% include tool-switcher %} -## Creating a release +{% webui %} {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.releases %} @@ -60,10 +56,32 @@ You can choose whether {% data variables.large_files.product_name_long %} ({% da 9. If you're ready to publicize your release, click **Publish release**. To work on the release later, click **Save draft**. ![Publish release and Draft release buttons](/assets/images/help/releases/release_buttons.png) -You can also automatically create a release from the command line or in a script. For more information, see "[Releases](/rest/reference/repos/#create-a-release)." +{% endwebui %} + +{% cli %} + +{% data reusables.cli.cli-learn-more %} + +1. To create a release, use the `gh release create` subcommand. Replace `tag` with the desired tag for the release. + + ```shell + gh release create tag + ``` + +2. Follow the interactive prompts. Alternatively, you can specify arguments to skip these prompts. For more information about possible arguments, see [the {% data variables.product.prodname_cli %} manual](https://cli.github.com/manual/gh_release_create). For example, this command creates a prerelease with the specified title and notes. + + ```shell + gh release create v1.3.2 --title "v1.3.2 (beta)" --notes "this is a beta release" --prerelease + ``` + +{% endcli %} ## Editing a release +{% include tool-switcher %} + +{% webui %} + {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.releases %} 3. On the right side of the page, next to the release you want to edit, click **Edit release**. @@ -71,9 +89,19 @@ You can also automatically create a release from the command line or in a script 4. Edit the details for the release in the form, then click **Update release**. ![Update a release](/assets/images/help/releases/update-release.png) +{% endwebui %} + +{% cli %} + +Releases cannot currently be edited with {% data variables.product.prodname_cli %}. + +{% endcli %} + ## Deleting a release -You must remove all binary files attached to a release before you can delete a release. +{% include tool-switcher %} + +{% webui %} {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.releases %} @@ -83,3 +111,15 @@ You must remove all binary files attached to a release before you can delete a r ![Delete release button](/assets/images/help/releases/delete-release.png) 5. Click **Delete this release**. ![Confirm delete release](/assets/images/help/releases/confirm-delete-release.png) + +{% endwebui %} + +{% cli %} + +1. To delete a release, use the `gh release delete` subcommand. Replace `tag` with the tag of the release to delete. Use the `-y` flag to skip confirmation. + + ```shell + gh release delete tag -y + ``` + +{% endcli %} \ No newline at end of file diff --git a/content/github/authenticating-to-github/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account.md b/content/github/authenticating-to-github/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account.md index 7005994fe95b..7e4e299dfe62 100644 --- a/content/github/authenticating-to-github/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account.md +++ b/content/github/authenticating-to-github/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account.md @@ -133,7 +133,7 @@ After adding a new SSH key to your {% data variables.product.product_name %} acc {% cli %} -{% data reusables.cli.download-cli %} +{% data reusables.cli.cli-learn-more %} To add an SSH key to your GitHub account, use the `ssh-key add` subcommand. diff --git a/content/github/authenticating-to-github/keeping-your-account-and-data-secure/about-authentication-to-github.md b/content/github/authenticating-to-github/keeping-your-account-and-data-secure/about-authentication-to-github.md index 9ef6bb193c8a..87d2b7eb4d15 100644 --- a/content/github/authenticating-to-github/keeping-your-account-and-data-secure/about-authentication-to-github.md +++ b/content/github/authenticating-to-github/keeping-your-account-and-data-secure/about-authentication-to-github.md @@ -52,9 +52,23 @@ You can authenticate with the API in different ways. You can access repositories on {% data variables.product.product_name %} from the command line in two ways, HTTPS and SSH, and both have a different way of authenticating. The method of authenticating is determined based on whether you choose an HTTPS or SSH remote URL when you clone the repository. For more information about which way to access, see "[About remote repositories](/github/getting-started-with-github/about-remote-repositories)." -* You can work with all repositories on {% data variables.product.product_name %} over HTTPS, even if you are behind a firewall or proxy. Every time you use Git to authenticate with {% data variables.product.product_name %}, you'll be prompted to enter your credentials to authenticate with {% data variables.product.product_name %}, unless you cache them with a [credential helper](/github/getting-started-with-github/caching-your-github-credentials-in-git). {% data reusables.user_settings.password-authentication-deprecation %} +### HTTPS -* You can work with all repositories on {% data variables.product.product_name %} over SSH, although firewalls and proxys might refuse to allow SSH connections. Using SSH requires you to generate an SSH public/private keypair on your local machine and add the public key to your {% data variables.product.product_name %} account. Every time you use Git to authenticate with {% data variables.product.product_name %}, you'll be prompted to enter your SSH key passphrase, unless you've [stored the key](/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#adding-your-ssh-key-to-the-ssh-agent). For more information, see "[Generating a new SSH key and adding it to the ssh-agent](/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent)." +You can work with all repositories on {% data variables.product.product_name %} over HTTPS, even if you are behind a firewall or proxy. + +If you authenticate with {% data variables.product.prodname_cli %}, you can either authenticate with a personal access token or via the web browser. For more information about authenticating with {% data variables.product.prodname_cli %}, see [`gh auth login`](https://cli.github.com/manual/gh_auth_login). + +If you authenticate without {% data variables.product.prodname_cli %}, you must authenticate with a personal access token. {% data reusables.user_settings.password-authentication-deprecation %} Every time you use Git to authenticate with {% data variables.product.product_name %}, you'll be prompted to enter your credentials to authenticate with {% data variables.product.product_name %}, unless you cache them a [credential helper](/github/getting-started-with-github/caching-your-github-credentials-in-git). + +### SSH + +You can work with all repositories on {% data variables.product.product_name %} over SSH, although firewalls and proxys might refuse to allow SSH connections. + +If you authenticate with {% data variables.product.prodname_cli %}, the CLI will find SSH public keys on your machine and will prompt you to select one for upload. If {% data variables.product.prodname_cli %} does not find a SSH public key for upload, it can generate a new SSH public/private keypair and upload the public key to your {% data variables.product.product_name %} account. Then, you can either authenticate with a personal access token or via the web browser. For more information about authenticating with {% data variables.product.prodname_cli %}, see [`gh auth login`](https://cli.github.com/manual/gh_auth_login). + +If you authenticate without {% data variables.product.prodname_cli %}, you will need to generate an SSH public/private keypair on your local machine and add the public key to your {% data variables.product.product_name %} account. For more information, see "[Generating a new SSH key and adding it to the ssh-agent](/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent)." Every time you use Git to authenticate with {% data variables.product.product_name %}, you'll be prompted to enter your SSH key passphrase, unless you've [stored the key](/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#adding-your-ssh-key-to-the-ssh-agent). + +### Authorizing for SAML single sign-on {% ifversion fpt %}To use a personal access token or SSH key to access resources owned by an organization that uses SAML single sign-on, you must also authorize the personal token or SSH key. For more information, see "[Authorizing a personal access token for use with SAML single sign-on](/github/authenticating-to-github/authorizing-a-personal-access-token-for-use-with-saml-single-sign-on)" or "[Authorizing an SSH key for use with SAML single sign-on](/github/authenticating-to-github/authorizing-an-ssh-key-for-use-with-saml-single-sign-on)."{% endif %} diff --git a/content/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token.md b/content/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token.md index 626c0c816621..904931302239 100644 --- a/content/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token.md +++ b/content/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token.md @@ -16,6 +16,13 @@ topics: - Access management shortTitle: Create a PAT --- + +{% note %} + +**Note:** If you use {% data variables.product.prodname_cli %} to authenticate to {% data variables.product.product_name %} on the command line, you can skip generating a personal access token and authenticate via the web browser instead. For more information about authenticating with {% data variables.product.prodname_cli %}, see [`gh auth login`](https://cli.github.com/manual/gh_auth_login). + +{% endnote %} + Personal access tokens (PATs) are an alternative to using passwords for authentication to {% data variables.product.product_name %} when using the [GitHub API](/rest/overview/other-authentication-methods#via-oauth-and-personal-access-tokens) or the [command line](#using-a-token-on-the-command-line). {% ifversion fpt %}If you want to use a PAT to access resources owned by an organization that uses SAML SSO, you must authorize the PAT. For more information, see "[About authentication with SAML single sign-on](/github/authenticating-to-github/about-authentication-with-saml-single-sign-on)" and "[Authorizing a personal access token for use with SAML single sign-on](/github/authenticating-to-github/authorizing-a-personal-access-token-for-use-with-saml-single-sign-on)."{% endif %} diff --git a/content/github/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/merging-a-pull-request.md b/content/github/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/merging-a-pull-request.md index 1cc53c0a3ad4..66d2685780ea 100644 --- a/content/github/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/merging-a-pull-request.md +++ b/content/github/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/merging-a-pull-request.md @@ -22,19 +22,26 @@ If the pull request has merge conflicts, or if you'd like to test the changes be You can't merge a draft pull request. For more information about draft pull requests, see "[About pull requests](/articles/about-pull-requests#draft-pull-requests)." -{% data reusables.pull_requests.automatically-delete-branches %} +The repository may be configured so that the head branch for a pull request is automatically deleted when you merge a pull request. For more information, see "[Managing the automatic deletion of branches](/github/administering-a-repository/managing-the-automatic-deletion-of-branches)." -If you decide you don't want the changes in a topic branch to be merged to the upstream branch, you can [close the pull request](/articles/closing-a-pull-request) without merging. +{% note %} + +**Note:** {% data reusables.pull_requests.retargeted-on-branch-deletion %} +For more information, see "[About branches](/github/collaborating-with-issues-and-pull-requests/about-branches#working-with-branches)." -{% ifversion fpt or ghae or ghes %} -{% tip %} +{% endnote %} + +Pull requests are merged using [the `--no-ff` option](https://git-scm.com/docs/git-merge#_fast_forward_merge), except for [pull requests with squashed or rebased commits](/articles/about-pull-request-merges), which are merged using the fast-forward option. + +{% data reusables.pull_requests.close-issues-using-keywords %} + +If you decide you don't want the changes in a topic branch to be merged to the upstream branch, you can [close the pull request](/articles/closing-a-pull-request) without merging. -**Tip**: You can also merge a pull request using the {% data variables.product.prodname_cli %}. For more information, see "[`gh pr merge`](https://cli.github.com/manual/gh_pr_merge)" in the {% data variables.product.prodname_cli %} documentation. +## Merging a pull request -{% endtip %} -{% endif %} +{% include tool-switcher %} -## Merging a pull request on {% data variables.product.prodname_dotcom %} +{% webui %} {% data reusables.repositories.sidebar-pr %} 2. In the "Pull Requests" list, click the pull request you'd like to merge. @@ -67,20 +74,27 @@ If you decide you don't want the changes in a topic branch to be merged to the u 6. Click **Confirm merge**, **Confirm squash and merge**, or **Confirm rebase and merge**. 6. Optionally, [delete the branch](/articles/deleting-unused-branches). This keeps the list of branches in your repository tidy. -The repository may be configured so that the head branch for a pull request is automatically deleted when you merge a pull request. For more information, see "[Managing the automatic deletion of branches](/github/administering-a-repository/managing-the-automatic-deletion-of-branches)." +{% endwebui %} - - {% note %} +{% cli %} - **Note:** {% data reusables.pull_requests.retargeted-on-branch-deletion %} - For more information, see "[About branches](/github/collaborating-with-issues-and-pull-requests/about-branches#working-with-branches)." +{% data reusables.cli.cli-learn-more %} - {% endnote %} - +To merge a pull request, use the `gh pr merge` subcommand. Replace `pull-request` with the number, URL, or head branch of the pull request. -Pull requests are merged using [the `--no-ff` option](https://git-scm.com/docs/git-merge#_fast_forward_merge), except for [pull requests with squashed or rebased commits](/articles/about-pull-request-merges), which are merged using the fast-forward option. +```shell +gh pr merge pull-request +``` -{% data reusables.pull_requests.close-issues-using-keywords %} +Follow the interactive prompts to complete the merge. For more information about the merge methods that you can choose, see "[About pull request merges](/github/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/about-pull-request-merges)." + +Alternatively, you can use flags to skip the interactive prompts. For example, this command will squash the commits into a single commit with the commit message "my squash commit", merge the squashed commit into the base branch, and then delete the local and remote branch. + +```shell +gh pr merge 523 --squash --body "my squash commit" --delete-branch +``` + +{% endcli %} ## Further reading diff --git a/content/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request.md b/content/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request.md index adc55640b9f6..bdb72baf5edc 100644 --- a/content/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request.md +++ b/content/github/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request.md @@ -65,7 +65,7 @@ After your pull request has been reviewed, it can be [merged into the repository {% cli %} -{% data reusables.cli.download-cli %} +{% data reusables.cli.cli-learn-more %} To create a pull request, use the `gh pr create` subcommand. diff --git a/content/github/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally.md b/content/github/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally.md index 24d6ff140202..ca0978d8f1ec 100644 --- a/content/github/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally.md +++ b/content/github/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally.md @@ -20,15 +20,11 @@ shortTitle: Check out a PR locally {% endnote %} -{% ifversion fpt or ghae or ghes %} -{% tip %} +## Modifying an active pull request locally -**Tip**: You can also check out a pull request locally using the {% data variables.product.prodname_cli %}. For more information, see "[`gh pr checkout`](https://cli.github.com/manual/gh_pr_checkout)" in the {% data variables.product.prodname_cli %} documentation. +{% include tool-switcher %} -{% endtip %} -{% endif %} - -## Modifying an active pull request locally +{% webui %} {% data reusables.repositories.sidebar-pr %} 2. In the list of pull requests, click the pull request you'd like to modify.{% ifversion fpt %} @@ -39,6 +35,20 @@ shortTitle: Check out a PR locally 4. Optionally, to view proposed changes in {% data variables.product.prodname_desktop %}, click **open this in {% data variables.product.prodname_desktop %}**. ![Link to open a pull request locally in Desktop](/assets/images/help/desktop/open-pr-in-desktop.png){% endif %} +{% endwebui %} + +{% cli %} + +{% data reusables.cli.cli-learn-more %} + +To check out a pull request locally, use the `gh pr checkout` subcommand. Replace `pull-request` with the number, URL, or head branch of the pull request. + +```shell +gh pr checkout pull-request +``` + +{% endcli %} + ## Modifying an inactive pull request locally If a pull request's author is unresponsive to requests or has deleted their fork, the pull request can still be merged. However, if you want to make changes to a pull request and the author is not responding, you'll need to perform some additional steps to update the pull request. diff --git a/content/github/creating-cloning-and-archiving-repositories/cloning-a-repository-from-github/cloning-a-repository.md b/content/github/creating-cloning-and-archiving-repositories/cloning-a-repository-from-github/cloning-a-repository.md index cb3814765b54..394b57158d11 100644 --- a/content/github/creating-cloning-and-archiving-repositories/cloning-a-repository-from-github/cloning-a-repository.md +++ b/content/github/creating-cloning-and-archiving-repositories/cloning-a-repository-from-github/cloning-a-repository.md @@ -36,7 +36,7 @@ You can clone your existing repository or clone another person's existing reposi {% cli %} -{% data reusables.cli.download-cli %} +{% data reusables.cli.cli-learn-more %} To clone a repository locally, use the `repo clone` subcommand. Replace the `repository` parameter with the repository name. For example, `octo-org/octo-repo`, `monalisa/octo-repo`, or `octo-repo`. If the `OWNER/` portion of the `OWNER/REPO` repository argument is omitted, it defaults to the name of the authenticating user. diff --git a/content/github/importing-your-projects-to-github/importing-source-code-to-github/adding-an-existing-project-to-github-using-the-command-line.md b/content/github/importing-your-projects-to-github/importing-source-code-to-github/adding-an-existing-project-to-github-using-the-command-line.md index ebccf318a961..67b222cd5704 100644 --- a/content/github/importing-your-projects-to-github/importing-source-code-to-github/adding-an-existing-project-to-github-using-the-command-line.md +++ b/content/github/importing-your-projects-to-github/importing-source-code-to-github/adding-an-existing-project-to-github-using-the-command-line.md @@ -11,6 +11,9 @@ versions: ghae: '*' shortTitle: Add a project locally --- + +## About adding existing projects to {% data variables.product.product_name %} + {% data reusables.repositories.migrating-from-codeplex %} {% tip %} @@ -21,6 +24,38 @@ shortTitle: Add a project locally {% data reusables.repositories.sensitive-info-warning %} +## Adding a project to {% data variables.product.product_name %} with {% data variables.product.prodname_cli %} + +{% data variables.product.prodname_cli %} is an open source tool for using {% data variables.product.product_name %} from your computer's command line. {% data variables.product.prodname_cli %} can simplify the process of adding an existing project to {% data variables.product.product_name %} using the command line. To learn more about {% data variables.product.prodname_cli %}, see "[About {% data variables.product.prodname_cli %}](/github-cli/github-cli/about-github-cli)." + +1. In the command line, navigate to the root directory of your project. +1. Initialize the local directory as a Git repository. + + ```shell + git init -b main + ``` + +1. To create a repository for your project on {% data variables.product.product_name %}, use the `gh repo create` subcommand. Replace `project-name` with the desired name for your repository. If you want your project to belong to an organization instead of to your user account, specify the organization name and project name with `organization-name/project-name`. + + ```shell + gh repo create project-name + ``` + +1. Follow the interactive prompts. Alternatively, you can specify arguments to skip these prompts. For more information about possible arguments, see [the {% data variables.product.prodname_cli %} manual](https://cli.github.com/manual/gh_repo_create). +1. Pull changes from the new repository that you created. (If you created a `.gitignore` or `LICENSE` file in the previous step, this will pull those changes to your local directory.) + + ```shell + git pull --set-upstream origin main + ``` + +1. Stage, commit, and push all of the files in your project. + + ```shell + git add . && git commit -m "initial commit" && git push + ``` + +## Adding a project to {% data variables.product.product_name %} without {% data variables.product.prodname_cli %} + {% mac %} 1. [Create a new repository](/articles/creating-a-new-repository) on {% data variables.product.product_location %}. To avoid errors, do not initialize the new repository with *README*, license, or `gitignore` files. You can add these files after your project has been pushed to {% data variables.product.product_name %}. diff --git a/content/index.md b/content/index.md index 95a48f9a6909..280a2537626d 100644 --- a/content/index.md +++ b/content/index.md @@ -28,6 +28,7 @@ children: - developers - rest - graphql + - github-cli - insights - discussions - sponsors @@ -37,11 +38,6 @@ children: - desktop - early-access externalProducts: - cli: - id: cli - name: GitHub CLI - href: 'https://cli.github.com/manual' - external: true atom: id: atom name: Atom diff --git a/content/issues/tracking-your-work-with-issues/creating-an-issue.md b/content/issues/tracking-your-work-with-issues/creating-an-issue.md index d6eff0f1fb02..a59479035c0c 100644 --- a/content/issues/tracking-your-work-with-issues/creating-an-issue.md +++ b/content/issues/tracking-your-work-with-issues/creating-an-issue.md @@ -35,14 +35,6 @@ Issues can be used to keep track of bugs, enhancements, or other requests. For m ## Creating an issue from a repository -{% ifversion fpt or ghes or ghae %} -{% tip %} - -**Tip**: You can also create an issue using the {% data variables.product.prodname_cli %}. For more information, see "[`gh issue create`](https://cli.github.com/manual/gh_issue_create)" in the {% data variables.product.prodname_cli %} documentation. - -{% endtip %} -{% endif %} - {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-issues %} {% data reusables.repositories.new_issue %} @@ -54,6 +46,22 @@ Issues can be used to keep track of bugs, enhancements, or other requests. For m {% data reusables.repositories.assign-an-issue-as-project-maintainer %} {% data reusables.repositories.submit-new-issue %} +## Creating an issue with {% data variables.product.prodname_cli %} + +{% data reusables.cli.about-cli %} To learn more about {% data variables.product.prodname_cli %}, see "[About {% data variables.product.prodname_cli %}](/github-cli/github-cli/about-github-cli)." + +To create an issue, use the `gh issue create` subcommand. To skip the interactive prompts, include the `--body` and the `--title` flags. + +```shell +gh issue create --title "My new issue" --body "Here are more details." +``` + +You can also specify assignees, labels, milestones, and projects. + +```shell +gh issue create --title "My new issue" --body "Here are more details." --assignee @me,monalisa --label "bug,help wanted" --project onboarding --milestone "learning codebase" +``` + ## Creating an issue from a comment You can open a new issue from a comment in an issue or pull request. When you open an issue from a comment, the issue contains a snippet showing where the comment was originally posted. diff --git a/content/issues/tracking-your-work-with-issues/transferring-an-issue-to-another-repository.md b/content/issues/tracking-your-work-with-issues/transferring-an-issue-to-another-repository.md index 1350d16ab4d3..29d05db67c43 100644 --- a/content/issues/tracking-your-work-with-issues/transferring-an-issue-to-another-repository.md +++ b/content/issues/tracking-your-work-with-issues/transferring-an-issue-to-another-repository.md @@ -24,6 +24,10 @@ People or teams who are mentioned in the issue will receive a notification letti ## Transferring an open issue to another repository +{% include tool-switcher %} + +{% webui %} + {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-issues %} 3. In the list of issues, click the issue you'd like to transfer. @@ -34,6 +38,20 @@ People or teams who are mentioned in the issue will receive a notification letti 6. Click **Transfer issue**. ![Transfer issue button](/assets/images/help/repository/transfer-issue-button.png) +{% endwebui %} + +{% cli %} + +{% data reusables.cli.cli-learn-more %} + +To transfer an issue, use the `gh issue transfer` subcommand. Replace the `issue` parameter with the number or URL of the issue. Replace the `{% ifversion ghes %}hostname/{% endif %}owner/repo` parameter with the {% ifversion ghes %}URL{% else %}name{% endif %} of the repository that you want to transfer the issue to, such as `{% ifversion ghes %}https://ghe.io/{% endif %}octocat/octo-repo`. + +```shell +gh issue transfer issue {% ifversion ghes %}hostname/{% endif %}owner/repo +``` + +{% endcli %} + ## Further reading - "[About issues](/articles/about-issues)" diff --git a/content/issues/trying-out-the-new-projects-experience/using-the-api-to-manage-projects.md b/content/issues/trying-out-the-new-projects-experience/using-the-api-to-manage-projects.md index 68683de97fa2..677f7e608329 100644 --- a/content/issues/trying-out-the-new-projects-experience/using-the-api-to-manage-projects.md +++ b/content/issues/trying-out-the-new-projects-experience/using-the-api-to-manage-projects.md @@ -28,7 +28,7 @@ In all of the following cURL examples, replace `TOKEN` with a token that has the {% cli %} -{% data reusables.cli.download-cli %} +{% data reusables.cli.cli-learn-more %} Before running {% data variables.product.prodname_cli %} commands, you must authenticate by running `gh auth login` and providing an authentication token that has the `read:org` scope (for queries) or `write:org` scope (for queries and mutations). During the beta, you will not be able to authenticate using a web browser. For more information on command line authentication, see "[gh auth login](https://cli.github.com/manual/gh_auth_login)." For more information about creating a token, see "[Creating a personal access token](/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token)." diff --git a/data/reusables/actions/actions-cli.md b/data/reusables/actions/actions-cli.md deleted file mode 100644 index 9de328800eca..000000000000 --- a/data/reusables/actions/actions-cli.md +++ /dev/null @@ -1 +0,0 @@ -For information on setting up {% data variables.product.prodname_cli %}, see "[Managing GitHub Actions with GitHub CLI](/actions/guides/managing-github-actions-with-github-cli#setting-up-github-cli)." diff --git a/data/reusables/cli/about-cli.md b/data/reusables/cli/about-cli.md new file mode 100644 index 000000000000..2d8458d00970 --- /dev/null +++ b/data/reusables/cli/about-cli.md @@ -0,0 +1 @@ +{% data variables.product.prodname_cli %} is an open source tool for using {% data variables.product.product_name %} from your computer's command line. When you're working from the command line, you can use the {% data variables.product.prodname_cli %} to save time and avoid switching context. diff --git a/data/reusables/cli/actions-cli-version.md b/data/reusables/cli/actions-cli-version.md deleted file mode 100644 index 83cd5971dddc..000000000000 --- a/data/reusables/cli/actions-cli-version.md +++ /dev/null @@ -1 +0,0 @@ -To access all of the {% data variables.product.prodname_actions %}-related commands, you must use version 1.9.0 or greater. diff --git a/data/reusables/cli/cli-auth.md b/data/reusables/cli/cli-auth.md deleted file mode 100644 index be9a823c3c60..000000000000 --- a/data/reusables/cli/cli-auth.md +++ /dev/null @@ -1 +0,0 @@ -{% data variables.product.prodname_cli %} can authenticate using your {% data variables.product.prodname_dotcom %} account. Before running {% data variables.product.prodname_cli %} commands, you will need to authenticate by running `gh auth login`. For more information on command line authentication, see "[`gh auth login`](https://cli.github.com/manual/gh_auth_login)." diff --git a/data/reusables/cli/cli-extensions.md b/data/reusables/cli/cli-extensions.md new file mode 100644 index 000000000000..4e7f890088ab --- /dev/null +++ b/data/reusables/cli/cli-extensions.md @@ -0,0 +1 @@ +{% data variables.product.prodname_cli %} extensions are custom {% data variables.product.prodname_cli %} commands that anyone can create and use. \ No newline at end of file diff --git a/data/reusables/cli/cli-features.md b/data/reusables/cli/cli-features.md new file mode 100644 index 000000000000..0ac3dc9ba051 --- /dev/null +++ b/data/reusables/cli/cli-features.md @@ -0,0 +1,8 @@ +The {% data variables.product.prodname_cli %} includes {% data variables.product.prodname_dotcom %} features such as: + +- View, create, clone, and fork repositories +- Create, close, edit, and view issues and pull requests +- Review, diff, and merge pull requests +- Run, view, and list workflows +- Create, list, view, and delete releases +- Create, edit, list, view, and delete gists diff --git a/data/reusables/cli/cli-intro.md b/data/reusables/cli/cli-intro.md new file mode 100644 index 000000000000..53afd1ecf84b --- /dev/null +++ b/data/reusables/cli/cli-intro.md @@ -0,0 +1 @@ +{% data variables.product.prodname_cli %} is a command-line tool that brings pull requests, issues, {% data variables.product.prodname_actions %}, and other {% data variables.product.product_name %} features to your terminal, so you can do all your work in one place. \ No newline at end of file diff --git a/data/reusables/cli/cli-learn-more.md b/data/reusables/cli/cli-learn-more.md new file mode 100644 index 000000000000..9a7d8272eaf7 --- /dev/null +++ b/data/reusables/cli/cli-learn-more.md @@ -0,0 +1,5 @@ +{% note %} + +To learn more about {% data variables.product.prodname_cli %}, see "[About {% data variables.product.prodname_cli %}](/github-cli/github-cli/about-github-cli)." + +{% endnote %} \ No newline at end of file diff --git a/data/reusables/cli/cli-manual.md b/data/reusables/cli/cli-manual.md deleted file mode 100644 index 2696dbeec749..000000000000 --- a/data/reusables/cli/cli-manual.md +++ /dev/null @@ -1 +0,0 @@ -For more information about {% data variables.product.prodname_cli %}, see [the {% data variables.product.prodname_cli %} manual](https://cli.github.com/manual/). diff --git a/data/reusables/cli/cli-repo.md b/data/reusables/cli/cli-repo.md deleted file mode 100644 index 32a83418da4c..000000000000 --- a/data/reusables/cli/cli-repo.md +++ /dev/null @@ -1 +0,0 @@ -{% data variables.product.prodname_cli %} commands must be run within the repository that you want to interact with, so you must first navigate to the directory containing the local copy of your repository. Alternatively, you can specify a repository by passing {% ifversion ghes or ghae %}`-R HOSTNAME/OWNER/REPOSITORY` or `--repo HOSTNAME/OWNER/REPOSITORY`{% else %}`-R OWNER/REPOSITORY` or `--repo OWNER/REPOSITORY`{% endif %}. {% ifversion ghes or ghae %}Replace `HOSTNAME` with the name of {% data variables.product.product_location %}. {% endif %}Replace `OWNER` with owner of the repository. Replace `REPOSITORY` with the name of the repository. diff --git a/data/reusables/cli/download-cli.md b/data/reusables/cli/download-cli.md deleted file mode 100644 index dfcfa8ec5e49..000000000000 --- a/data/reusables/cli/download-cli.md +++ /dev/null @@ -1 +0,0 @@ -To download or find more information about {% data variables.product.prodname_cli %}, see the [{% data variables.product.prodname_cli %} feature page](https://cli.github.com/). diff --git a/data/reusables/cli/download-update-cli.md b/data/reusables/cli/download-update-cli.md deleted file mode 100644 index fda140a7dd21..000000000000 --- a/data/reusables/cli/download-update-cli.md +++ /dev/null @@ -1 +0,0 @@ -To download or upgrade {% data variables.product.prodname_cli %}, follow the instructions in the [{% data variables.product.prodname_cli %} README](https://github.com/cli/cli#installation). diff --git a/lib/frontmatter.js b/lib/frontmatter.js index 35b1526959f2..76463481cfda 100644 --- a/lib/frontmatter.js +++ b/lib/frontmatter.js @@ -183,16 +183,6 @@ export const schema = { externalProducts: { type: 'object', properties: { - cli: { - type: 'object', - required: true, - properties: { - id: { type: 'string', required: true }, - name: { type: 'string', required: true }, - href: { type: 'string', format: 'url', required: true }, - external: { type: 'boolean', required: true }, - }, - }, atom: { type: 'object', required: true, diff --git a/tests/rendering/sidebar.js b/tests/rendering/sidebar.js index 5f0c9806e379..949199fff0f2 100644 --- a/tests/rendering/sidebar.js +++ b/tests/rendering/sidebar.js @@ -28,10 +28,7 @@ describe('sidebar', () => { ).toBe('GitHub') }) - test('includes links to external products like the CLI, Atom, Electron, and CodeQL', async () => { - expect($homePage('[data-testid=sidebar] a[href="https://cli.github.com/manual"]')).toHaveLength( - 1 - ) + test('includes links to external products like the Atom, Electron, and CodeQL', async () => { expect($homePage('[data-testid=sidebar] a[href="https://atom.io/docs"]')).toHaveLength(1) expect($homePage('[data-testid=sidebar] a[href="https://electronjs.org/docs"]')).toHaveLength(1) expect(