1
0
mirror of synced 2025-12-22 11:26:57 -05:00

Merge branch 'main' into patch-1

This commit is contained in:
Janice
2021-04-14 15:22:24 -07:00
committed by GitHub
14 changed files with 242 additions and 5 deletions

View File

@@ -70,6 +70,7 @@ 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
---
<!-- {% link_in_list /about-continuous-integration %} -->
@@ -104,3 +105,4 @@ includeGuides:
<!-- {% link_in_list /commenting-on-an-issue-when-a-label-is-added %} -->
<!-- {% link_in_list /moving-assigned-issues-on-project-boards %} -->
<!-- {% link_in_list /removing-a-label-when-a-card-is-added-to-a-project-board-column %} -->
<!-- {% link_in_list /managing-github-actions-with-github-cli %} -->

View File

@@ -0,0 +1,37 @@
---
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:
free-pro-team: '*'
enterprise-server: '>=2.22'
github-ae: '*'
type: 'overview'
topics:
- 'Workflows'
---
{% 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)"
- "[Disabling and enabling a workflow](/actions/managing-workflow-runs/disabling-and-enabling-a-workflow#disabling-and-enabling-workflows-through-github-cli)"

View File

@@ -1,6 +1,6 @@
---
title: Disabling and enabling a workflow
intro: 'You can disable and re-enable a workflow using {% data variables.product.prodname_dotcom %} or the REST API.'
intro: 'You can disable and re-enable a workflow using the {% data variables.product.prodname_dotcom %} UI, the REST API, or {% data variables.product.prodname_cli %}.'
product: '{% data reusables.gated-features.actions %}'
versions:
free-pro-team: '*'
@@ -12,7 +12,7 @@ versions:
{% data reusables.actions.enterprise-github-hosted-runners %}
{% data reusables.actions.ae-beta %}
Disabling a workflow allows you to stop a workflow from being triggered without having to delete the file from the repo. You can easily re-enable the workflow again on {% data variables.product.prodname_dotcom %}. 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 allows you to stop a workflow from being triggered without having to delete the file from the repo. You can easily re-enable the workflow again on {% data variables.product.prodname_dotcom %}.
Temporarily disabling a workflow can be useful in many scenarios. These are a few examples where disabling a workflow might be helpful:
@@ -27,7 +27,9 @@ Temporarily disabling a workflow can be useful in many scenarios. These are a fe
{% endwarning %}
### Disabling a workflow
### Disabling and enabling workflows with the {% data variables.product.prodname_dotcom %} UI
#### Disabling a workflow
You can manually disable a workflow so that it won't execute any workflow runs. A disabled workflow is not deleted, and can be re-enabled.
@@ -42,7 +44,7 @@ You can manually disable a workflow so that it won't execute any workflow runs.
The disabled workflow is marked {% octicon "stop" aria-label="The stop icon" %} to indicate its status.
![actions list disabled workflow](/assets/images/help/repository/actions-find-disabled-workflow.png)
### Enabling a workflow
#### Enabling a workflow
You can re-enable a workflow that was previously disabled.
@@ -52,3 +54,23 @@ You can re-enable a workflow that was previously disabled.
![actions select disabled workflow](/assets/images/help/repository/actions-select-disabled-workflow.png)
1. Click **Enable workflow**.
![actions enable workflow](/assets/images/help/repository/actions-enable-workflow.png)
### Disabling and enabling workflows with {% data variables.product.prodname_cli %}
{% data reusables.actions.actions-cli %}
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.
```shell
gh workflow disable <em>workflow</em>
```
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
gh workflow enable <em>workflow</em>
```
### Disabling and enabling workflows through the REST API
You can also disable and enable a workflow using the REST API. For more information, see the "[Actions REST API](/rest/reference/actions#workflows)."

View File

@@ -15,6 +15,8 @@ versions:
{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@2.22" or currentVersion == "github-ae@latest" %} By default, {% data variables.product.product_name %} stores build logs and artifacts for 90 days, and you can customize this retention period, depending on the type of repository. For more information, see "[Configuring the retention period for GitHub Actions artifacts and logs in your repository](/github/administering-a-repository/configuring-the-retention-period-for-github-actions-artifacts-and-logs-in-your-repository)."{% endif %}
{% if currentVersion == "enterprise-server@2.22" %} {% data variables.product.product_name %} stores full build logs and artifacts for 90 days.{% endif %}
### Download artifacts with the {% data variables.product.prodname_dotcom %} UI
{% data reusables.repositories.permissions-statement-read %}
{% data reusables.repositories.navigate-to-repo %}
@@ -27,3 +29,33 @@ versions:
{% else %}
![Download artifact drop-down menu](/assets/images/help/repository/artifact-drop-down.png)
{% endif %}
### Download artifacts with {% data variables.product.prodname_cli %}
{% data reusables.actions.actions-cli %}
{% 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.
To download all artifacts generated by a workflow run, use the `run download` subcommand. Replace `run-id` with the ID of the run that you want to download artifacts from. If you don't specify a `run-id`, {% data variables.product.prodname_cli %} returns an interactive menu for you to choose a recent run.
```shell
gh run download <em>run-id</em>
```
To download a specific artifact from a run, use the `run download` subcommand. Replace `run-id` with the ID of the run that you want to download artifacts from. Replace `artifact-name` with the name of the artifact that you want to download.
```shell
gh run download <em>run-id</em> -n <em>artifact-name</em>
```
You can specify more than one artifact.
```shell
gh run download <em>run-id</em> -n <em>artifact-name-1</em> -n <em>artifact-name-2</em>
```
To download specific artifacts across all runs in a repository, use the `run download` subcommand.
```shell
gh run download -n <em>artifact-name-1</em> -n <em>artifact-name-2</em>
```

View File

@@ -1,6 +1,6 @@
---
title: Manually running a workflow
intro: 'When a workflow is configured to run on the `workflow_dispatch` event, you can run the workflow using the REST API or from the Actions tab on {% data variables.product.prodname_dotcom %}.'
intro: 'When a workflow is configured to run on the `workflow_dispatch` event, you can run the workflow using the Actions tab on {% data variables.product.prodname_dotcom %}, {% data variables.product.prodname_cli %}, or the REST API.'
product: '{% data reusables.gated-features.actions %}'
versions:
free-pro-team: '*'
@@ -31,6 +31,40 @@ To trigger the `workflow_dispatch` event on {% data variables.product.prodname_d
1. Select the branch where the workflow will run and type the input parameters used by the workflow. Click **Run workflow**.
![actions manually run workflow](/assets/images/actions-manually-run-workflow.png)
### Running a workflow using {% data variables.product.prodname_cli %}
{% data reusables.actions.actions-cli %}
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.
```shell
gh workflow run <em>workflow</em>
```
If your workflow accepts inputs, {% data variables.product.prodname_cli %} will prompt you to enter them. Alternatively, you can use `-f` or `-F` to add an input in `key=value` format. Use `-F` to read from a file.
```shell
gh workflow run greet.yml -f name=mona -f greeting=hello -F data=@myfile.txt
```
You can also pass inputs as JSON by using standard input.
```shell
echo '{"name":"mona", "greeting":"hello"}' | gh workflow run greet.yml --json
```
To run a workflow on a branch other than the repository's default branch, use the `--ref` flag.
```shell
gh workflow run <em>workflow</em> --ref <em>branch-name</em>
```
To view the progress of the workflow run, use the `run watch` subcommand and select the run from the interactive list.
```shell
gh run watch
```
### 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.

View File

@@ -12,6 +12,8 @@ versions:
{% data reusables.actions.enterprise-github-hosted-runners %}
{% data reusables.actions.ae-beta %}
### Re-run a workflow using the {% data variables.product.prodname_dotcom %} UI
{% data reusables.repositories.permissions-statement-write %}
{% data reusables.repositories.navigate-to-repo %}
@@ -19,3 +21,19 @@ versions:
{% data reusables.repositories.navigate-to-workflow %}
{% data reusables.repositories.view-run %}
1. In the upper-right corner of the workflow, use the **Re-run jobs** drop-down menu, and select **Re-run all jobs**.{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@3.0" or currentVersion == "github-ae@latest" %}![Re-run checks drop-down menu](/assets/images/help/repository/rerun-checks-drop-down-updated.png){% else %}![Re-run checks drop-down menu](/assets/images/help/repository/rerun-checks-drop-down.png){% endif %}
### Re-run a workflow using {% data variables.product.prodname_cli %}
{% data reusables.actions.actions-cli %}
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.
```shell
gh run rerun <em>run-id</em>
```
To view the progress of the workflow run, use the `run watch` subcommand and select the run from the interactive list.
```shell
gh run watch
```

View File

@@ -109,3 +109,31 @@ After deleting logs, the **Delete all logs** button is removed to indicate that
![Delete all logs](/assets/images/help/repository/delete-all-logs.png)
After the logs have been deleted, the **Delete all logs** button is removed to indicate that no log files remain in the workflow run.
{% endif %}
### Viewing logs with {% data variables.product.prodname_cli %}
{% data reusables.actions.actions-cli %}
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.
```shell
gh run view <em>run-id</em> --log
```
You can also use the `--job` flag to specify a job ID. Replace `job-id` with the ID of the job that you want to view logs for.
```shell
gh run view --job <em>job-id</em> --log
```
You can use `grep` to search the log. For example, this command will return all log entries that contain the word `error`.
```shell
gh run view --job <em>job-id</em> --log | grep error
```
To filter the logs for any failed steps, use `--log-failed` instead of `--log`.
```shell
gh run view --job <em>job-id</em> --log-failed
```

View File

@@ -12,9 +12,67 @@ versions:
{% data reusables.actions.enterprise-github-hosted-runners %}
{% data reusables.actions.ae-beta %}
### Viewing workflow run history on {% data variables.product.prodname_dotcom %}
{% data reusables.repositories.permissions-statement-read %}
{% data reusables.repositories.navigate-to-repo %}
{% data reusables.repositories.actions-tab %}
{% data reusables.repositories.navigate-to-workflow %}
{% data reusables.repositories.view-run %}
### Viewing workflow run history with {% data variables.product.prodname_cli %}
{% data reusables.actions.actions-cli %}
#### Viewing recent workflow runs
To list the recent workflow runs, use the `run list` subcommand.
```shell
gh run list
```
To specify the maximum number of runs to return, you can use the `-L` or `--limit` flag . The default is `10`.
```shell
gh run list --limit 5
```
To only return runs for the specified workflow, you can use the `-w` or `--workflow` flag. Replace `workflow` with either the workflow name, workflow ID, or workflow file name. For example, `"Link Checker"`, `1234567`, or `"link-check-test.yml"`.
```shell
gh run list --workflow <em>workflow</em>
```
#### Viewing details for a specific workflow run
To display details for a specific workflow run, use the `run view` subcommand. Replace `run-id` with the ID of the run that you want to view. If you don't specify a `run-id`, {% data variables.product.prodname_cli %} returns an interactive menu for you to choose a recent run.
```shell
gh run view <em>run-id</em>
```
To include job steps in the output, use the `-v` or `--verbose` flag.
```shell
gh run view <em>run-id</em> --verbose
```
To view details for a specific job in the run, use the `-j` or `--job` flag. Replace `job-id` with the ID of the job that you want to view.
```shell
gh run view --job <em>job-id</em>
```
To view the full log for a job, use the `--log` flag.
```shell
gh run view --job <em>job-id</em> --log
```
Use the `--exit-status` flag to exit with a non-zero status if the run failed. For example:
```shell
gh run view 0451 --exit-status && echo "run pending or passed"
```

View File

@@ -0,0 +1 @@
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)."

View File

@@ -0,0 +1 @@
To access all of the {% data variables.product.prodname_actions %}-related commands, you must use version 1.9.0 or greater.

View File

@@ -0,0 +1 @@
{% 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)."

View File

@@ -0,0 +1 @@
For more information about {% data variables.product.prodname_cli %}, see [the {% data variables.product.prodname_cli %} manual](https://cli.github.com/manual/).

View File

@@ -0,0 +1 @@
{% 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 {% if enterpriseServerVersions contains currentVersion or currentVersion == "github-ae@latest" %}`-R HOSTNAME/OWNER/REPOSITORY` or `--repo HOSTNAME/OWNER/REPOSITORY`{% else %}`-R OWNER/REPOSITORY` or `--repo OWNER/REPOSITORY`{% endif %}. {% if enterpriseServerVersions contains currentVersion or currentVersion == "github-ae@latest" %}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.

View File

@@ -0,0 +1 @@
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).