content large_stringlengths 3 20.5k | url large_stringlengths 54 193 | branch large_stringclasses 4 values | source large_stringclasses 42 values | embeddings listlengths 384 384 | score float64 -0.21 0.65 |
|---|---|---|---|---|---|
your tests or other workflows triggered upon pull request require access to secrets, consider using a different event like a [manual trigger](/actions/using-workflows/events-that-trigger-workflows#manual-events) or a [`pull\_request\_target`](/actions/using-workflows/events-that-trigger-workflows#pull\_request\_target). For more information, see [AUTOTITLE](/actions/using-workflows/events-that-trigger-workflows#pull-request-events-for-forked-repositories). 1. Create a semantically tagged release. {% ifversion fpt or ghec %} You may also publish to {% data variables.product.prodname\_marketplace %} with a simple checkbox. {% endif %} For more information, see [AUTOTITLE](/repositories/releasing-projects-on-github/managing-releases-in-a-repository#creating-a-release){% ifversion fpt or ghec %} and [AUTOTITLE](/actions/creating-actions/publishing-actions-in-github-marketplace#publishing-an-action){% endif %}. \* When a release is published or edited, your release workflow will automatically take care of compilation and adjusting tags. \* We recommend creating releases using semantically versioned tags – for example, `v1.1.3` – and keeping major (`v1`) and minor (`v1.1`) tags current to the latest appropriate commit. For more information, see [AUTOTITLE](/actions/how-tos/create-and-publish-actions/manage-custom-actions#using-release-management-for-actions) and [About semantic versioning](https://docs.npmjs.com/about-semantic-versioning). ### Results Unlike some other automated release management strategies, this process intentionally does not commit dependencies to the `main` branch, only to the tagged release commits. By doing so, you encourage users of your action to reference named tags or `sha`s, and you help ensure the security of third party pull requests by doing the build yourself during a release. Using semantic releases means that the users of your actions can pin their workflows to a version and know that they might continue to receive the latest stable, non-breaking features, depending on their comfort level. ## Working with the community {% data variables.product.github %} provides tools and guides to help you work with the open source community. Here are a few tools we recommend setting up for healthy bidirectional communication. By providing the following signals to the community, you encourage others to use, modify, and contribute to your action: \* Maintain a `README` with plenty of usage examples and guidance. For more information, see [AUTOTITLE](/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-readmes). \* Include a workflow status badge in your `README` file. For more information, see [AUTOTITLE](/actions/monitoring-and-troubleshooting-workflows/adding-a-workflow-status-badge). Also visit [shields.io](https://shields.io/) to learn about other badges that you can add.{% ifversion fpt or ghec %} \* Add community health files like `CODE\_OF\_CONDUCT`, `CONTRIBUTING`, and `SECURITY`. For more information, see [AUTOTITLE](/communities/setting-up-your-project-for-healthy-contributions/creating-a-default-community-health-file#supported-file-types).{% endif %} \* Keep issues current by utilizing actions like [actions/stale](https://github.com/actions/stale).{% ifversion fpt or ghec %} \* Use {% data variables.product.github %}'s security features to communicate about vulnerabilities and how to fix them. For more information, see [AUTOTITLE](/actions/security-guides/using-githubs-security-features-to-secure-your-use-of-github-actions#protecting-actions-youve-created).{% endif %} ## Further reading Examples where similar patterns are employed include: \* [github/super-linter](https://github.com/github/super-linter) \* [octokit/request-action](https://github.com/octokit/request-action) \* [actions/javascript-action](https://github.com/actions/javascript-action) | https://github.com/github/docs/blob/main//content/actions/how-tos/create-and-publish-actions/release-and-maintain-actions.md | main | github-actions | [
-0.028994066640734673,
-0.03219299018383026,
-0.054630640894174576,
-0.03214866667985916,
0.014630123041570187,
-0.006646099500358105,
0.014498020522296429,
0.03495999798178673,
-0.02675122767686844,
0.010933737270534039,
0.05618160218000412,
-0.03773798048496246,
-0.021195674315094948,
-0... | 0.03428 |
{% data reusables.actions.enterprise-github-hosted-runners %} ## About exit codes {% data variables.product.prodname\_dotcom %} uses the exit code to set the action's check run status, which can be `success` or `failure`. Exit status | Check run status | Description ------------|------------------|------------ `0` | `success` | The action completed successfully and other tasks that depend on it can begin. Nonzero value (any integer but 0)| `failure` | Any other exit code indicates the action failed. When an action fails, all concurrent actions are canceled and future actions are skipped. The check run and check suite both get a `failure` status. ## Setting a failure exit code in a JavaScript action If you are creating a JavaScript action, you can use the actions toolkit [`@actions/core`](https://github.com/actions/toolkit/tree/main/packages/core) package to log a message and set a failure exit code. For example: ```javascript try { // something } catch (error) { core.setFailed(error.message); } ``` For more information, see [AUTOTITLE](/actions/creating-actions/creating-a-javascript-action). ## Setting a failure exit code in a Docker container action If you are creating a Docker container action, you can set a failure exit code in your `entrypoint.sh` script. For example: ```shell if ; then echo "Game over!" exit 1 fi ``` For more information, see [AUTOTITLE](/actions/creating-actions/creating-a-docker-container-action). | https://github.com/github/docs/blob/main//content/actions/how-tos/create-and-publish-actions/set-exit-codes.md | main | github-actions | [
-0.040766697376966476,
-0.04537731036543846,
-0.083894282579422,
0.015726745128631592,
0.05301321670413017,
-0.0005725238006561995,
0.056943390518426895,
0.04267556220293045,
-0.018337126821279526,
0.056700222194194794,
0.06551207602024078,
0.043374720960855484,
0.024909481406211853,
-0.06... | 0.183181 |
If you enable immutable releases on your action's repository, you can manage your action's releases as follows: 1. To start the release cycle, develop and validate a potential release for your action on a release branch. 1. Determine how you want to share your changes: \* If you are ready to share an unchangeable version of your action, create a release on {% data variables.product.github %} with a release-specific tag (for example, `v1.0.0`). See [AUTOTITLE](/repositories/releasing-projects-on-github/managing-releases-in-a-repository#creating-a-release). \* If you want to be able to update the Git tag of a release later, do not create a release on {% data variables.product.github %}. Instead, create a tag as follows: \* If your release contains breaking changes for existing workflows, create a major version tag (for example, `v1`). \* If your release contains new backwards-compatible functionality, create a minor version tag (for example, `v1.1`). \* If your release contains backwards-compatible bug fixes, create a patch version tag (for example, `v1.1.1`). 1. For Git tags that are not tied to a release on {% data variables.product.github %}, ensure users have access to the latest compatible version of your action by updating them as follows: \* For a major version, update the tag to point to the Git ref of the latest related minor version or patch version. \* For a minor version, update the tag to point to the Git ref of the latest related patch version. To move an existing Git tag to the most recent commit, force push the tag with the following commands: ```bash copy git tag -f TAG-NAME git push -f --tags ``` | https://github.com/github/docs/blob/main//content/actions/how-tos/create-and-publish-actions/using-immutable-releases-and-tags-to-manage-your-actions-releases.md | main | github-actions | [
-0.004771333187818527,
-0.07762005180120468,
-0.027026472613215446,
-0.02268964610993862,
0.010558835230767727,
0.038310445845127106,
0.014505812898278236,
0.02043052949011326,
-0.023136543110013008,
0.050743307918310165,
0.07895125448703766,
0.06518443673849106,
0.007395189255475998,
0.00... | 0.000674 |
## Prerequisites >[!NOTE] > You must accept the terms of service to publish actions in {% data variables.product.prodname\_marketplace %}. Before you can publish an action, you'll need to create an action in your repository. For more information, see [AUTOTITLE](/actions/creating-actions). When you plan to publish your action to {% data variables.product.prodname\_marketplace %}, you'll need to ensure that the repository only includes the metadata file, code, and files necessary for the action. Creating a single repository for the action allows you to tag, release, and package the code in a single unit. {% data variables.product.prodname\_dotcom %} also uses the action's metadata on your {% data variables.product.prodname\_marketplace %} page. Actions are published to {% data variables.product.prodname\_marketplace %} immediately and aren't reviewed by {% data variables.product.prodname\_dotcom %} as long as they meet these requirements: \* The action must be in a public repository. \* Each repository must contain a single action metadata file (`action.yml` or `action.yaml`) at the root. \* Repositories may include other actions metadata files in sub-folders, but they will not be automatically listed in the marketplace. \* Each repository must \_not\_ contain any workflow files. \* The `name` in the action's metadata file must be unique. \* The `name` cannot match an existing action name published on {% data variables.product.prodname\_marketplace %}. \* The `name` cannot match a user or organization on {% data variables.product.prodname\_dotcom %}, unless the user or organization owner is publishing the action. For example, only the {% data variables.product.prodname\_dotcom %} organization can publish an action named `github`. \* The `name` cannot match an existing {% data variables.product.prodname\_marketplace %} category. \* {% data variables.product.prodname\_dotcom %} reserves the names of {% data variables.product.prodname\_dotcom %} features. ## Publishing an action You can add the action you've created to {% data variables.product.prodname\_marketplace %} by tagging it as a new release and publishing it. To draft a new release and publish the action to {% data variables.product.prodname\_marketplace %}, follow these instructions: {% data reusables.repositories.navigate-to-repo %} 1. Navigate to the action metadata file in your repository (`action.yml`), and you'll see a banner to publish the action to {% data variables.product.prodname\_marketplace %}. Click \*\*Draft a release\*\*. 1. Under "Release Action", select \*\*Publish this Action to the {% data variables.product.prodname\_marketplace %}\*\*. > [!NOTE] > The "Publish" checkbox is disabled if the account that owns the repository has not yet accepted the {% data variables.product.prodname\_marketplace %} Developer Agreement. If you own the repository or are an organization owner, click the link to "accept the GitHub Marketplace Developer Agreement", then accept the agreement. If there is no link, send the organization owner a link to this "Release Action" page and ask them to accept the agreement. 1. If the labels in your metadata file contain any problems, you will see an error message or a warning message. Address them by updating your metadata file. Once complete, you will see an "Everything looks good!" message. 1. Select the \*\*Primary Category\*\* dropdown menu and click a category that will help people find your action in {% data variables.product.prodname\_marketplace %}. 1. Optionally, select the \*\*Another Category\*\* dropdown menu and click a secondary category. 1. In the tag field, type a version for your action. This helps people know what changes or features the release includes. People will see the version in the action's dedicated {% data variables.product.prodname\_marketplace %} page. 1. In the title field, type a release title. 1. Complete all other fields and click \*\*Publish release\*\*. Publishing requires you to use two-factor authentication. For more information, see [AUTOTITLE](/authentication/securing-your-account-with-two-factor-authentication-2fa/configuring-two-factor-authentication). ## Removing an action from {% data variables.product.prodname\_marketplace %} To remove a published action from {% data variables.product.prodname\_marketplace %}, you'll need to | https://github.com/github/docs/blob/main//content/actions/how-tos/create-and-publish-actions/publish-in-github-marketplace.md | main | github-actions | [
-0.038273416459560394,
-0.04330391064286232,
-0.10535354167222977,
0.01374517660588026,
-0.01854342222213745,
0.03209983557462692,
0.08034713566303253,
0.06561704725027084,
-0.1204114630818367,
0.09552954882383347,
0.08442177623510361,
-0.03850938379764557,
0.03570556640625,
0.017353996634... | 0.045606 |
the title field, type a release title. 1. Complete all other fields and click \*\*Publish release\*\*. Publishing requires you to use two-factor authentication. For more information, see [AUTOTITLE](/authentication/securing-your-account-with-two-factor-authentication-2fa/configuring-two-factor-authentication). ## Removing an action from {% data variables.product.prodname\_marketplace %} To remove a published action from {% data variables.product.prodname\_marketplace %}, you'll need to update each published release. Perform the following steps for each release of the action you've published to {% data variables.product.prodname\_marketplace %}. {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.releases %} {% data reusables.releases.edit-release %} 1. Select \*\*Publish this action to the {% data variables.product.prodname\_marketplace %}\*\* to remove the check from the box. 1. Click \*\*Update release\*\* at the bottom of the page. ## Transferring an action repository You can transfer an action repository to another user or organization. For more information, see [AUTOTITLE](/repositories/creating-and-managing-repositories/transferring-a-repository). When a repository admin transfers an action repository, {% data variables.product.prodname\_dotcom %} automatically creates a redirect from the previous URL to the new URL, meaning workflows that use the affected action do not need to be updated. Actions published on {% data variables.product.prodname\_marketplace %} are linked to a repository by their unique `name` identifier, meaning you can publish new releases of an action from the transferred repository under the same {% data variables.product.prodname\_marketplace %} listing. If an action repository is deleted, the {% data variables.product.prodname\_marketplace %} listing is also deleted, and the unique `name` identifier becomes available. > [!NOTE] > The "Verified" badge seen on an organization's {% data variables.product.prodname\_dotcom %} profile is different from the verified creator badge on {% data variables.product.prodname\_marketplace %}. If you transfer an action repository, the {% data variables.product.prodname\_marketplace %} listing will lose the verified creator badge unless the new owner is also a verified creator. ## About badges in {% data variables.product.prodname\_marketplace %} Actions with the {% octicon "verified" aria-label="The verified badge" %}, or verified creator badge, indicate that {% data variables.product.prodname\_dotcom %} has verified the creator of the action as a partner organization. Partners can email [partnerships@github.com](mailto:partnerships@github.com) to request the verified creator badge.  | https://github.com/github/docs/blob/main//content/actions/how-tos/create-and-publish-actions/publish-in-github-marketplace.md | main | github-actions | [
0.029308825731277466,
0.030956750735640526,
-0.038791172206401825,
0.044358719140291214,
-0.003067734884098172,
0.03886812552809715,
0.07081317156553268,
-0.03199974074959755,
-0.08586739003658295,
0.10850400477647781,
0.07548519223928452,
-0.01473415456712246,
0.03538106009364128,
-0.0135... | -0.011517 |
## Choosing a location for your action If you're developing an action for other people to use, we recommend keeping the action in its own repository instead of bundling it with other application code. This allows you to version, track, and release the action just like any other software. {% ifversion fpt or ghec %} Storing an action in its own repository makes it easier for the {% data variables.product.prodname\_dotcom %} community to discover the action, narrows the scope of the code base for developers fixing issues and extending the action, and decouples the action's versioning from the versioning of other application code. {% endif %} {% data reusables.actions.internal-actions-summary %} {% ifversion fpt or ghec %}If you're building an action that you don't plan to make available to others, you {% else %} You{% endif %} can store the action's files in any location in your repository. If you plan to combine action, workflow, and application code in a single repository, we recommend storing actions in the `.github` directory. For example, `.github/actions/action-a` and `.github/actions/action-b`. ## Ensuring compatibility with other platforms Many people access {% data variables.product.github %} at a domain other than {% data variables.product.prodname\_dotcom\_the\_website %}, such as {% data variables.enterprise.data\_residency\_site %} or a custom domain for {% data variables.product.prodname\_ghe\_server %}. To ensure that your action is compatible with other platforms, do not use any hard-coded references to API URLs such as `https://api.github.com`. Instead, you can: \* Use environment variables (see [AUTOTITLE](/actions/reference/variables-reference#default-environment-variables)): \* For the REST API, use the `GITHUB\_API\_URL` environment variable. \* For GraphQL, use the `GITHUB\_GRAPHQL\_URL` environment variable. \* Use a toolkit such as [`@actions/github`](https://github.com/actions/toolkit/tree/main/packages/github), which can automatically set the correct URLs. ## Using release management for actions If you're developing an action for other people to use, we recommend using release management to control how you distribute updates. Users can expect an action's patch version to include necessary critical fixes and security patches, while still remaining compatible with their existing workflows. You should consider releasing a new major version whenever your changes affect compatibility. Under this release management approach, users should not be referencing an action's default branch, as it's likely to contain the latest code and consequently might be unstable. Instead, you can recommend that your users specify a major version when using your action, and only direct them to a more specific version if they encounter issues. To use a specific action version, users can configure their {% data variables.product.prodname\_actions %} workflow to target a tag, a commit's SHA, or a branch named for a release. ### Using tags for release management {% ifversion fpt or ghec %} > [!NOTE] If you have enabled immutable releases to help prevent supply chain attacks and accidental changes to your releases, instead see [AUTOTITLE](/actions/how-tos/create-and-publish-actions/using-immutable-releases-and-tags-to-manage-your-actions-releases). {% endif %} We recommend using tags for actions release management. Using this approach, your users can easily distinguish between major and minor versions: 1. Develop and validate a release on a release branch (for example, `release/v1`). 1. Create a release with a release tag using semantic versioning (for example, `v1.0.1`). For more information, see [AUTOTITLE](/repositories/releasing-projects-on-github/managing-releases-in-a-repository). 1. Move the major version tag (for example, `v1`) to point to the Git ref of the current release. For more information, see [Git basics - tagging](https://git-scm.com/book/en/v2/Git-Basics-Tagging). 1. Introduce a new major version tag (for example, `v2`) for changes that will break existing workflows, such as changing an action's inputs. #### Syntax for referencing tags This example demonstrates how a user can reference a major version tag: ```yaml steps: - uses: actions/javascript-action@v1 ``` This example demonstrates how a user can reference a specific patch release tag: ```yaml steps: | https://github.com/github/docs/blob/main//content/actions/how-tos/create-and-publish-actions/manage-custom-actions.md | main | github-actions | [
-0.05963537469506264,
-0.06907287985086441,
-0.0666041150689125,
-0.02696496993303299,
0.0838334709405899,
0.04785863682627678,
0.05766356736421585,
0.115192711353302,
-0.03646232932806015,
0.08266659080982208,
0.07601220905780792,
0.07709375023841858,
-0.021405940875411034,
-0.01847365498... | 0.117539 |
changes that will break existing workflows, such as changing an action's inputs. #### Syntax for referencing tags This example demonstrates how a user can reference a major version tag: ```yaml steps: - uses: actions/javascript-action@v1 ``` This example demonstrates how a user can reference a specific patch release tag: ```yaml steps: - uses: actions/javascript-action@v1.0.1 ``` ### Using branches for release management If you prefer to use branch names for release management, this example demonstrates how to reference a named branch: ```yaml steps: - uses: actions/javascript-action@v1-beta ``` ### Using a commit's SHA for release management Each Git commit receives a calculated SHA value, which is unique and immutable. Your action's users might prefer to rely on a commit's SHA value, as this approach can be more reliable than specifying a tag, which could be deleted or moved. However, this means that users will not receive further updates made to the action. You must use a commit's full SHA value, and not an abbreviated value. ```yaml steps: - uses: actions/javascript-action@a824008085750b8e136effc585c3cd6082bd575f ``` ## Creating a README file for your action We recommend creating a README file to help people learn how to use your action. You can include this information in your `README.md`: \* A detailed description of what the action does \* Required input and output arguments \* Optional input and output arguments \* Secrets the action uses \* Environment variables the action uses \* An example of how to use your action in a workflow | https://github.com/github/docs/blob/main//content/actions/how-tos/create-and-publish-actions/manage-custom-actions.md | main | github-actions | [
-0.06287114322185516,
-0.04223637282848358,
0.055416785180568695,
-0.020203059539198875,
0.02116963639855385,
-0.008222288452088833,
0.021886643022298813,
0.0035743596963584423,
0.09046659618616104,
0.03118058852851391,
-0.010642443783581257,
0.04863154515624046,
-0.03920978307723999,
-0.0... | 0.074646 |
## Introduction You can write an action to provide a way for users to access your servers via a configured CLI environment on {% data variables.product.prodname\_actions %} runners. Your action should: \* Make it simple for users to specify the version of the CLI to install \* Support multiple operating systems \* Run in an efficient fashion to minimize run-time and associated costs \* Work across {% data variables.product.github %}-hosted and self-hosted runners \* Leverage community tooling when possible This article will demonstrate how to write an action that retrieves a specific version of your CLI, installs it, adds it to the path, and (optionally) caches it. This type of action (an action that sets up a tool) is often named `setup-$TOOL`. ## Prerequisites You should have an understanding of how to write a custom action. For more information, see [AUTOTITLE](/actions/how-tos/creating-and-publishing-actions/managing-custom-actions). ## Example The following script demonstrates how you can get a user-specified version as input, download and extract the specific version of your CLI, then add the CLI to the path. {% data variables.product.prodname\_dotcom %} provides [`actions/toolkit`](https://github.com/actions/toolkit), which is a set of packages that helps you create actions. This example uses the [`actions/core`](https://github.com/actions/toolkit/tree/main/packages/core) and [`actions/tool-cache`](https://github.com/actions/toolkit/tree/main/packages/tool-cache) packages. {% raw %} ```javascript copy const core = require('@actions/core'); const tc = require('@actions/tool-cache'); async function setup() { // Get version of tool to be installed const version = core.getInput('version'); // Download the specific version of the tool, e.g. as a tarball const pathToTarball = await tc.downloadTool(getDownloadURL()); // Extract the tarball onto the runner const pathToCLI = await tc.extractTar(pathToTarball); // Expose the tool by adding it to the PATH core.addPath(pathToCLI) } module.exports = setup ``` {% endraw %} To use this script, replace `getDownloadURL` with a function that downloads your CLI. You will also need to create an actions metadata file (`action.yml`) that accepts a `version` input and that runs this script. For full details about how to create an action, see [AUTOTITLE](/actions/creating-actions/creating-a-javascript-action). ## Further reading This pattern is employed in several actions. For more examples, see: \* [`ruby/setup-ruby`](https://github.com/ruby/setup-ruby) \* [`google-github-actions/setup-gcloud`](https://github.com/google-github-actions/setup-gcloud) \* [`hashicorp/setup-terraform`](https://github.com/hashicorp/setup-terraform) | https://github.com/github/docs/blob/main//content/actions/how-tos/create-and-publish-actions/create-a-cli-action.md | main | github-actions | [
0.045975200831890106,
-0.07640708982944489,
-0.05095065385103226,
-0.04113082215189934,
0.019196219742298126,
-0.010251852683722973,
0.014385752379894257,
0.06994400918483734,
-0.045426446944475174,
-0.004653050564229488,
0.01198495365679264,
0.01368290837854147,
0.02328130416572094,
-0.02... | 0.055675 |
{% data reusables.actions.enterprise-github-hosted-runners %} ## Configuring a workflow to run manually To run a workflow manually, the workflow must be configured to run on the `workflow\_dispatch` event. To trigger the `workflow\_dispatch` event, your workflow must be in the default branch. For more information about configuring the `workflow\_dispatch` event, see [AUTOTITLE](/actions/using-workflows/events-that-trigger-workflows#workflow\_dispatch). {% data reusables.repositories.permissions-statement-write %} ## Running a workflow {% webui %} {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.actions-tab %} 1. In the left sidebar, click the name of the workflow you want to run.  1. Above the list of workflow runs, click the \*\*Run workflow\*\* button. > [!NOTE] > To see the \*\*Run workflow\*\* button, your workflow file must use the `workflow\_dispatch` event trigger. Only workflow files that use the `workflow\_dispatch` event trigger will have the option to run the workflow manually using the \*\*Run workflow\*\* button. For more information about configuring the `workflow\_dispatch` event, see [AUTOTITLE](/actions/using-workflows/events-that-trigger-workflows#workflow\_dispatch).  1. Select the \*\*Branch\*\* dropdown menu and click a branch to run the workflow on. 1. If the workflow requires input, fill in the fields. 1. Click \*\*Run workflow\*\*. {% endwebui %} {% 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. ```shell gh workflow run WORKFLOW ``` 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 WORKFLOW --ref BRANCH ``` 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 ``` {% endcli %} ## 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. > [!NOTE] > You can define up to {% ifversion fpt or ghec %}25 {% else %}10 {% endif %} `inputs` for a `workflow\_dispatch` event. For more information about using the REST API, see [AUTOTITLE](/rest/actions/workflows#create-a-workflow-dispatch-event). | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-workflow-runs/manually-run-a-workflow.md | main | github-actions | [
-0.014093202538788319,
-0.112046979367733,
-0.01726660504937172,
0.05836517736315727,
-0.014997581019997597,
-0.06807653605937958,
-0.0017471567261964083,
-0.03743261843919754,
-0.02327224798500538,
-0.02063455805182457,
-0.005474310368299484,
0.008460641838610172,
0.002228918019682169,
0.... | 0.078758 |
> [!NOTE] > Re-run workflows use the privileges of the actor who initially triggered the workflow, not the privileges of the actor who initiated the re-run. The workflow will also use the same `GITHUB\_SHA` (commit SHA) and `GITHUB\_REF` (git ref) of the original event that triggered the workflow run. ## Re-running all the jobs in a workflow {% webui %} {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.actions-tab %} {% data reusables.repositories.navigate-to-workflow %} {% data reusables.repositories.view-run %} 1. In the upper-right corner of the workflow, re-run jobs. \* If any jobs failed, select the \*\*{% octicon "sync" aria-hidden="true" aria-label="sync" %} Re-run jobs\*\* dropdown menu and click \*\*Re-run all jobs\*\*. \* If no jobs failed, click \*\*Re-run all jobs\*\*. {% data reusables.actions.enable-debug-logging %} {% endwebui %} {% cli %} 1. To re-run a failed workflow run, use the `run rerun` subcommand, replacing `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 copy gh run rerun RUN\_ID ``` {% data reusables.actions.enable-debug-logging-cli %} ```shell copy gh run rerun RUN\_ID --debug ``` 1. To view the progress of the workflow run, use the `run watch` subcommand and select the run from the interactive list. ```shell copy gh run watch ``` {% endcli %} ## Re-running failed jobs in a workflow {% webui %} {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.actions-tab %} {% data reusables.repositories.navigate-to-workflow %} {% data reusables.repositories.view-run %} 1. In the upper-right corner of the workflow, select the \*\*{% octicon "sync" aria-hidden="true" aria-label="sync" %} Re-run jobs\*\* dropdown menu, and click \*\*Re-run failed jobs\*\*. {% data reusables.actions.enable-debug-logging %} {% endwebui %} {% cli %} To re-run failed jobs in a workflow run, use the `run rerun` subcommand with the `--failed` flag. Replace `RUN\_ID` with the ID of the run for which you want to re-run failed jobs. 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 RUN\_ID --failed ``` {% data reusables.actions.enable-debug-logging-cli %} ```shell gh run rerun RUN\_ID --failed --debug ``` {% endcli %} ## Re-running a specific job in a workflow {% webui %} {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.actions-tab %} {% data reusables.repositories.navigate-to-workflow %} {% data reusables.repositories.view-run %} 1. Under the "Jobs" section of the left sidebar, next to the job that you want to re-run, click {% octicon "sync" aria-label="The re-run icon" %}. {% data reusables.actions.enable-debug-logging %} {% endwebui %} {% cli %} To re-run a specific job in a workflow run, use the `run rerun` subcommand with the `--job` flag. Replace `JOB\_ID` with the ID of the job that you want to re-run. ```shell gh run rerun --job JOB\_ID ``` {% data reusables.actions.enable-debug-logging-cli %} ```shell gh run rerun --job JOB\_ID --debug ``` {% endcli %} ## Reviewing previous workflow runs {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.actions-tab %} {% data reusables.repositories.navigate-to-workflow %} {% data reusables.repositories.view-run %} 1. To the right of the run name, select the \*\*Latest\*\* dropdown menu and click a previous run attempt. | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-workflow-runs/re-run-workflows-and-jobs.md | main | github-actions | [
-0.03673333674669266,
-0.08254379034042358,
0.028962716460227966,
0.041972145438194275,
-0.01548098400235176,
-0.02239103801548481,
0.010481967590749264,
-0.13939031958580017,
-0.006125274114310741,
-0.03831792250275612,
0.018217921257019043,
0.047147247940301895,
0.027326395735144615,
-0.... | -0.006114 |
{% data reusables.actions.enterprise-github-hosted-runners %} ## Deleting an artifact > [!WARNING] > Once you delete an artifact, it cannot be restored. {% data reusables.repositories.permissions-statement-write %} {% data reusables.actions.artifact-log-retention-statement %} {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.actions-tab %} {% data reusables.repositories.navigate-to-workflow %} {% data reusables.repositories.view-run %} 1. Under \*\*Artifacts\*\*, click {% octicon "trash" aria-label="Remove artifact ARTIFACT-NAME" %} next to the artifact you want to remove.  ## Setting the retention period for an artifact Retention periods for artifacts and logs can be configured at the repository, organization, and enterprise level. For more information, see [AUTOTITLE](/actions/learn-github-actions/usage-limits-billing-and-administration#artifact-and-log-retention-policy). You can also define a custom retention period for individual artifacts using the `actions/upload-artifact` action in a workflow. For more information, see [AUTOTITLE](/actions/using-workflows/storing-workflow-data-as-artifacts#configuring-a-custom-artifact-retention-period). ## Finding the expiration date of an artifact You can use the API to confirm the date that an artifact is scheduled to be deleted. For more information, see the `expires\_at` value returned by the REST API. For more information, see [AUTOTITLE](/rest/actions/artifacts). {% data reusables.actions.artifacts.artifacts-from-deleted-workflow-runs %} | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-workflow-runs/remove-workflow-artifacts.md | main | github-actions | [
-0.031121594831347466,
0.015952114015817642,
0.008408288471400738,
0.03593217954039574,
0.035806283354759216,
-0.08554953336715698,
0.024409476667642593,
-0.14168894290924072,
0.04419213533401489,
-0.008851519785821438,
-0.0007497822516597807,
0.039881765842437744,
0.029335135594010353,
-0... | 0.09559 |
{% data reusables.actions.enterprise-github-hosted-runners %} 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: \* A workflow error that produces too many or wrong requests, impacting external services negatively. \* A workflow that is not critical and is consuming too many minutes on your account. \* A workflow that sends requests to a service that is down. \* Workflows on a forked repository that aren't needed (for example, scheduled workflows). > [!WARNING] > {% data reusables.actions.scheduled-workflows-disabled %} You can also disable and enable a workflow using the REST API. For more information, see [AUTOTITLE](/rest/actions/workflows). ## Disabling a workflow {% webui %} {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.actions-tab %} 1. In the left sidebar, click the workflow you want to disable. 1. Click {% octicon "kebab-horizontal" aria-label="Show workflow options" %} to display a dropdown menu and click \*\*Disable workflow\*\*.  {% endwebui %} {% 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. ```shell gh workflow disable WORKFLOW ``` {% endcli %} ## Enabling a workflow {% webui %} You can re-enable a workflow that was previously disabled. {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.actions-tab %} 1. In the left sidebar, click the workflow you want to enable.  1. Click \*\*Enable workflow\*\*. {% endwebui %} {% 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 gh workflow enable WORKFLOW ``` {% endcli %} | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-workflow-runs/disable-and-enable-workflows.md | main | github-actions | [
-0.04709353297948837,
0.016982685774564743,
-0.018459590151906013,
0.016891922801733017,
0.06382235884666443,
-0.008148453198373318,
0.0051514445804059505,
-0.01591366156935692,
0.02232424169778824,
-0.013541797176003456,
-0.00980382040143013,
0.09322544187307358,
0.013109803199768066,
-0.... | 0.181649 |
Workflow runs triggered by a contributor's pull request from a fork may require manual approval from a maintainer with write access. You can configure workflow approval requirements for a [repository](/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#configuring-required-approval-for-workflows-from-public-forks), [organization](/organizations/managing-organization-settings/disabling-or-limiting-github-actions-for-your-organization#configuring-required-approval-for-workflows-from-public-forks), or [enterprise](/enterprise-cloud@latest/admin/policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-github-actions-in-your-enterprise#enforcing-a-policy-for-fork-pull-requests-in-your-enterprise). Workflow runs that have been awaiting approval for more than 30 days are automatically deleted. ## Approving workflow runs on a pull request from a public fork {% data reusables.actions.workflows.approve-workflow-runs %} | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-workflow-runs/approve-runs-from-forks.md | main | github-actions | [
-0.0024381056427955627,
-0.09360317885875702,
0.026698077097535133,
-0.04224889352917671,
0.05028953030705452,
-0.059927988797426224,
-0.046103037893772125,
-0.06655958294868469,
0.03837479650974274,
0.04200604185461998,
-0.0002072179486276582,
0.013617782853543758,
-0.016980890184640884,
... | 0.062531 |
{% data reusables.actions.enterprise-github-hosted-runners %} {% data reusables.repositories.permissions-statement-write %} {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.actions-tab %} {% data reusables.repositories.navigate-to-workflow %} 1. To delete a workflow run, select {% octicon "kebab-horizontal" aria-label="Show options" %}, then click \*\*Delete workflow run\*\*.  1. Review the confirmation prompt and click \*\*Yes, permanently delete this workflow run\*\*. | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-workflow-runs/delete-a-workflow-run.md | main | github-actions | [
-0.01706518791615963,
-0.018200300633907318,
-0.041103851050138474,
0.029765833169221878,
0.008095606230199337,
-0.028929077088832855,
0.0027216074522584677,
-0.14322377741336823,
0.06598889082670212,
-0.03786307945847511,
-0.02874315157532692,
0.056035034358501434,
0.009461507201194763,
-... | 0.095135 |
{% data reusables.actions.enterprise-github-hosted-runners %} By default, {% data variables.product.github %} 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 [AUTOTITLE](/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#configuring-the-retention-period-for-github-actions-artifacts-and-logs-in-your-repository). {% data reusables.repositories.permissions-statement-read %} {% webui %} {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.actions-tab %} {% data reusables.repositories.navigate-to-workflow %} {% data reusables.repositories.view-run %} 1. In the "Artifacts" section, click the artifact you want to download.  {% endwebui %} {% 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. 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 RUN\_ID ``` 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 RUN\_ID -n ARTIFACT\_NAME ``` You can specify more than one artifact. ```shell gh run download RUN\_ID> -n ARTIFACT\_NAME-1 -n ARTIFACT\_NAME-2 ``` To download specific artifacts across all runs in a repository, use the `run download` subcommand. ```shell gh run download -n ARTIFACT\_NAME-1 ARTIFACT\_NAME-2 ``` {% endcli %} | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-workflow-runs/download-workflow-artifacts.md | main | github-actions | [
-0.023950785398483276,
-0.043402865529060364,
-0.03239217400550842,
0.05376868695020676,
0.02818397618830204,
-0.017755981534719467,
0.02602492831647396,
-0.05551636219024658,
-0.004354089964181185,
0.02275879494845867,
0.03236052393913269,
0.036286860704422,
0.02555745095014572,
0.0215877... | 0.063765 |
{% data reusables.actions.enterprise-github-hosted-runners %} > [!NOTE] > If a workflow is skipped due to [path filtering](/actions/using-workflows/workflow-syntax-for-github-actions#onpushpull\_requestpull\_request\_targetpathspaths-ignore), [branch filtering](/actions/using-workflows/workflow-syntax-for-github-actions#onpull\_requestpull\_request\_targetbranchesbranches-ignore) or a commit message (see below), then checks associated with that workflow will remain in a "Pending" state. A pull request that requires those checks to be successful will be blocked from merging. Workflows that would otherwise be triggered using `on: push` or `on: pull\_request` won't be triggered if you add any of the following strings to the commit message in a push, or the HEAD commit of a pull request: \* `[skip ci]` \* `[ci skip]` \* `[no ci]` \* `[skip actions]` \* `[actions skip]` Alternatively, you can add a `skip-checks` trailer to your commit message. The trailers section should be included at the end of your commit message and be preceded by two empty lines. If you already have other trailers in your commit message, `skip-checks` should be last. You can use either of the following: \* `skip-checks:true` \* `skip-checks: true` {% data reusables.commits.about-commit-cleanup %} You won't be able to merge the pull request if your repository is configured to require specific checks to pass first. To allow the pull request to be merged you can push a new commit to the pull request without the skip instruction in the commit message. > [!NOTE] > Skip instructions only apply to the `push` and `pull\_request` events. For example, adding `[skip ci]` to a commit message won't stop a workflow that's triggered `on: pull\_request\_target` from running. Skip instructions only apply to the workflow run(s) that would be triggered by the commit that contains the skip instructions. You can also disable a workflow from running. For more information, see [AUTOTITLE](/actions/managing-workflow-runs/disabling-and-enabling-a-workflow). | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-workflow-runs/skip-workflow-runs.md | main | github-actions | [
0.00042112136725336313,
-0.05606740713119507,
-0.008594484999775887,
0.027406636625528336,
0.04331635311245918,
-0.06556873023509979,
0.0062223463319242,
-0.06815101951360703,
0.047666996717453,
-0.01788421720266342,
0.0203504990786314,
0.042491987347602844,
0.01975134015083313,
-0.0679606... | 0.082692 |
## Canceling a workflow run {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.actions-tab %} {% data reusables.repositories.navigate-to-workflow %} 1. From the list of workflow runs, click the name of the `queued` or `in progress` run that you want to cancel. 1. In the upper-right corner of the workflow, click \*\*Cancel workflow\*\*.  ## Next steps To learn about the process {% data variables.product.prodname\_dotcom %} uses to cancel a workflow run, as well as the ways you can free up related resources, see [AUTOTITLE](/actions/reference/workflow-cancellation-reference). | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-workflow-runs/cancel-a-workflow-run.md | main | github-actions | [
-0.05871155858039856,
0.03369845822453499,
0.005211313255131245,
0.01566225476562977,
0.025561083108186722,
-0.04305826872587204,
0.11866673827171326,
-0.13048695027828217,
0.024332020431756973,
0.024610377848148346,
-0.007055769674479961,
0.05345439538359642,
0.0004726778715848923,
-0.075... | 0.074676 |
This article describes managing caches with the {% data variables.product.prodname\_dotcom %} web interface, but you can also manage them: \* Using the REST API. See [AUTOTITLE](/rest/actions/cache). \* With the `gh cache` subcommand from the command line. See the [GitHub CLI documentation](https://cli.github.com/manual/gh\_cache). ## Viewing cache entries You can use the web interface to view a list of cache entries for a repository. In the cache list, you can see how much disk space each cache is using, when the cache was created, and when the cache was last used. {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.actions-tab %} {% data reusables.repositories.actions-cache-list %} 1. Review the list of cache entries for the repository. \* To search for cache entries used for a specific branch, click the \*\*Branch\*\* dropdown menu and select a branch. The cache list will display all of the caches used for the selected branch. \* To search for cache entries with a specific cache key, use the syntax `key: key-name` in the \*\*Filter caches\*\* field. The cache list will display caches from all branches where the key was used.  ## Deleting cache entries Users with `write` access to a repository can use the {% data variables.product.prodname\_dotcom %} web interface to delete cache entries. {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.actions-tab %} {% data reusables.repositories.actions-cache-list %} 1. To the right of the cache entry you want to delete, click {% octicon "trash" aria-label="Delete cache" %}.  ## Force deleting cache entries Caches have branch scope restrictions in place, which means some caches have limited usage options. For more information on cache scope restrictions, see [AUTOTITLE](/actions/reference/dependency-caching-reference#restrictions-for-accessing-a-cache). If caches limited to a specific branch are using a lot of storage quota, it may cause caches from the `default` branch to be created and deleted at a high frequency. For example, a repository could have many new pull requests opened, each with their own caches that are restricted to that branch. These caches could take up the majority of the cache storage for that repository. {% data reusables.actions.cache-eviction-policy %} In order to prevent cache thrashing when this happens, you can set up workflows to delete caches on a faster cadence than the cache eviction policy will. You can use the {% data variables.product.prodname\_cli %} to delete caches for specific branches. The following example workflow uses `gh cache` to delete up to 100 caches created by a branch once a pull request is closed. To run the following example on cross-repository pull requests or pull requests from forks, you can trigger the workflow with the `pull\_request\_target` event. If you do use `pull\_request\_target` to trigger the workflow, there are security considerations to keep in mind. For more information, see [AUTOTITLE](/actions/using-workflows/events-that-trigger-workflows#pull\_request\_target). ```yaml name: Cleanup github runner caches on closed pull requests on: pull\_request: types: - closed jobs: cleanup: runs-on: ubuntu-latest permissions: actions: write steps: - name: Cleanup run: | echo "Fetching list of cache keys" cacheKeysForPR=$(gh cache list --ref $BRANCH --limit 100 --json id --jq '.[].id') ## Setting this to not fail the workflow while deleting cache keys. set +e echo "Deleting caches..." for cacheKey in $cacheKeysForPR do gh cache delete $cacheKey done echo "Done" env: GH\_TOKEN: {% raw %}${{ github.token }}{% endraw %} GH\_REPO: {% raw %}${{ github.repository }}{% endraw %} BRANCH: refs/pull/{% raw %}${{ github.event.pull\_request.number }}{% endraw %}/merge ``` Alternatively, you can use the API to automatically list or delete all caches on your own cadence. For more information, see [AUTOTITLE](/rest/actions/cache#about-the-cache-in-github-actions). | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-workflow-runs/manage-caches.md | main | github-actions | [
0.005493540316820145,
-0.024894285947084427,
-0.060782209038734436,
-0.02811279334127903,
0.01837206445634365,
-0.035276148468256,
0.07075140625238419,
0.022415993735194206,
-0.016903169453144073,
0.03131181746721268,
0.021609647199511528,
0.03606845438480377,
0.0014624864561483264,
-0.071... | 0.104502 |
raw %}${{ github.token }}{% endraw %} GH\_REPO: {% raw %}${{ github.repository }}{% endraw %} BRANCH: refs/pull/{% raw %}${{ github.event.pull\_request.number }}{% endraw %}/merge ``` Alternatively, you can use the API to automatically list or delete all caches on your own cadence. For more information, see [AUTOTITLE](/rest/actions/cache#about-the-cache-in-github-actions). | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-workflow-runs/manage-caches.md | main | github-actions | [
-0.004467599559575319,
-0.0026415076572448015,
-0.017811138182878494,
-0.007145437877625227,
0.03665206953883171,
0.0038935085758566856,
0.006469291169196367,
-0.0063668349757790565,
0.0677938312292099,
0.02201305888593197,
-0.01603061333298683,
0.027037115767598152,
-0.02649409882724285,
... | 0.062113 |
You may be rate limited by {% data variables.product.prodname\_actions %} when you scale your usage. Some limits can be increased by contacting {% data variables.contact.contact\_support %}. Unless otherwise stated, the expected behavior when a limit is reached is that the workflow/job will get cancelled. These limits are subject to change. ## Existing system limits | Limit category | Limit | Threshold | Description | Can {% data variables.product.github %} Support increase? | | :---- | :---- | :---- | :---- | :---- | | Workflow execution limit | Workflow run time | 35 days / workflow run | If a workflow run reaches this limit, the workflow run is cancelled. This period includes execution duration, and time spent on waiting and approval. | {% octicon "x" aria-label="No" %} | | Workflow execution limit | Gate approval time | 30 days | A workflow may wait for up to [30 days on environment approvals](/actions/managing-workflow-runs-and-deployments/managing-deployments/managing-environments-for-deployment#wait-timer). | {% octicon "x" aria-label="No" %} | | Workflows queuing | Workflow trigger event rate limit | 1500 events / 10 seconds / repository | Each repository is limited to events triggering a workflow run. | {% octicon "check" aria-label="Yes" %} Support ticket | | Workflows queuing | Workflow run queued | 500 workflow runs / 10 seconds | When the limit is reached, the workflow runs that were supposed to be triggered by the webhook events will be blocked and will not be queued. Reusable workflows are viewed as a single entity. For example, a run with 30 reusable workflows counts as 1 in this instance. | {% octicon "x" aria-label="No" %} | | Workflow execution | Job Matrix | 256 jobs / workflow run | A job matrix can generate a maximum of jobs per workflow run. This limit applies to both {% data variables.product.github %}-hosted and self-hosted runners. | {% octicon "x" aria-label="No" %} | | Self-hosted | Runner registrations | 1500 runners / 5 minutes / repository/org/enterprise | Runners can be registered per repository/organization/enterprise. | {% octicon "check" aria-label="Yes" %} Support ticket | | Self-hosted | Runners per runner group | 10,000 runners | Runners registered at the same time per runner group. | {% octicon "x" aria-label="No" %} | | Self-hosted | Job execution time | 5 days | Each job in a workflow can run for up to 5 days of execution time. If a job reaches this limit, the job is terminated and fails. | {% octicon "x" aria-label="No" %} | | Self-hosted | Job queue time | 24 hours | A job can be in the queue for 24 hours before it is automatically cancelled. | {% octicon "x" aria-label="No" %} | | All {% data variables.product.github %}-hosted runners | Job Concurrency | Varies | See [Job concurrency limits for {% data variables.product.github %}-hosted runners](#job-concurrency-limits-for-github-hosted-runners). | {% octicon "check" aria-label="Yes" %} Support ticket | | All {% data variables.product.github %}-hosted runners | Job execution time | 6 hours | Each job in a workflow can run for up to 6 hours of execution time. If a job reaches this limit, the job is terminated and fails. | {% octicon "x" aria-label="No" %} | | {% ifversion fpt or ghec %} | | All {% data variables.product.github %}-hosted runners | Storage limits | Varies | For more information, see [Storage limits for all {% data variables.product.github %}-hosted runners](#storage-limits-for-all-github-hosted-runners). | {% octicon "x" aria-label="No" %} | | {% endif %} | | Larger runners | Per runner concurrency limit | Varies by runner type | Established when setting up a runner. Normally 1,000 max for Linux CPU runners, but varies by | https://github.com/github/docs/blob/main//content/actions/reference/limits.md | main | github-actions | [
-0.03508119657635689,
-0.04193342849612236,
-0.044914569705724716,
0.021953795105218887,
0.030122237280011177,
-0.08019513636827469,
-0.010130773298442364,
0.039439354091882706,
0.00027242081705480814,
0.014214124530553818,
0.06691936403512955,
0.00181751255877316,
-0.009341074153780937,
-... | 0.083552 |
limits for all {% data variables.product.github %}-hosted runners](#storage-limits-for-all-github-hosted-runners). | {% octicon "x" aria-label="No" %} | | {% endif %} | | Larger runners | Per runner concurrency limit | Varies by runner type | Established when setting up a runner. Normally 1,000 max for Linux CPU runners, but varies by type. See [Job concurrency limits for {% data variables.product.github %}-hosted runners](#job-concurrency-limits-for-github-hosted-runners). | {% octicon "check" aria-label="Yes" %} Support ticket | | Larger runners | Static IP limits | 10 IPs | 10 IPs per enterprise and organization. | {% octicon "check" aria-label="Yes" %} Support ticket | | Larger runners | Private IP scaling for vnet injection | 30% buffer | You need a buffer to accommodate the maximum job concurrency you anticipate. See [Private IP scaling for vnet injection on larger runners](#private-ip-scaling-for-vnet-injection-on-larger-runners). | {% octicon "check" aria-label="Yes" %} Configurable Azure virtual network | | Dependency caching | Uploads per minute | 200 per minute | Each repository is limited to 200 cache entry uploads per minute. If this limit is exceeded, subsequent cache upload attempts will fail until the rate limit resets. | {% octicon "x" aria-label="No" %} | ### Job concurrency limits for {% data variables.product.github %}-hosted runners {% data variables.product.github %} Support \*\*can\*\* increase job concurrency limits for {% data variables.product.prodname\_actions %}. To request an increase, submit a support ticket. | Runner type | {% data variables.product.github %} plan | Total concurrent jobs | Maximum concurrent macOS jobs | Maximum concurrent GPU jobs | |---|---|---|---|---| | Standard {% data variables.product.github %}-hosted runner | Free | 20 | 5 | Not applicable | | Standard {% data variables.product.github %}-hosted runner | Pro | 40 | 5 | Not applicable | | Standard {% data variables.product.github %}-hosted runner | Team | 60 | 5 | Not applicable | | Standard {% data variables.product.github %}-hosted runner | Enterprise | 500 | 50 | Not applicable | | Larger runner | Team | 1000 | 5 | 100 | | Larger runner | Enterprise | 1000 | 50 | 100 | > [!NOTE] > The maximum concurrent macOS jobs is shared across standard {% data variables.product.github %}-hosted runners and {% data variables.product.github %}-hosted larger runners. ### Storage limits for all {% data variables.product.github %}-hosted runners {% data variables.product.github %} Support \*\*cannot\*\* increase storage limits for {% data variables.product.prodname\_actions %}. {% data reusables.billing.actions-included-quotas %} {% ifversion fpt or ghec %} For information about cache storage limits and how to increase them, see [Usage limits and eviction policy](/actions/reference/workflows-and-actions/dependency-caching#usage-limits-and-eviction-policy). {% endif %} ### Private IP scaling for vnet injection on larger runners When using larger runners with vnet injection, you need to determine the appropriate subnet IP address range, for which we recommend adding a buffer to the maximum job concurrency you anticipate. For instance, if the network configuration's runners are set to a maximum job concurrency of 300, utilize a subnet IP address range that can accommodate at least 390 runners. Note that Azure reserves 5 IPs in every subnet (first 4 and last 1), which sets a minimum practical subnet size depending on runner requirements. Very small subnets (like /29 or smaller) may not provide enough usable addresses for your needs. ## Commonly hit dependent service limits {% data variables.product.github %}'s [REST API rate limits](/rest/using-the-rest-api/rate-limits-for-the-rest-api) apply to {% data variables.product.prodname\_actions %} users, those that are commonly hit are: \* \*\*Unauthenticated users\*\* \- {% data reusables.rest-api.primary-rate-limit-unauthenticated-users %} \* \*\*Authenticated users\*\* \- {% data reusables.rest-api.primary-rate-limit-authenticated-users %} \* \*\*GitHub app installations\*\* \- {% data reusables.rest-api.primary-rate-limit-github-app-installations %} \* \*\*OAuth apps \-\*\* {% data reusables.rest-api.primary-rate-limit-oauth-apps %} \* \*\*GITHUB TOKEN\*\* \- {% data reusables.rest-api.primary-rate-limit-github-token-in-actions %} \* \*\*Secondary rate limits\*\* | https://github.com/github/docs/blob/main//content/actions/reference/limits.md | main | github-actions | [
0.05203107371926308,
-0.03496982902288437,
-0.12840817868709564,
-0.003983755595982075,
-0.02203948050737381,
-0.023905208334326744,
-0.03226329758763313,
0.0028441958129405975,
-0.04506929963827133,
-0.01792152225971222,
0.01178460381925106,
0.059530749917030334,
0.010067294351756573,
-0.... | 0.134088 |
that are commonly hit are: \* \*\*Unauthenticated users\*\* \- {% data reusables.rest-api.primary-rate-limit-unauthenticated-users %} \* \*\*Authenticated users\*\* \- {% data reusables.rest-api.primary-rate-limit-authenticated-users %} \* \*\*GitHub app installations\*\* \- {% data reusables.rest-api.primary-rate-limit-github-app-installations %} \* \*\*OAuth apps \-\*\* {% data reusables.rest-api.primary-rate-limit-oauth-apps %} \* \*\*GITHUB TOKEN\*\* \- {% data reusables.rest-api.primary-rate-limit-github-token-in-actions %} \* \*\*Secondary rate limits\*\* \- In addition to primary rate limits, {% data variables.product.github %} enforces secondary rate limits in order to prevent abuse and keep the API available for all users, these are not configurable with GHEC. For more information, see [AUTOTITLE](/rest/using-the-rest-api/rate-limits-for-the-rest-api?apiVersion=2022-11-28#about-secondary-rate-limits). ### Docker Hub's rate limit for {% data variables.product.prodname\_actions %} \* \*\*{% data variables.product.github %}-hosted runners pulling public images:\*\* Docker Hub's rate limit is not applied. \* \*\*{% data variables.product.github %}-hosted runners pulling private images:\*\* Pulling private images from Docker Hub is subject to the rate limit. \* \*\*Self-hosted runners pulling public or private images:\*\* Pulling images from Docker Hub is always subject to the rate limit. | https://github.com/github/docs/blob/main//content/actions/reference/limits.md | main | github-actions | [
-0.013215652666985989,
0.0022179768420755863,
-0.049601487815380096,
-0.01876583695411682,
0.029441241174936295,
-0.011821920052170753,
-0.03776171803474426,
-0.01663476601243019,
0.020163649693131447,
0.01698511466383934,
0.08576049655675888,
-0.003247505286708474,
0.06710696965456009,
-0... | 0.020192 |
## Naming your secrets >[!TIP] > To help ensure that {% data variables.product.prodname\_dotcom %} redacts your secrets in logs correctly, avoid using structured data as the values of secrets. The following rules apply to secret names: {% data reusables.actions.actions-secrets-and-variables-naming %} {% data reusables.codespaces.secret-precedence %} Similarly, if an organization, repository, and environment all have a secret with the same name, the environment-level secret takes precedence. ## Limits for secrets You can store up to 1,000 organization secrets, 100 repository secrets, and 100 environment secrets. A workflow created in a repository can access the following number of secrets: \* All 100 repository secrets. \* If the repository is assigned access to more than 100 organization secrets, the workflow can only use the first 100 organization secrets (sorted alphabetically by secret name). \* All 100 environment secrets. Secrets are limited to 48 KB in size. To store larger secrets, see [AUTOTITLE](/actions/how-tos/security-for-github-actions/security-guides/using-secrets-in-github-actions#storing-large-secrets). ## When {% data variables.product.prodname\_actions %} reads secrets Organization and repository secrets are read when a workflow run is queued, and environment secrets are read when a job referencing the environment starts. ## Automatically redacted secrets {% data variables.product.prodname\_dotcom %} automatically redacts the following sensitive information from workflow logs. > [!NOTE] If you would like other types of sensitive information to be automatically redacted, please reach out to us in our [community discussions](https://github.com/orgs/community/discussions?discussions\_q=is%3Aopen+label%3AActions). \* 32-byte and 64-byte Azure keys \* Azure AD client app passwords \* Azure Cache keys \* Azure Container Registry keys \* Azure Function host keys \* Azure Search keys \* Database connection strings \* HTTP Bearer token headers \* JWTs \* NPM author tokens \* NuGet API keys \* v1 GitHub installation tokens \* v2 GitHub installation tokens (`ghp`, `gho`, `ghu`, `ghs`, `ghr`) \* v2 GitHub PATs ## Security For security best practices using secrets, see [AUTOTITLE](/actions/reference/secure-use-reference#use-secrets-for-sensitive-information). | https://github.com/github/docs/blob/main//content/actions/reference/security/secrets.md | main | github-actions | [
-0.05453440174460411,
-0.03701518476009369,
-0.0992870107293129,
0.005431422032415867,
0.006885360926389694,
-0.031253665685653687,
0.010591544210910797,
0.03117186948657036,
0.0007040803320705891,
0.03495260700583458,
-0.0012715688208118081,
0.021051762625575066,
0.06396514177322388,
-0.0... | 0.104249 |
## OIDC token claims To see all the claims supported by {% data variables.product.prodname\_dotcom %}'s OIDC provider, review the `claims\_supported` entries at {% ifversion ghes %}`https://HOSTNAME/\_services/token/.well-known/openid-configuration`{% else %}https://token.actions.githubusercontent.com/.well-known/openid-configuration{% endif %}. The OIDC token includes the following claims. ### Standard audience, issuer, and subject claims | Claim | Claim type | Description | | ----------- | -----| ---------------------- | | `aud`| Audience | By default, this is the URL of the repository owner, such as the organization that owns the repository. You can set a custom audience with a toolkit command: [`core.getIDToken(audience)`](https://www.npmjs.com/package/@actions/core/v/1.6.0) | | `iss`| Issuer | The issuer of the OIDC token: {% ifversion ghes %}`https://HOSTNAME/\_services/token`{% else %}`https://token.actions.githubusercontent.com`{% endif %} | | `sub`| Subject | Defines the subject claim that is to be validated by the cloud provider. This setting is essential for making sure that access tokens are only allocated in a predictable way. | ### Additional standard JOSE header parameters and claims | Header Parameter | Parameter type | Description | | ----------- | -----| ---------------------- | | `alg`| Algorithm | The algorithm used by the OIDC provider. | | `kid`| Key identifier | Unique key for the OIDC token. | | `typ`| Type | Describes the type of token. This is a JSON Web Token (JWT). | | Claim | Claim type | Description | | ----------- | -----| ---------------------- | | `exp`| Expires at | Identifies the expiry time of the JWT. | | `iat`| Issued at | The time when the JWT was issued. | | `jti`| JWT token identifier | Unique identifier for the OIDC token. | | `nbf`| Not before | JWT is not valid for use before this time. | ### Custom claims provided by {% data variables.product.prodname\_dotcom %} | Claim | Description | | ----------- | ---------------------- | | `actor`| The personal account that initiated the workflow run. | | `actor\_id`| The ID of personal account that initiated the workflow run. | | `base\_ref`| The target branch of the pull request in a workflow run. | | {% ifversion actions-OIDC-check-run-id-claim %} | | `check\_run\_id`| The check run ID of the current job. | | {% endif %} | | {% ifversion actions-OIDC-custom-claim-enterprise %} | | `enterprise`| The name of the enterprise that contains the repository from where the workflow is running. | | {% endif %} | | {% ifversion actions-OIDC-enterprise\_id-claim %} | | `enterprise\_id`| The ID of the enterprise that contains the repository from where the workflow is running. | | {% endif %} | | `environment`| The name of the environment used by the job. If the `environment` claim is included (also via `include\_claim\_keys`), an environment is required and must be provided. | | `event\_name`| The name of the event that triggered the workflow run. | | `head\_ref`| The source branch of the pull request in a workflow run. | | `job\_workflow\_ref`| For jobs using a reusable workflow, the ref path to the reusable workflow. For more information, see [AUTOTITLE](/actions/deployment/security-hardening-your-deployments/using-openid-connect-with-reusable-workflows). | | `job\_workflow\_sha`| For jobs using a reusable workflow, the commit SHA for the reusable workflow file. | | `ref`| \_(Reference)\_ The git ref that triggered the workflow run. | | `ref\_type`| The type of `ref`, for example: "branch". | | `repository\_visibility` | The visibility of the repository where the workflow is running. Accepts the following values: `internal`, `private`, or `public`. | | `repository`| The repository from where the workflow is running. | | `repository\_id`| The ID of the repository from where the workflow is running. | | `repository\_owner`| The name of the organization in which the `repository` is stored. | | `repository\_owner\_id`| The ID of the organization in | https://github.com/github/docs/blob/main//content/actions/reference/security/oidc.md | main | github-actions | [
-0.08789761364459991,
0.011655404232442379,
-0.07795147597789764,
0.06648541986942291,
0.08494304865598679,
-0.04499959573149681,
0.06613118946552277,
0.06343268603086472,
-0.012457015924155712,
0.042219553142786026,
0.0021330935414880514,
-0.04231848940253258,
0.0350043959915638,
-0.03123... | 0.120682 |
or `public`. | | `repository`| The repository from where the workflow is running. | | `repository\_id`| The ID of the repository from where the workflow is running. | | `repository\_owner`| The name of the organization in which the `repository` is stored. | | `repository\_owner\_id`| The ID of the organization in which the `repository` is stored. | | `run\_id`| The ID of the workflow run that triggered the workflow. | | `run\_number`| The number of times this workflow has been run. | | `run\_attempt`| The number of times this workflow run has been retried. | | `runner\_environment`| The type of runner used by the job. Accepts the following values: `github-hosted` or `self-hosted`. | | `workflow`| The name of the workflow. | | `workflow\_ref`| {% data reusables.actions.workflow-ref-description %} | | `workflow\_sha`| {% data reusables.actions.workflow-sha-description %} | {% ifversion ghec %} ## Substituted values on {% data variables.enterprise.data\_residency\_site %} \* Your provider's expected claim must substitute `githubusercontent.com` with `{% data variables.enterprise.data\_residency\_domain %}`, where SUBDOMAIN is your enterprise's subdomain on {% data variables.enterprise.data\_residency\_site %}. \* For any URLs that include a route with your enterprise's name or slug, you must substitute your enterprise's subdomain on {% data variables.enterprise.data\_residency\_site %}. For example, if your subdomain is `octocorp`, the following substitutions apply: \* The URL for seeing all the claims supported by {% data variables.product.company\_short %}'s OIDC provider would be `https://token.actions.octocorp.ghe.com/.well-known/openid-configuration`. \* The value of `iss` in your OIDC token would be `https://token.actions.octocorp.ghe.com`. \* The enterprise can receive tokens at `https://token.actions.octocorp.ghe.com/octocorp`, and the REST API endpoint for customizing the `issuer` value would be `/enterprises/octocorp/actions/oidc/customization/issuer`. {% endif %} ## OIDC claims used to define trust conditions on cloud roles Audience and subject claims are typically used in combination while setting conditions on the cloud role/resources to scope its access to the {% data variables.product.github %} workflows. \* \*\*Audience:\*\* By default, this value uses the URL of the organization or repository owner. This can be used to set a condition that only the workflows in the specific organization can access the cloud role. \* \*\*Subject:\*\* By default, has a predefined format and is a concatenation of some of the key metadata about the workflow, such as the {% data variables.product.prodname\_dotcom %} organization, repository, branch, or associated [`job`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idenvironment) environment. See [Example subject claims](#example-subject-claims) to see how the subject claim is assembled from concatenated metadata. If you need more granular trust conditions, you can customize the {% ifversion ghec %}issuer (`iss`) and {% endif %}subject (`sub`) claim{% ifversion ghec %}s that are{% else %} that's{% endif %} included with the JWT. For more information, see [Customizing the token claims](#customizing-the-token-claims). There are also many additional claims supported in the OIDC token that can be used for setting these conditions. In addition, your cloud provider could allow you to assign a role to the access tokens, letting you specify even more granular permissions. > [!NOTE] > To control how your cloud provider issues access tokens, you \*\*must\*\* define at least one condition, so that untrusted repositories can’t request access tokens for your cloud resources. ## Example subject claims The following examples demonstrate how to use "Subject" as a condition, and explain how the "Subject" is assembled from concatenated metadata. The [subject](https://openid.net/specs/openid-connect-core-1\_0.html#StandardClaims) uses information from the [`job` context](/actions/learn-github-actions/contexts#job-context), and instructs your cloud provider that access token requests may only be granted for requests from workflows running in specific branches, environments. The following sections describe some common subjects you can use. ### Filtering for a specific environment The subject claim includes the environment name when the job references an environment. You can configure a subject that filters for a specific [environment](/actions/deployment/targeting-different-environments/managing-environments-for-deployment) name. In this | https://github.com/github/docs/blob/main//content/actions/reference/security/oidc.md | main | github-actions | [
-0.03219487518072128,
-0.05465279519557953,
-0.09919129312038422,
0.05140773579478264,
0.03373444825410843,
-0.03641226142644882,
-0.0002526412717998028,
-0.043092310428619385,
0.06489692628383636,
-0.022599969059228897,
-0.0249681007117033,
0.00970332883298397,
0.05465281009674072,
-0.075... | 0.127613 |
from workflows running in specific branches, environments. The following sections describe some common subjects you can use. ### Filtering for a specific environment The subject claim includes the environment name when the job references an environment. You can configure a subject that filters for a specific [environment](/actions/deployment/targeting-different-environments/managing-environments-for-deployment) name. In this example, the workflow run must have originated from a job that has an environment named `Production`, in a repository named `octo-repo` that is owned by the `octo-org` organization: \* Syntax: `repo:ORG-NAME/REPO-NAME:environment:ENVIRONMENT-NAME` \* Example: `repo:octo-org/octo-repo:environment:Production` ### Filtering for `pull\_request` events The subject claim includes the `pull\_request` string when the workflow is triggered by a pull request event, but only if the job doesn't reference an environment. You can configure a subject that filters for the [`pull\_request`](/actions/using-workflows/events-that-trigger-workflows#pull\_request) event. In this example, the workflow run must have been triggered by a `pull\_request` event in a repository named `octo-repo` that is owned by the `octo-org` organization: \* Syntax: `repo:ORG-NAME/REPO-NAME:pull\_request` \* Example: `repo:octo-org/octo-repo:pull\_request` ### Filtering for a specific branch The subject claim includes the branch name of the workflow, but only if the job doesn't reference an environment, and if the workflow is not triggered by a pull request event. You can configure a subject that filters for a specific branch name. In this example, the workflow run must have originated from a branch named `demo-branch`, in a repository named `octo-repo` that is owned by the `octo-org` organization: \* Syntax: `repo:ORG-NAME/REPO-NAME:ref:refs/heads/BRANCH-NAME` \* Example: `repo:octo-org/octo-repo:ref:refs/heads/demo-branch` ### Filtering for a specific tag The subject claim includes the tag name of the workflow, but only if the job doesn't reference an environment, and if the workflow is not triggered by a pull request event. You can create a subject that filters for specific tag. In this example, the workflow run must have originated with a tag named `demo-tag`, in a repository named `octo-repo` that is owned by the `octo-org` organization: \* Syntax: `repo:ORG-NAME/REPO-NAME:ref:refs/tags/TAG-NAME` \* Example: `repo:octo-org/octo-repo:ref:refs/tags/demo-tag` {% ifversion fpt or ghec or ghes > 3.18 %} ### Filtering for metadata containing `:` Any `:` within the metadata values will be replaced with `%3A` in the subject claim. You can configure a subject that includes metadata containing colons. In this example, the workflow run must have originated from a job that has an environment named `Production:V1`, in a repository named `octo-repo` that is owned by the `octo-org` organization: \* Syntax: `repo:ORG-NAME/REPO-NAME:environment:ENVIRONMENT-NAME` \* Example: `repo:octo-org/octo-repo:environment:Production%3AV1` {% endif %} ## Configuring the subject in your cloud provider To configure the subject in your cloud provider's trust relationship, you must add the subject string to its trust configuration. The following examples demonstrate how various cloud providers can accept the same `repo:octo-org/octo-repo:ref:refs/heads/demo-branch` subject in different ways: | Cloud provider | Example | | ------ | ----------- | | Amazon Web Services | `"{% ifversion ghes %}HOSTNAME/\_services/token{% else %}token.actions.githubusercontent.com{% endif %}:sub": "repo:octo-org/octo-repo:ref:refs/heads/demo-branch"` | | Azure| `repo:octo-org/octo-repo:ref:refs/heads/demo-branch` | | Google Cloud Platform| `(assertion.sub=='repo:octo-org/octo-repo:ref:refs/heads/demo-branch')` | | HashiCorp Vault| `bound\_subject="repo:octo-org/octo-repo:ref:refs/heads/demo-branch"` | For more information about configuring specific cloud providers, see the guides listed in [AUTOTITLE](/actions/how-tos/security-for-github-actions/security-hardening-your-deployments). ## Customizing the token claims You can security harden your OIDC configuration by customizing the claims that are included with the JWT. These customizations allow you to define more granular trust conditions on your cloud roles when allowing your workflows to access resources hosted in the cloud: \* You can customize values for {% ifversion ghec %}`issuer` or {% endif %}`audience` claims. See {% ifversion ghec %}[Customizing the `issuer` value for an enterprise](#customizing-the-issuer-value-for-an-enterprise) and {% endif %}[Customizing the `audience` value](#customizing-the-audience-value). \* You can customize the format of your OIDC configuration by setting conditions on the subject (`sub`) claim that require JWT tokens | https://github.com/github/docs/blob/main//content/actions/reference/security/oidc.md | main | github-actions | [
-0.036094922572374344,
-0.01743561029434204,
0.019367292523384094,
-0.019258558750152588,
0.06127464398741722,
-0.09036141633987427,
0.026675552129745483,
-0.07345343381166458,
0.038573525846004486,
-0.012718441896140575,
-0.09148305654525757,
-0.16384698450565338,
-0.02114439569413662,
0.... | 0.079917 |
for {% ifversion ghec %}`issuer` or {% endif %}`audience` claims. See {% ifversion ghec %}[Customizing the `issuer` value for an enterprise](#customizing-the-issuer-value-for-an-enterprise) and {% endif %}[Customizing the `audience` value](#customizing-the-audience-value). \* You can customize the format of your OIDC configuration by setting conditions on the subject (`sub`) claim that require JWT tokens to originate from a specific repository, reusable workflow, or other source. \* You can define granular OIDC policies by using additional OIDC token claims, such as `repository\_id` and `repository\_visibility`. See [AUTOTITLE](/actions/concepts/security/openid-connect#understanding-the-oidc-token). ### Customizing the `audience` value When you use custom actions in your workflows, those actions may use the {% data variables.product.prodname\_actions %} Toolkit to enable you to supply a custom value for the `audience` claim. Some cloud providers also use this in their official login actions to enforce a default value for the `audience` claim. For example, the [GitHub Action for Azure Login](https://github.com/Azure/login/blob/master/action.yml) provides a default `aud` value of `api://AzureADTokenExchange`, or it allows you to set a custom `aud` value in your workflows. For more information on the {% data variables.product.prodname\_actions %} Toolkit, see the [OIDC token](https://github.com/actions/toolkit/tree/main/packages/core#oidc-token) section in the documentation. If you do not want to use the default `aud` value offered by an action, you can provide a custom value for the `audience` claim. This allows you to set a condition that only workflows in a specific repository or organization can access the cloud role. If the action you are using supports this, you can use the `with` keyword in your workflow to pass a custom `aud` value to the action. For more information, see [AUTOTITLE](/actions/creating-actions/metadata-syntax-for-github-actions#inputs). {% ifversion ghec %} ### Customizing the `issuer` value for an enterprise By default, the JWT is issued by {% data variables.product.prodname\_dotcom %}'s OIDC provider at `https://token.actions.githubusercontent.com`. This path is presented to your cloud provider using the `iss` value in the JWT. To security harden their OIDC configuration, enterprise administrators can configure their enterprise to receive tokens from a unique URL at `https://token.actions.githubusercontent.com/`, replacing `` with the slug value of the enterprise. This configuration means that your enterprise will receive the OIDC token from a unique URL, and you can then configure your cloud provider to only accept tokens from that URL. This helps ensure that only the enterprise's repositories can access your cloud resources using OIDC. To activate this setting for your enterprise, an enterprise administrator must use the `/enterprises/{enterprise}/actions/oidc/customization/issuer` endpoint and specify `"include\_enterprise\_slug": true` in the request body. For more information, see [AUTOTITLE](/rest/actions/oidc#set-the-github-actions-oidc-custom-issuer-policy-for-an-enterprise). After this setting is applied, the JWT will contain the updated `iss` value. In the following example, the `iss` key uses `octocat-inc` as its `enterpriseSlug` value: ```json { "jti": "6f4762ed-0758-4ccb-808d-ee3af5d723a8", "sub": "repo:octocat-inc/private-server:ref:refs/heads/main", "aud": "http://octocat-inc.example/octocat-inc", "enterprise": "octocat-inc", "enterprise\_id": "123", "iss": "https://token.actions.githubusercontent.com/octocat-inc", "bf": 1755350653, "exp": 1755351553, "iat": 1755351253 } ``` {% endif %} ### Customizing the subject claims for an organization or repository To help improve security, compliance, and standardization, you can customize the standard claims to suit your required access conditions. If your cloud provider supports conditions on subject claims, you can create a condition that checks whether the `sub` value matches the path of the reusable workflow, such as `"job\_workflow\_ref:octo-org/octo-automation/.github/workflows/oidc.yml@refs/heads/main"`. The exact format will vary depending on your cloud provider's OIDC configuration. To configure the matching condition on {% data variables.product.prodname\_dotcom %}, you can use the REST API to require that the `sub` claim must always include a specific custom claim, such as `job\_workflow\_ref`. You can use the REST API to apply a customization template for the OIDC subject claim; for example, you can require that the `sub` claim within the OIDC token must always include a specific custom claim, such as `job\_workflow\_ref`. For more information, | https://github.com/github/docs/blob/main//content/actions/reference/security/oidc.md | main | github-actions | [
-0.09505590051412582,
0.020623700693249702,
-0.04559536278247833,
0.027733590453863144,
0.04286440461874008,
-0.0005943768192082644,
0.04894828051328659,
0.04134441912174225,
-0.007112447172403336,
-0.03363441675901413,
-0.04194376990199089,
-0.03228619322180748,
0.023946478962898254,
-0.0... | 0.095671 |
include a specific custom claim, such as `job\_workflow\_ref`. You can use the REST API to apply a customization template for the OIDC subject claim; for example, you can require that the `sub` claim within the OIDC token must always include a specific custom claim, such as `job\_workflow\_ref`. For more information, see [AUTOTITLE](/rest/actions/oidc). > [!NOTE] > When the organization template is applied, it will not affect any workflows already using OIDC unless their repository has opted in to custom organization templates. For all repositories, existing and new, the repository owner will need to use the repository-level REST API to opt in to receive this configuration by setting `use\_default` to `false`. Alternatively, the repository owner could use the REST API to apply a different configuration specific to the repository. For more information, see [AUTOTITLE](/rest/actions/oidc#set-the-customization-template-for-an-oidc-subject-claim-for-a-repository). Customizing the claims results in a new format for the entire `sub` claim, which replaces the default predefined `sub` format in the token described in [Example subject claims](#example-subject-claims). > [!NOTE] > The `sub` claim uses the shortened form `repo` (for example, `repo:ORG-NAME/REPO-NAME`) instead of `repository` to reference the repository. {% ifversion fpt or ghec or ghes > 3.15 %} > Any `:` within the context value will be replaced with `%3A`. {% endif %} The following example templates demonstrate various ways to customize the subject claim. To configure these settings on {% data variables.product.prodname\_dotcom %}, admins use the REST API to specify a list of claims that must be included in the subject (`sub`) claim. {% data reusables.actions.use-request-body-api %} To customize your subject claims, you should first create a matching condition in your cloud provider's OIDC configuration, before customizing the configuration using the REST API. Once the configuration is completed, each time a new job runs, the OIDC token generated during that job will follow the new customization template. If the matching condition doesn't exist in the cloud provider's OIDC configuration before the job runs, the generated token might not be accepted by the cloud provider, since the cloud conditions may not be synchronized. #### Example: Allowing repository based on visibility and owner This example template allows the `sub` claim to have a new format, using `repository\_owner` and `repository\_visibility`: ```json { "include\_claim\_keys": [ "repository\_owner", "repository\_visibility" ] } ``` In your cloud provider's OIDC configuration, configure the `sub` condition to require that claims must include specific values for `repository\_owner` and `repository\_visibility`. For example: `"sub": "repository\_owner:monalisa:repository\_visibility:private"`. The approach lets you restrict cloud role access to only private repositories within an organization or enterprise. #### Example: Allowing access to all repositories with a specific owner This example template enables the `sub` claim to have a new format with only the value of `repository\_owner`. {% data reusables.actions.use-request-body-api %} ```json { "include\_claim\_keys": [ "repository\_owner" ] } ``` In your cloud provider's OIDC configuration, configure the `sub` condition to require that claims must include a specific value for `repository\_owner`. For example: `"sub": "repository\_owner:monalisa"` #### Example: Requiring a reusable workflow This example template allows the `sub` claim to have a new format that contains the value of the `job\_workflow\_ref` claim. This enables an enterprise to use reusable workflows to enforce consistent deployments across its organizations and repositories. {% data reusables.actions.use-request-body-api %} ```json { "include\_claim\_keys": [ "job\_workflow\_ref" ] } ``` In your cloud provider's OIDC configuration, configure the `sub` condition to require that claims must include a specific value for `job\_workflow\_ref`. For example: `"sub": "job\_workflow\_ref:octo-org/octo-automation/.github/workflows/oidc.yml@refs/heads/main"`. #### Example: Requiring a reusable workflow and other claims The following example template combines the requirement of a specific reusable workflow with additional claims. {% data reusables.actions.use-request-body-api %} This example also demonstrates how to use `"context"` to define your conditions. This | https://github.com/github/docs/blob/main//content/actions/reference/security/oidc.md | main | github-actions | [
-0.16430272161960602,
0.04243144392967224,
-0.016539316624403,
-0.0086144357919693,
0.032842494547367096,
0.009388715960085392,
-0.02175535075366497,
0.027602361515164375,
0.08005961030721664,
-0.010316203348338604,
-0.09833916276693344,
-0.051120173186063766,
-0.011400619521737099,
0.0496... | 0.11256 |
a specific value for `job\_workflow\_ref`. For example: `"sub": "job\_workflow\_ref:octo-org/octo-automation/.github/workflows/oidc.yml@refs/heads/main"`. #### Example: Requiring a reusable workflow and other claims The following example template combines the requirement of a specific reusable workflow with additional claims. {% data reusables.actions.use-request-body-api %} This example also demonstrates how to use `"context"` to define your conditions. This is the part that follows the repository in the default `sub` format. For example, when the job references an environment, the context contains: `environment:ENVIRONMENT-NAME`. ```json { "include\_claim\_keys": [ "repo", "context", "job\_workflow\_ref" ] } ``` In your cloud provider's OIDC configuration, configure the `sub` condition to require that claims must include specific values for `repo`, `context`, and `job\_workflow\_ref`. This customization template requires that the `sub` uses the following format: `repo:ORG-NAME/REPO-NAME:environment:ENVIRONMENT-NAME:job\_workflow\_ref:REUSABLE-WORKFLOW-PATH`. For example: `"sub": "repo:octo-org/octo-repo:environment:prod:job\_workflow\_ref:octo-org/octo-automation/.github/workflows/oidc.yml@refs/heads/main"` #### Example: Granting access to a specific repository This example template lets you grant cloud access to all the workflows in a specific repository, across all branches/tags and environments. {% ifversion ghec %}To further improve security, you can combine this template with a unique issuer URL for your enterprise, as described in [Customizing the `issuer` value for an enterprise](#customizing-the-issuer-value-for-an-enterprise).{% endif %} {% data reusables.actions.use-request-body-api %} ```json { "include\_claim\_keys": [ "repo" ] } ``` In your cloud provider's OIDC configuration, configure the `sub` condition to require a `repo` claim that matches the required value. #### Example: Using system-generated GUIDs This example template enables predictable OIDC claims with system-generated GUIDs that do not change between renames of entities (such as renaming a repository). {% data reusables.actions.use-request-body-api %} ```json { "include\_claim\_keys": [ "repository\_id" ] } ``` In your cloud provider's OIDC configuration, configure the `sub` condition to require a `repository\_id` claim that matches the required value. or: ```json { "include\_claim\_keys": [ "repository\_owner\_id" ] } ``` In your cloud provider's OIDC configuration, configure the `sub` condition to require a `repository\_owner\_id` claim that matches the required value. {% ifversion fpt or ghec or ghes > 3.15 %} #### Example: Context value with `:` This example demonstrates how to handle context value with `:`. For example, when the job references an environment named `production:eastus`. {% data reusables.actions.use-request-body-api %} ```json { "include\_claim\_keys": [ "environment", "repository\_owner" ] } ``` In your cloud provider's OIDC configuration, configure the `sub` condition to require that claims must include a specific value for `environment` and `repository\_owner`. For example: `"sub": "environment:production%3Aeastus:repository\_owner:octo-org"`. {% endif %} #### Resetting organization template customizations This example template resets the subject claims to the default format. This template effectively opts out of any organization-level customization policy. {% data reusables.actions.use-request-body-api %} ```json { "include\_claim\_keys": [ "repo", "context" ] } ``` In your cloud provider's OIDC configuration, configure the `sub` condition to require that claims must include specific values for `repo` and `context`. #### Resetting repository template customizations All repositories in an organization have the ability to opt in or opt out of (organization and repository-level) customized `sub` claim templates. To opt out a repository and reset back to the default `sub` claim format, a repository administrator must use the REST API endpoint at [AUTOTITLE](/rest/actions/oidc#set-the-customization-template-for-an-oidc-subject-claim-for-a-repository). To configure repositories to use the default `sub` claim format, use the `PUT /repos/{owner}/{repo}/actions/oidc/customization/sub` REST API endpoint at with the following request body. ```json { "use\_default": true } ``` #### Example: Configuring a repository to use an organization template Once an organization has created a customized `sub` claim template, the REST API can be used to programmatically apply the template to repositories within the organization. A repository administrator can configure their repository to use the template created by the administrator of their organization. To configure the repository to use the organization's template, a repository admin must use the `PUT /repos/{owner}/{repo}/actions/oidc/customization/sub` REST API endpoint | https://github.com/github/docs/blob/main//content/actions/reference/security/oidc.md | main | github-actions | [
-0.1469152718782425,
0.03577960282564163,
0.02869243174791336,
0.003755629062652588,
0.024955537170171738,
-0.05091005191206932,
0.009600228630006313,
-0.02166048251092434,
0.04479379579424858,
0.0013952878070995212,
-0.03641897067427635,
-0.06161569803953171,
0.042003780603408813,
0.03573... | 0.03665 |
be used to programmatically apply the template to repositories within the organization. A repository administrator can configure their repository to use the template created by the administrator of their organization. To configure the repository to use the organization's template, a repository admin must use the `PUT /repos/{owner}/{repo}/actions/oidc/customization/sub` REST API endpoint at with the following request body. For more information, see [AUTOTITLE](/rest/actions/oidc#set-the-customization-template-for-an-oidc-subject-claim-for-a-repository). ```json { "use\_default": false } ``` ## Debugging your OIDC claims You can use the [`github/actions-oidc-debugger`](https://github.com/github/actions-oidc-debugger) action to visualize the claims that would be sent, before integrating with a cloud provider. This action requests a JWT and prints the claims included within the JWT that were received from {% data variables.product.prodname\_actions %}. ## Workflow permissions for the requesting the OIDC token ### Required permission \* The job or workflow must grant the [`id-token: write`](/actions/reference/workflow-syntax-for-github-actions#permissions) permission to allow {% data variables.product.github %}'s OIDC provider to create a JSON Web Token (JWT): ```yaml permissions: id-token: write ``` \* Without `id-token: write`, the OIDC JWT ID token cannot be requested. This setting only enables fetching and setting the OIDC token; it does not grant write access to other resources. ### Setting permissions \* To fetch an OIDC token for a workflow, set the permission at the workflow level: ```yaml permissions: id-token: write # This is required for requesting the JWT contents: read # This is required for actions/checkout ``` \* To fetch an OIDC token for a single job, set the permission within that job: ```yaml permissions: id-token: write # This is required for requesting the JWT ``` \* Additional permissions may be required depending on workflow needs. ### Reusable workflows \* For reusable workflows owned by the same user, organization, or enterprise as the caller, the OIDC token generated in the reusable workflow is accessible from the caller's context. \* For reusable workflows outside your enterprise or organization, set the `permissions` setting for `id-token` to `write` explicitly at the caller workflow or job level. This ensures the OIDC token is only available to intended caller workflows. ## Methods for requesting the OIDC token Custom actions can request the OIDC token using: \* The `getIDToken()` method from the Actions toolkit. For more information, see [OIDC Token](https://www.npmjs.com/package/@actions/core/v/1.6.0#oidc-token) in the npm package documentation. \* The following environment variables on the runner. | Variable | Description | | ------ | ----------- | | `ACTIONS\_ID\_TOKEN\_REQUEST\_URL` | The URL for {% data variables.product.prodname\_dotcom %}'s OIDC provider. | | `ACTIONS\_ID\_TOKEN\_REQUEST\_TOKEN` | Bearer token for the request to the OIDC provider. | For example: ```shell copy curl -H "Authorization: bearer $ACTIONS\_ID\_TOKEN\_REQUEST\_TOKEN" "$ACTIONS\_ID\_TOKEN\_REQUEST\_URL&audience=api://AzureADTokenExchange" ``` | https://github.com/github/docs/blob/main//content/actions/reference/security/oidc.md | main | github-actions | [
-0.14087463915348053,
0.07763559371232986,
-0.013626341708004475,
0.03948166221380234,
0.06237289309501648,
-0.0021333007607609034,
-0.03170454129576683,
0.043471578508615494,
0.05806947126984596,
0.025459235534071922,
-0.008775348775088787,
-0.018500857055187225,
0.00630214111879468,
0.04... | 0.05623 |
Find information about security best practices when you are writing workflows and using {% data variables.product.prodname\_actions %} security features. ## Writing workflows ### Use secrets for sensitive information Because there are multiple ways a secret value can be transformed, automatic redaction is not guaranteed. Adhere to the following best practices to limit risks associated with secrets. \* \*\*Principle of least privilege\*\* \* Any user with write access to your repository has read access to all secrets configured in your repository. Therefore, you should ensure that the credentials being used within workflows have the least privileges required. \* Actions can use the `GITHUB\_TOKEN` by accessing it from the `github.token` context. For more information, see [AUTOTITLE](/actions/learn-github-actions/contexts#github-context). You should therefore make sure that the `GITHUB\_TOKEN` is granted the minimum required permissions. It's good security practice to set the default permission for the `GITHUB\_TOKEN` to read access only for repository contents. The permissions can then be increased, as required, for individual jobs within the workflow file. For more information, see [AUTOTITLE](/actions/security-guides/automatic-token-authentication#permissions-for-the-github\_token). \* \*\*Mask sensitive data\*\* \* Sensitive data should \*\*never\*\* be stored as plaintext in workflow files. Mask all sensitive information that is not a {% data variables.product.prodname\_dotcom %} secret by using `::add-mask::VALUE`. This causes the value to be treated as a secret and redacted from logs. For more information about masking data, see [AUTOTITLE](/actions/using-workflows/workflow-commands-for-github-actions#masking-a-value-in-a-log). \* \*\*Delete and rotate exposed secrets\*\* \* Redacting of secrets is performed by your workflow runners. This means a secret will only be redacted if it was used within a job and is accessible by the runner. If an unredacted secret is sent to a workflow run log, you should delete the log and rotate the secret. For information on deleting logs, see [AUTOTITLE](/actions/monitoring-and-troubleshooting-workflows/using-workflow-run-logs#deleting-logs). \* \*\*Never use structured data as a secret\*\* \* Structured data can cause secret redaction within logs to fail, because redaction largely relies on finding an exact match for the specific secret value. For example, do not use a blob of JSON, XML, or YAML (or similar) to encapsulate a secret value, as this significantly reduces the probability the secrets will be properly redacted. Instead, create individual secrets for each sensitive value. \* \*\*Register all secrets used within workflows\*\* \* If a secret is used to generate another sensitive value within a workflow, that generated value should be formally [registered as a secret](https://github.com/actions/toolkit/tree/main/packages/core#setting-a-secret), so that it will be redacted if it ever appears in the logs. For example, if using a private key to generate a signed JWT to access a web API, be sure to register that JWT as a secret or else it won’t be redacted if it ever enters the log output. \* Registering secrets applies to any sort of transformation/encoding as well. If your secret is transformed in some way (such as Base64 or URL-encoded), be sure to register the new value as a secret too. \* \*\*Audit how secrets are handled\*\* \* Audit how secrets are used, to help ensure they’re being handled as expected. You can do this by reviewing the source code of the repository executing the workflow, and checking any actions used in the workflow. For example, check that they’re not sent to unintended hosts, or explicitly being printed to log output. \* View the run logs for your workflow after testing valid/invalid inputs, and check that secrets are properly redacted, or not shown. It's not always obvious how a command or tool you’re invoking will send errors to `STDOUT` and `STDERR`, and secrets might subsequently end up in error logs. As a result, it is good practice to manually review the workflow logs after testing valid | https://github.com/github/docs/blob/main//content/actions/reference/security/secure-use.md | main | github-actions | [
-0.06105918809771538,
-0.019838374108076096,
-0.09449564665555954,
-0.020240213721990585,
-0.04271644353866577,
0.03936448320746422,
0.07378525286912918,
0.09506901353597641,
0.013265572488307953,
-0.0031606184784322977,
0.0019239626126363873,
0.013115606270730495,
0.03900476545095444,
0.0... | 0.098359 |
secrets are properly redacted, or not shown. It's not always obvious how a command or tool you’re invoking will send errors to `STDOUT` and `STDERR`, and secrets might subsequently end up in error logs. As a result, it is good practice to manually review the workflow logs after testing valid and invalid inputs. For information on how to clean up workflow logs that may unintentionally contain sensitive data, see [AUTOTITLE](/actions/monitoring-and-troubleshooting-workflows/using-workflow-run-logs#deleting-logs). \* \*\*Audit and rotate registered secrets\*\* \* Periodically review the registered secrets to confirm they are still required. Remove those that are no longer needed. \* Rotate secrets periodically to reduce the window of time during which a compromised secret is valid. \* \*\*Consider requiring review for access to secrets\*\* \* You can use required reviewers to protect environment secrets. A workflow job cannot access environment secrets until approval is granted by a reviewer. For more information about storing secrets in environments or requiring reviews for environments, see [AUTOTITLE](/actions/security-guides/using-secrets-in-github-actions) and [AUTOTITLE](/actions/deployment/targeting-different-environments/managing-environments-for-deployment). ### Good practices for mitigating script injection attacks Recommended approaches for mitigating the risk of script injection in your workflows: #### Use an action instead of an inline script The recommended approach is to create a JavaScript action that processes the context value as an argument. This approach is not vulnerable to the injection attack, since the context value is not used to generate a shell script, but is instead passed to the action as an argument: ```yaml uses: fakeaction/checktitle@v3 with: title: {% raw %}${{ github.event.pull\_request.title }}{% endraw %} ``` #### Use an intermediate environment variable For inline scripts, the preferred approach to handling untrusted input is to set the value of the expression to an intermediate environment variable. The following example uses Bash to process the `github.event.pull\_request.title` value as an environment variable: ```yaml - name: Check PR title env: TITLE: {% raw %}${{ github.event.pull\_request.title }}{% endraw %} run: | if [[ "$TITLE" =~ ^octocat ]]; then echo "PR title starts with 'octocat'" exit 0 else echo "PR title did not start with 'octocat'" exit 1 fi ``` In this example, the attempted script injection is unsuccessful, which is reflected by the following lines in the log: ```shell env: TITLE: a"; ls $GITHUB\_WORKSPACE" PR title did not start with 'octocat' ``` With this approach, the value of the {% raw %}`${{ github.event.pull\_request.title }}`{% endraw %} expression is stored in memory and used as a variable, and doesn't interact with the script generation process. In addition, consider using double quote shell variables to avoid [word splitting](https://github.com/koalaman/shellcheck/wiki/SC2086), but this is [one of many](https://mywiki.wooledge.org/BashPitfalls) general recommendations for writing shell scripts, and is not specific to {% data variables.product.prodname\_actions %}. {% ifversion fpt or ghec %} #### Using workflow templates for {% data variables.product.prodname\_code\_scanning %} {% data variables.product.prodname\_code\_scanning\_caps %} allows you to find security vulnerabilities before they reach production. {% data variables.product.github %} provides workflow templates for {% data variables.product.prodname\_code\_scanning %}. You can use these suggested workflows to construct your {% data variables.product.prodname\_code\_scanning %} workflows, instead of starting from scratch. {% data variables.product.company\_short %}'s workflow, the {% data variables.code-scanning.codeql\_workflow %}, is powered by {% data variables.product.prodname\_codeql %}. There are also third-party workflow templates available. For more information, see [AUTOTITLE](/code-security/code-scanning/introduction-to-code-scanning/about-code-scanning) and [AUTOTITLE](/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/configuring-advanced-setup-for-code-scanning#configuring-code-scanning-using-third-party-actions). {% endif %} #### Restricting permissions for tokens To help mitigate the risk of an exposed token, consider restricting the assigned permissions. For more information, see [AUTOTITLE](/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github\_token). {% ifversion custom-org-roles %} ## Mitigating the risks of untrusted code checkout Similar to script injection attacks, untrusted pull request content that automatically triggers actions processing can also pose a security risk. The `pull\_request\_target` and `workflow\_run` workflow triggers, when used with the checkout of an | https://github.com/github/docs/blob/main//content/actions/reference/security/secure-use.md | main | github-actions | [
-0.038945771753787994,
0.032092273235321045,
-0.05018119886517525,
0.04332839325070381,
0.025171179324388504,
-0.045319054275751114,
-0.014332926832139492,
-0.0641709640622139,
0.052551623433828354,
0.007467744406312704,
-0.017444605007767677,
-0.02571968175470829,
0.018146727234125137,
0.... | 0.021577 |
For more information, see [AUTOTITLE](/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github\_token). {% ifversion custom-org-roles %} ## Mitigating the risks of untrusted code checkout Similar to script injection attacks, untrusted pull request content that automatically triggers actions processing can also pose a security risk. The `pull\_request\_target` and `workflow\_run` workflow triggers, when used with the checkout of an untrusted pull request, expose the repository to security compromises. These workflows are privileged, which means they share the same cache of the main branch with other privileged workflow triggers, and may have repository write access and access to referenced secrets. These vulnerabilities can be exploited to take over a repository. For more information on these triggers, how to use them, and the associated risks, see [AUTOTITLE](/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#pull\_request\_target) and [AUTOTITLE](/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#workflow\_run). For additional examples and guidance on the risks of untrusted code checkout, see [Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/) from {% data variables.product.prodname\_security %} and the [Dangerous-Workflow](https://github.com/ossf/scorecard/blob/main/docs/checks.md#dangerous-workflow) documentation from OpenSSF Scorecard. ### Good practices \* Avoid using the `pull\_request\_target` workflow trigger if it's not necessary. For privilege separation between workflows, `workflow\_run` is a better trigger. Only use these workflow triggers when the workflow actually needs the privileged context. \* Avoid using the `pull\_request\_target` and `workflow\_run` workflow triggers with untrusted pull requests or code content. Workflows that use these triggers must not explicitly check out untrusted code, including from pull request forks or from repositories that are not under your control. Workflows triggered on `workflow\_run` should treat artifacts uploaded from other workflows with caution. \* {% data variables.product.prodname\_codeql %} can scan and detect potentially vulnerable {% data variables.product.prodname\_actions %} workflows. You can configure default setup for the repository, and ensure that {% data variables.product.prodname\_actions %} scanning is enabled. For more information, see [AUTOTITLE](/code-security/code-scanning/enabling-code-scanning/configuring-default-setup-for-code-scanning). \* OpenSSF Scorecards can help you identify potentially vulnerable workflows, along with other security risks when using {% data variables.product.prodname\_actions %}. See [Using OpenSSF Scorecards to secure workflow dependencies](#using-openssf-scorecards-to-secure-workflow-dependencies) later in this article. {% endif %} ## Using third-party actions The individual jobs in a workflow can interact with (and compromise) other jobs. For example, a job querying the environment variables used by a later job, writing files to a shared directory that a later job processes, or even more directly by interacting with the Docker socket and inspecting other running containers and executing commands in them. This means that a compromise of a single action within a workflow can be very significant, as that compromised action would have access to all secrets configured on your repository, and may be able to use the `GITHUB\_TOKEN` to write to the repository. Consequently, there is significant risk in sourcing actions from third-party repositories on {% data variables.product.prodname\_dotcom %}. For information on some of the steps an attacker could take, see [AUTOTITLE](/actions/security-guides/security-hardening-for-github-actions#potential-impact-of-a-compromised-runner). You can help mitigate this risk by following these good practices: \* \*\*Pin actions to a full-length commit SHA\*\* Pinning an action to a full-length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload. {% data reusables.actions.actions-pin-commit-sha %} For an example of using a full-length commit SHA in a workflow, see [AUTOTITLE](/actions/how-tos/write-workflows/choose-what-workflows-do/find-and-customize-actions#using-shas). {%- ifversion actions-blocklist-sha-pinning %} {% data variables.product.github %} offers policies at the {% ifversion ghec or ghes %}repository, organization, and enterprise{% else %}repository and organization{% endif %} level to require actions to be pinned to a full-length commit SHA: \* To configure the policy at the repository level, see [AUTOTITLE](/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#managing-github-actions-permissions-for-your-repository). \* To configure the policy at the organization level, see [AUTOTITLE](/organizations/managing-organization-settings/disabling-or-limiting-github-actions-for-your-organization#managing-github-actions-permissions-for-your-organization). | https://github.com/github/docs/blob/main//content/actions/reference/security/secure-use.md | main | github-actions | [
-0.08065403252840042,
-0.0006890534423291683,
-0.04714502766728401,
-0.012743071652948856,
0.04384895786643028,
-0.007072190288454294,
0.029728515073657036,
0.028878239914774895,
0.06574983149766922,
-0.01702461764216423,
-0.022438419982790947,
0.012021400034427643,
0.025550713762640953,
-... | 0.174372 |
the {% ifversion ghec or ghes %}repository, organization, and enterprise{% else %}repository and organization{% endif %} level to require actions to be pinned to a full-length commit SHA: \* To configure the policy at the repository level, see [AUTOTITLE](/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#managing-github-actions-permissions-for-your-repository). \* To configure the policy at the organization level, see [AUTOTITLE](/organizations/managing-organization-settings/disabling-or-limiting-github-actions-for-your-organization#managing-github-actions-permissions-for-your-organization). {%- ifversion ghec or ghes %} \* To configure the policy at the enterprise level, see [AUTOTITLE](/admin/enforcing-policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-github-actions-in-your-enterprise#policies). {%- endif %} {%- endif %} \* \*\*Audit the source code of the action\*\* Ensure that the action is handling the content of your repository and secrets as expected. For example, check that secrets are not sent to unintended hosts, or are not inadvertently logged. \* \*\*Pin actions to a tag only if you trust the creator\*\* Although pinning to a commit SHA is the most secure option, specifying a tag is more convenient and is widely used. If you’d like to specify a tag, then be sure that you trust the action's creators. The ‘Verified creator’ badge on {% data variables.product.prodname\_marketplace %} is a useful signal, as it indicates that the action was written by a team whose identity has been verified by {% data variables.product.prodname\_dotcom %}. Note that there is risk to this approach even if you trust the author, because a tag can be moved or deleted if a bad actor gains access to the repository storing the action. ### Reusing third-party workflows The same principles described above for using third-party actions also apply to using third-party workflows. You can help mitigate the risks associated with reusing workflows by following the same good practices outlined above. For more information, see [AUTOTITLE](/actions/using-workflows/reusing-workflows). ## {% data variables.product.github %}'s security features {% data variables.product.prodname\_dotcom %} provides many features to make your code more secure. You can use {% data variables.product.prodname\_dotcom %}'s built-in features to understand the actions your workflows depend on, ensure you are notified about vulnerabilities in the actions you consume, or automate the process of keeping the actions in your workflows up to date. If you publish and maintain actions, you can use {% data variables.product.prodname\_dotcom %} to communicate with your community about vulnerabilities and how to fix them. For more information about security features that {% data variables.product.prodname\_dotcom %} offers, see [AUTOTITLE](/code-security/getting-started/github-security-features#about-githubs-security-features). ### Using `CODEOWNERS` to monitor changes You can use the `CODEOWNERS` feature to control how changes are made to your workflow files. For example, if all your workflow files are stored `.github/workflows`, you can add this directory to the code owners list, so that any proposed changes to these files will first require approval from a designated reviewer. For more information, see [AUTOTITLE](/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners). {% ifversion custom-org-roles %} ### Managing permissions for {% data variables.product.prodname\_actions %} settings in your organization You can practice the principle of least privilege for your organization's CI/CD pipeline with {% data variables.product.prodname\_actions %} by administering custom organization roles. A custom organization role is a way to grant an individual or team in your organization the ability to control certain subsets of settings without granting full administrative control of the organization and its repositories. {% data reusables.actions.org-roles-for-gh-actions %} For more information, see [AUTOTITLE](/organizations/managing-peoples-access-to-your-organization-with-roles/about-custom-organization-roles). {% endif %} ### Using OpenID Connect to access cloud resources {% data reusables.actions.about-oidc-short-overview %} {% data reusables.actions.oidc-custom-claims-aws-restriction %} ### Using {% data variables.product.prodname\_dependabot\_version\_updates %} to keep actions up to date {% data reusables.actions.dependabot-version-updates-for-actions %} {% ifversion ghec or ghes %} ### Allowing workflows to access internal and private repositories {% data reusables.actions.outside-collaborators-actions %} For more information, see [AUTOTITLE](/actions/creating-actions/sharing-actions-and-workflows-with-your-enterprise). {% data reusables.actions.scoped-token-note %} {% endif %} ### Preventing {% data variables.product.prodname\_actions %} from creating or approving pull requests {% data reusables.actions.workflow-pr-approval-permissions-intro %} | https://github.com/github/docs/blob/main//content/actions/reference/security/secure-use.md | main | github-actions | [
0.018139908090233803,
-0.042796723544597626,
-0.047533247619867325,
-0.031203895807266235,
0.01598404534161091,
0.0217243954539299,
-0.014080732129514217,
-0.05259321257472038,
-0.007579002995043993,
0.06661449372768402,
0.04942082241177559,
-0.011933750472962856,
-0.007562435697764158,
0.... | 0.075737 |
data reusables.actions.dependabot-version-updates-for-actions %} {% ifversion ghec or ghes %} ### Allowing workflows to access internal and private repositories {% data reusables.actions.outside-collaborators-actions %} For more information, see [AUTOTITLE](/actions/creating-actions/sharing-actions-and-workflows-with-your-enterprise). {% data reusables.actions.scoped-token-note %} {% endif %} ### Preventing {% data variables.product.prodname\_actions %} from creating or approving pull requests {% data reusables.actions.workflow-pr-approval-permissions-intro %} Allowing workflows, or any other automation, to create or approve pull requests could be a security risk if the pull request is merged without proper oversight. For more information on how to configure this setting, see {% ifversion ghes or ghec %}[AUTOTITLE](/enterprise-cloud@latest/admin/policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-github-actions-in-your-enterprise#preventing-github-actions-from-creating-or-approving-pull-requests),{% endif %} [Disabling or limiting {% data variables.product.prodname\_actions %} for your organization](/github/setting-up-and-managing-organizations-and-teams/disabling-or-limiting-github-actions-for-your-organization#preventing-github-actions-from-creating-or-approving-pull-requests), and [AUTOTITLE](/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#preventing-github-actions-from-creating-or-approving-pull-requests). {% ifversion code-scanning-actions-language %} ### Using {% data variables.product.prodname\_code\_scanning %} to secure workflows {% data variables.product.prodname\_code\_scanning\_caps %} can automatically detect and suggest improvements for common vulnerable patterns used in {% data variables.product.prodname\_actions %} workflows. For more information on how to enable {% data variables.product.prodname\_code\_scanning %}, see [AUTOTITLE](/code-security/code-scanning/enabling-code-scanning/configuring-default-setup-for-code-scanning). {% endif %} ### Using OpenSSF Scorecards to secure workflow dependencies [Scorecards](https://github.com/ossf/scorecard) is an automated security tool that flags risky supply chain practices. You can use the [Scorecards action](https://github.com/marketplace/actions/ossf-scorecard-action) and [workflow template](https://github.com/actions/starter-workflows) to follow best security practices. Once configured, the Scorecards action runs automatically on repository changes, and alerts developers about risky supply chain practices using the built-in {% data variables.product.prodname\_code\_scanning %} experience. The Scorecards project runs a number of checks, including script injection attacks, token permissions, and pinned actions. ### Hardening for {% data variables.product.prodname\_dotcom %}-hosted runners {% data reusables.actions.enterprise-github-hosted-runners %} {% ifversion fpt or ghec %} {% data variables.product.prodname\_dotcom %}-hosted runners take measures to help you mitigate security risks. {% ifversion actions-sbom %} #### Reviewing the supply chain for {% data variables.product.prodname\_dotcom %}-hosted runners For {% data variables.product.prodname\_dotcom %}-hosted runners created from images maintained by {% data variables.product.company\_short %}, you can view a software bill of materials (SBOM) to see what software was pre-installed on the runner. You can provide your users with the SBOM which they can run through a vulnerability scanner to validate if there are any vulnerabilities in the product. If you are building artifacts, you can include this SBOM in your bill of materials for a comprehensive list of everything that went into creating your software. SBOMs are available for Ubuntu, Windows, and macOS runner images maintained by {% data variables.product.company\_short %}. You can locate the SBOM for your build in the release assets at https://github.com/actions/runner-images/releases. An SBOM with a filename in the format of `sbom.IMAGE-NAME.json.zip` can be found in the attachments of each release. For third-party images, such as the images for ARM-powered runners, you can find details of the software that's included in the image in the [`actions/partner-runner-images` repository](https://github.com/actions/partner-runner-images). {% endif %} #### Denying access to hosts {% data reusables.actions.runners-etc-hosts-file %} For more information, see [AUTOTITLE](/actions/using-github-hosted-runners/about-github-hosted-runners). {% endif %} ### Hardening for self-hosted runners {% ifversion fpt or ghec %} \*\*{% data variables.product.prodname\_dotcom %}-hosted\*\* runners execute code within ephemeral and clean isolated virtual machines, meaning there is no way to persistently compromise this environment, or otherwise gain access to more information than was placed in this environment during the bootstrap process. {% endif %} {% ifversion fpt or ghec %}\*\*Self-hosted\*\*{% elsif ghes %}Self-hosted{% endif %} runners for {% data variables.product.github %} do not have guarantees around running in ephemeral clean virtual machines, and can be persistently compromised by untrusted code in a workflow. {% ifversion fpt or ghec %}As a result, self-hosted runners should almost [never be used for public repositories](/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions) on {% data variables.product.github %}, because any user can open pull requests against the repository and compromise the environment. Similarly, be{% elsif ghes %}Be{% endif %} cautious when | https://github.com/github/docs/blob/main//content/actions/reference/security/secure-use.md | main | github-actions | [
-0.11759253591299057,
-0.05887342989444733,
0.027224162593483925,
-0.04819762706756592,
0.0005350979627110064,
0.047120291739702225,
0.04168444126844406,
0.008400192484259605,
0.015576458536088467,
0.04552874714136124,
0.027581535279750824,
0.02254103124141693,
-0.03751455619931221,
-0.000... | 0.034845 |
code in a workflow. {% ifversion fpt or ghec %}As a result, self-hosted runners should almost [never be used for public repositories](/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions) on {% data variables.product.github %}, because any user can open pull requests against the repository and compromise the environment. Similarly, be{% elsif ghes %}Be{% endif %} cautious when using self-hosted runners on private or internal repositories, as anyone who can fork the repository and open a pull request (generally those with read access to the repository) are able to compromise the self-hosted runner environment, including gaining access to secrets and the `GITHUB\_TOKEN` which, depending on its settings, can grant write access to the repository. Although workflows can control access to environment secrets by using environments and required reviews, these workflows are not run in an isolated environment and are still susceptible to the same risks when run on a self-hosted runner. {% data reusables.actions.disable-selfhosted-runners-crossrefs %} When a self-hosted runner is defined at the organization or enterprise level, {% data variables.product.github %} can schedule workflows from multiple repositories onto the same runner. Consequently, a security compromise of these environments can result in a wide impact. To help reduce the scope of a compromise, you can create boundaries by organizing your self-hosted runners into separate groups. You can restrict what {% ifversion ghec or ghes %}workflows, {% endif %}organizations and repositories can access runner groups. For more information, see [AUTOTITLE](/actions/hosting-your-own-runners/managing-self-hosted-runners/managing-access-to-self-hosted-runners-using-groups). You should also consider the environment of the self-hosted runner machines: \* What sensitive information resides on the machine configured as a self-hosted runner? For example, private SSH keys, API access tokens, among others. \* Does the machine have network access to sensitive services? For example, Azure or AWS metadata services. The amount of sensitive information in this environment should be kept to a minimum, and you should always be mindful that any user capable of invoking workflows has access to this environment. Some customers might attempt to partially mitigate these risks by implementing systems that automatically destroy the self-hosted runner after each job execution. However, this approach might not be as effective as intended, as there is no way to guarantee that a self-hosted runner only runs one job. Some jobs will use secrets as command-line arguments which can be seen by another job running on the same runner, such as `ps x -w`. This can lead to secret leaks. #### Using just-in-time runners To improve runner registration security, you can use the REST API to create ephemeral, just-in-time (JIT) runners. These self-hosted runners perform at most one job before being automatically removed from the repository, organization, or enterprise. For more information about configuring JIT runners, see [AUTOTITLE](/rest/actions/self-hosted-runners#create-configuration-for-a-just-in-time-runner-for-an-organization). > [!NOTE] > Re-using hardware to host JIT runners can risk exposing information from the environment. Use automation to ensure the JIT runner uses a clean environment. For more information, see [AUTOTITLE](/actions/hosting-your-own-runners/managing-self-hosted-runners/autoscaling-with-self-hosted-runners#using-ephemeral-runners-for-autoscaling). Once you have the config file from the REST API response, you can pass it to the runner at startup. ```shell ./run.sh --jitconfig ${encoded\_jit\_config} ``` #### Planning your management strategy for self-hosted runners A self-hosted runner can be added to various levels in your {% data variables.product.prodname\_dotcom %} hierarchy: the enterprise, organization, or repository level. This placement determines who will be able to manage the runner: \*\*Centralized management:\*\* \* If you plan to have a centralized team own the self-hosted runners, then the recommendation is to add your runners at the highest mutual organization or enterprise level. This gives your team a single location to view and manage your runners. \* If you only have a single organization, then adding your runners at the organization level is effectively the | https://github.com/github/docs/blob/main//content/actions/reference/security/secure-use.md | main | github-actions | [
-0.03143011033535004,
-0.018731292337179184,
-0.045935217291116714,
0.03289710730314255,
0.04035009443759918,
-0.04008937254548073,
-0.04022959992289543,
0.06559726595878601,
0.024676447734236717,
-0.00840790569782257,
0.019680751487612724,
0.033320456743240356,
0.0025143870152533054,
-0.0... | 0.132678 |
self-hosted runners, then the recommendation is to add your runners at the highest mutual organization or enterprise level. This gives your team a single location to view and manage your runners. \* If you only have a single organization, then adding your runners at the organization level is effectively the same approach, but you might encounter difficulties if you add another organization in the future. \*\*Decentralized management:\*\* \* If each team will manage their own self-hosted runners, then the recommendation is to add the runners at the highest level of team ownership. For example, if each team owns their own organization, then it will be simplest if the runners are added at the organization level too. \* You could also add runners at the repository level, but this will add management overhead and also increases the numbers of runners you need, since you cannot share runners between repositories. #### Authenticating to your cloud provider If you are using {% data variables.product.prodname\_actions %} to deploy to a cloud provider, or intend to use HashiCorp Vault for secret management, then it's recommended that you consider using OpenID Connect to create short-lived, well-scoped access tokens for your workflow runs. For more information, see [AUTOTITLE](/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect). ### Auditing {% data variables.product.prodname\_actions %} events You can use the security log to monitor activity for your user account and the audit log to monitor activity in your organization{% ifversion ghec or ghes %} or enterprise{% endif %}. The security and audit log records the type of action, when it was run, and which personal account performed the action. For example, you can use the audit log to track the `org.update\_actions\_secret` event, which tracks changes to organization secrets.  For the full list of events that you can find in the audit log for each account type, see the following articles: \* [AUTOTITLE](/authentication/keeping-your-account-and-data-secure/security-log-events) \* [AUTOTITLE](/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/audit-log-events-for-your-organization) {%- ifversion ghec or ghes %} \* [AUTOTITLE](/admin/monitoring-activity-in-your-enterprise/reviewing-audit-logs-for-your-enterprise/audit-log-events-for-your-enterprise) {%- endif %} ### Understanding dependencies in your workflows You can use the dependency graph to explore the actions that the workflows in your repository use. The dependency graph is a summary of the manifest and lock files stored in a repository. It also recognizes files in `./github/workflows/` as manifests, which means that any actions or workflows referenced using the syntax `jobs[\*].steps[\*].uses` or `jobs..uses` will be parsed as dependencies. The dependency graph shows the following information about actions used in workflows: \* The account or organization that owns the action. \* The workflow file that references the action. \* The version or SHA the action is pinned to. In the dependency graph, dependencies are automatically sorted by vulnerability severity. If any of the actions you use have security advisories, they will display at the top of the list. You can navigate to the advisory from the dependency graph and access instructions for resolving the vulnerability. {% ifversion fpt or ghec %}The dependency graph is enabled for public repositories, and you can choose to enable it on private repositories. For more information about using the dependency graph, see [AUTOTITLE](/code-security/supply-chain-security/understanding-your-software-supply-chain/exploring-the-dependencies-of-a-repository).{% else %}Enterprise owners can configure the dependency graph and {% data variables.product.prodname\_dependabot\_alerts %} for an enterprise. For more information, see [AUTOTITLE](/admin/code-security/managing-supply-chain-security-for-your-enterprise/enabling-the-dependency-graph-for-your-enterprise).{% endif %} ### Being aware of security vulnerabilities in actions you use For actions available on the marketplace, {% data variables.product.prodname\_dotcom %} reviews related security advisories and then adds those advisories to the {% data variables.product.prodname\_advisory\_database %}. You can search the database for actions that you use to find information about existing vulnerabilities and instructions for how to fix them. | https://github.com/github/docs/blob/main//content/actions/reference/security/secure-use.md | main | github-actions | [
-0.021810593083500862,
-0.05896658077836037,
-0.08029240369796753,
0.008954030461609364,
0.008256911300122738,
0.02887863852083683,
-0.03955700621008873,
0.050960179418325424,
0.010173753835260868,
0.04959602281451225,
0.03360438346862793,
-0.005379750393331051,
0.04744240269064903,
0.0173... | 0.134655 |
you use For actions available on the marketplace, {% data variables.product.prodname\_dotcom %} reviews related security advisories and then adds those advisories to the {% data variables.product.prodname\_advisory\_database %}. You can search the database for actions that you use to find information about existing vulnerabilities and instructions for how to fix them. To streamline your search, use the {% data variables.product.prodname\_actions %} filter in the [{% data variables.product.prodname\_advisory\_database %}](https://github.com/advisories?query=type%3Areviewed+ecosystem%3Aactions). You can set up your repositories so that you: \* Receive alerts when actions used in your workflows receive a vulnerability report. For more information, see [Monitoring the actions in your workflows](#monitoring-the-actions-in-your-workflows). \* Are warned about existing advisories when you add or update an action in a workflow. For more information, see [Screening actions for vulnerabilities in new or updated workflows](#screening-actions-for-vulnerabilities-in-new-or-updated-workflows). #### Monitoring the actions in your workflows You can use {% data variables.product.prodname\_dependabot %} to monitor the actions in your workflows and enable {% data variables.product.prodname\_dependabot\_alerts %} to notify you when an action you use has a reported vulnerability. {% data variables.product.prodname\_dependabot %} performs a scan of the default branch of the repositories where it is enabled to detect insecure dependencies. {% data variables.product.prodname\_dependabot %} generates {% data variables.product.prodname\_dependabot\_alerts %} when a new advisory is added to the {% data variables.product.prodname\_advisory\_database %} or when an action you use is updated. > [!NOTE] > {% data variables.product.prodname\_dependabot %} only creates alerts for vulnerable actions that use semantic versioning and will not create alerts for actions pinned to SHA values. {% ifversion fpt or ghec %}You can enable {% data variables.product.prodname\_dependabot\_alerts %} for your personal account, for a repository, or for an organization. For more information, see [AUTOTITLE](/code-security/dependabot/dependabot-alerts/configuring-dependabot-alerts).{% else %}An enterprise owner must first set up {% data variables.product.prodname\_dependabot %} for your enterprise before you can manage {% data variables.product.prodname\_dependabot\_alerts %} for your repository. For more information, see [AUTOTITLE](/admin/configuration/configuring-github-connect/enabling-dependabot-for-your-enterprise).{% endif %} {% data reusables.dependabot.where-to-view-dependabot-alerts %} For more information, see [AUTOTITLE](/code-security/dependabot/dependabot-alerts/viewing-and-updating-dependabot-alerts). #### Screening actions for vulnerabilities in new or updated workflows When you open pull requests to update your workflows, it is good practice to use dependency review to understand the security impact of changes you've made to the actions you use. {% data reusables.dependency-review.feature-overview %} If any of the changes you made to your workflows are flagged as vulnerable, you can avoid adding them to your project or update them to a secure version. For more information about dependency review, see [AUTOTITLE](/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review). {% data reusables.dependency-review.about-dependency-review-action %} For more information, see [AUTOTITLE](/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#about-the-dependency-review-action). ### Keeping the actions in your workflows secure and up to date {% data reusables.actions.dependabot-version-updates-for-actions %} The following features can automatically update the actions in your workflows. \* \*\*{% data variables.product.prodname\_dependabot\_version\_updates %}\*\* open pull requests to update actions to the latest version when a new version is released. \* \*\*{% data variables.product.prodname\_dependabot\_security\_updates %}\*\* open pull requests to update actions with reported vulnerabilities to the minimum patched version. > [!NOTE] > {% data reusables.actions.dependabot-version-updates-actions-caveats %} For information on how to configure {% data variables.product.prodname\_dependabot\_version\_updates %}, see [AUTOTITLE](/code-security/dependabot/dependabot-version-updates/configuring-dependabot-version-updates). For information on how to configure {% data variables.product.prodname\_dependabot\_security\_updates %}, see [AUTOTITLE](/code-security/dependabot/dependabot-security-updates/configuring-dependabot-security-updates). {% ifversion fpt or ghec %} ### Protecting actions you've created {% data variables.product.prodname\_dotcom %} enables collaboration between people who publish and maintain actions and vulnerability reporters in order to promote secure coding. {% data reusables.security-advisory.security-advisory-overview %} If you are someone who maintains an action that is used in other projects, you can use the following {% data variables.product.prodname\_dotcom %} features to enhance the security of the actions you've published. \* Use the dependants view in the Dependency graph to see which projects depend on your code. If you receive a vulnerability report, this will | https://github.com/github/docs/blob/main//content/actions/reference/security/secure-use.md | main | github-actions | [
-0.03950323164463043,
-0.020261485129594803,
-0.11043137311935425,
0.06022408604621887,
0.0902736559510231,
0.02208731323480606,
0.07011790573596954,
0.057726506143808365,
-0.07472483813762665,
0.01090843416750431,
0.008634823374450207,
-0.03825972601771355,
0.06538290530443192,
0.00518047... | 0.131172 |
that is used in other projects, you can use the following {% data variables.product.prodname\_dotcom %} features to enhance the security of the actions you've published. \* Use the dependants view in the Dependency graph to see which projects depend on your code. If you receive a vulnerability report, this will give you an idea of who you need to communicate with about the vulnerability and how to fix it. For more information, see [AUTOTITLE](/code-security/supply-chain-security/understanding-your-software-supply-chain/exploring-the-dependencies-of-a-repository#dependents-view). \* Use repository security advisories to create a security advisory, privately collaborate to fix the vulnerability in a temporary private fork, and publish a security advisory to alert your community of the vulnerability once a patch is released. For more information, see [AUTOTITLE](/code-security/security-advisories/working-with-repository-security-advisories/configuring-private-vulnerability-reporting-for-a-repository) and [AUTOTITLE](/code-security/security-advisories/working-with-repository-security-advisories/creating-a-repository-security-advisory). {% endif %} | https://github.com/github/docs/blob/main//content/actions/reference/security/secure-use.md | main | github-actions | [
-0.10824567079544067,
0.012125644832849503,
-0.05925043299794197,
-0.009946510195732117,
0.06743481755256653,
0.024918554350733757,
0.045711345970630646,
0.08000882714986801,
-0.08003882318735123,
0.026988301426172256,
0.04476563632488251,
-0.024739257991313934,
0.0411798357963562,
-0.0074... | 0.201915 |
## Reusable workflows Reference information for reusable workflows. ### Access to reusable workflows A reusable workflow can be used by another workflow if any of the following is true: \* Both workflows are in the same repository. \* The called workflow is stored in a public repository{% ifversion ghes %} on {% data variables.product.prodname\_ghe\_server %}. You cannot directly use reusable workflows defined on {% data variables.product.prodname\_dotcom\_the\_website %}. Instead store a copy of the reusable workflow on {% data variables.location.product\_location %}, and call the workflow from that path. {% elsif actions-workflow-policy %}, and your {% ifversion ghec %}enterprise{% else %}organization{% endif %} allows you to use public reusable workflows.{% endif %}{% ifversion ghes or ghec %} \* The called workflow is stored in an internal repository and the settings for that repository allow it to be accessed. For more information, see [AUTOTITLE](/actions/creating-actions/sharing-actions-and-workflows-with-your-enterprise).{% endif %} \* The called workflow is stored in a private repository and the settings for that repository allow it to be accessed. For more information, see {% ifversion ghes or ghec %}[AUTOTITLE](/actions/creating-actions/sharing-actions-and-workflows-with-your-enterprise).{% else %}[AUTOTITLE](/actions/creating-actions/sharing-actions-and-workflows-with-your-organization) and [AUTOTITLE](/actions/creating-actions/sharing-actions-and-workflows-from-your-private-repository).{% endif %} The following table shows the accessibility of reusable workflows to a caller workflow, depending on the visibility of the host repository. | Caller repository | Accessible workflows repositories | |----|----| | `private` | `private`{% ifversion ghes or ghec %}, `internal`,{% endif %} and `public` | | {% ifversion ghes or ghec %} | | `internal` | `internal`, and `public` | | {% endif %} | | `public` | `public` | The \*\*Actions permissions\*\* on the callers repository's Actions settings page must be configured to allow the use of actions and reusable workflows - see [AUTOTITLE](/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#allowing-select-actions-and-reusable-workflows-to-run). For {% ifversion ghes or ghec %}internal or {% endif %}private repositories, the \*\*Access\*\* policy on the Actions settings page of the called workflow's repository must be explicitly configured to allow access from repositories containing caller workflows - see [AUTOTITLE](/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#allowing-access-to-components-in-a-private-repository). {% data reusables.actions.actions-redirects-workflows %} ### Limitations of reusable workflows \* You can connect up to {% ifversion fpt or ghec %}ten {% else %}four {% endif %}levels of workflows. For more information, see [Nesting reusable workflows](/actions/how-tos/sharing-automations/reuse-workflows#nesting-reusable-workflows). \* You can call a maximum of {% ifversion fpt or ghec %}50 {% else %}20 {% endif %}unique reusable workflows from a single workflow file. This limit includes any trees of nested reusable workflows that may be called starting from your top-level caller workflow file. For example, \_top-level-caller-workflow.yml\_ → \_called-workflow-1.yml\_ → \_called-workflow-2.yml\_ counts as 2 reusable workflows. \* Any environment variables set in an `env` context defined at the workflow level in the caller workflow are not propagated to the called workflow. For more information, see [AUTOTITLE](/actions/learn-github-actions/variables) and [AUTOTITLE](/actions/learn-github-actions/contexts#env-context). \* Similarly, environment variables set in the `env` context, defined in the called workflow, are not accessible in the `env` context of the caller workflow. Instead, you must use outputs of the reusable workflow. For more information, see [Using outputs from a reusable workflow](/actions/how-tos/sharing-automations/reuse-workflows#using-outputs-from-a-reusable-workflow). \* To reuse variables in multiple workflows, set them at the organization, repository, or environment levels and reference them using the `vars` context. For more information see [AUTOTITLE](/actions/learn-github-actions/variables) and [AUTOTITLE](/actions/learn-github-actions/contexts#vars-context). \* Reusable workflows are called directly within a job, and not from within a job step. You cannot, therefore, use `GITHUB\_ENV` to pass values to job steps in the caller workflow. ### Supported keywords for jobs that call a reusable workflow When you call a reusable workflow, you can only use the following keywords in the job containing the call: \* [`jobs..name`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idname) \* [`jobs..uses`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_iduses) \* [`jobs..with`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idwith) \* [`jobs..with.`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idwithinput\_id) \* [`jobs..secrets`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idsecrets) \* [`jobs..secrets.`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idsecretssecret\_id) \* [`jobs..secrets.inherit`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idsecretsinherit) \* [`jobs..strategy`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idstrategy) \* [`jobs..needs`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idneeds) \* [`jobs..if`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idif) \* [`jobs..concurrency`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idconcurrency) \* [`jobs..permissions`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idpermissions) > | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/reusing-workflow-configurations.md | main | github-actions | [
-0.018193254247307777,
-0.06569285690784454,
-0.03728114068508148,
-0.023050589486956596,
0.022978898137807846,
0.029232017695903778,
0.08350472152233124,
0.011315048672258854,
-0.05612671747803688,
-0.01720932498574257,
0.01757093332707882,
0.008911236189305782,
0.015033308416604996,
0.00... | 0.059996 |
jobs that call a reusable workflow When you call a reusable workflow, you can only use the following keywords in the job containing the call: \* [`jobs..name`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idname) \* [`jobs..uses`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_iduses) \* [`jobs..with`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idwith) \* [`jobs..with.`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idwithinput\_id) \* [`jobs..secrets`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idsecrets) \* [`jobs..secrets.`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idsecretssecret\_id) \* [`jobs..secrets.inherit`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idsecretsinherit) \* [`jobs..strategy`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idstrategy) \* [`jobs..needs`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idneeds) \* [`jobs..if`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idif) \* [`jobs..concurrency`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idconcurrency) \* [`jobs..permissions`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idpermissions) > [!NOTE] > > \* If `jobs..permissions` is not specified in the calling job, the called workflow will have the default permissions for the `GITHUB\_TOKEN`. For more information, see [AUTOTITLE](/actions/reference/workflow-syntax-for-github-actions#permissions). > \* The `GITHUB\_TOKEN` permissions passed from the caller workflow can be only downgraded (not elevated) by the called workflow. > \* If you use `jobs..concurrency.cancel-in-progress: true`, don't use the same value for `jobs..concurrency.group` in the called and caller workflows as this will cause the workflow that's already running to be cancelled. A called workflow uses the name of its caller workflow in {% raw %}${{ github.workflow }}{% endraw %}, so using this context as the value of `jobs..concurrency.group` in both caller and called workflows will cause the caller workflow to be cancelled when the called workflow runs. ### How reusable workflows use runners #### {% data variables.product.github %}-hosted runners The assignment of {% data variables.product.prodname\_dotcom %}-hosted runners is always evaluated using only the caller's context. Billing for {% data variables.product.prodname\_dotcom %}-hosted runners is always associated with the caller. The caller workflow cannot use {% data variables.product.prodname\_dotcom %}-hosted runners from the called repository. For more information, see [AUTOTITLE](/actions/using-github-hosted-runners/about-github-hosted-runners). #### Self-hosted runners Called workflows that are owned by the same user or organization{% ifversion ghes or ghec %} or enterprise{% endif %} as the caller workflow can access self-hosted runners from the caller's context. This means that a called workflow can access self-hosted runners that are: \* In the caller repository \* In the caller repository's organization{% ifversion ghes or ghec %} or enterprise{% endif %}, provided that the runner has been made available to the caller repository ### Access and permissions for nested workflows A workflow that contains nested reusable workflows will fail if any of the nested workflows is inaccessible to the initial caller workflow. For more information, see [Access to reusable workflows](#access-to-reusable-workflows). `GITHUB\_TOKEN` permissions can only be the same or more restrictive in nested workflows. For example, in the workflow chain A > B > C, if workflow A has `package: read` token permission, then B and C cannot have `package: write` permission. For more information, see [AUTOTITLE](/actions/security-guides/automatic-token-authentication). For information on how to use the API to determine which workflow files were involved in a particular workflow run, see [AUTOTITLE](/actions/how-tos/sharing-automations/reuse-workflows#monitoring-which-workflows-are-being-used). ### Behavior of reusable workflows when re-running jobs {% data reusables.actions.partial-reruns-with-reusable %} ### `github` context When a reusable workflow is triggered by a caller workflow, the `github` context is always associated with the caller workflow. The called workflow is automatically granted access to `github.token` and `secrets.GITHUB\_TOKEN`. For more information about the `github` context, see [AUTOTITLE](/actions/learn-github-actions/contexts#github-context). ## Workflow templates Reference information to use when creating workflow templates for your organization. ### Workflow template availability You can use templates in repositories that match or have more restricted visibility than the template repository. \* Workflow templates in a public `.github` repository are available to all repository types. \* Workflow templates in an internal `.github` repository are only available to internal and private repositories. \* Workflow templates in a private `.github` repository are only available to private repositories. {% ifversion ghec %} Because public workflow templates require a public `.github` repository, they are not available for {% data variables.product.prodname\_emus %}. {% endif %} ### Granting access for private/internal repositories If you're using a private or internal `.github` repository, you need to grant Read | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/reusing-workflow-configurations.md | main | github-actions | [
-0.08470291644334793,
-0.054880764335393906,
-0.01694260537624359,
0.009791962802410126,
0.024450747296214104,
-0.02121485210955143,
0.09159611910581589,
-0.09834680706262589,
-0.0033348649740219116,
-0.060187432914972305,
-0.012181829661130905,
0.05046281963586807,
0.04896236211061478,
0.... | 0.071338 |
only available to private repositories. {% ifversion ghec %} Because public workflow templates require a public `.github` repository, they are not available for {% data variables.product.prodname\_emus %}. {% endif %} ### Granting access for private/internal repositories If you're using a private or internal `.github` repository, you need to grant Read access to users or teams who should be able to use the templates. ### The `$default-branch` placeholder If you need to refer to a repository's default branch, you can use the `$default-branch` placeholder in your workflow template. When a workflow is created the placeholder will be automatically replaced with the name of the repository's default branch. {% ifversion ghes %} ### Placeholder values in the `runs-on` key The following values in the `runs-on` key are also treated as placeholders: \* `ubuntu-latest` is replaced with `[ self-hosted ]` \* `windows-latest` is replaced with `[ self-hosted, windows ]` \* `macos-latest"` is replaced with `[ self-hosted, macOS ]` {% endif %} ### Example workflow template file This file named `octo-organization-ci.yml` demonstrates a basic workflow. ```yaml copy name: Octo Organization CI on: push: branches: [ $default-branch ] pull\_request: branches: [ $default-branch ] jobs: build: runs-on: ubuntu-latest steps: - uses: {% data reusables.actions.action-checkout %} - name: Run a one-line script run: echo Hello from Octo Organization ``` ### Metadata file requirements The metadata file must have the same name as the workflow file, but instead of the `.yml` extension, it must be appended with `.properties.json`. For example, this file named `octo-organization-ci.properties.json` contains the metadata for a workflow file named `octo-organization-ci.yml`: {% data reusables.actions.workflow-templates-metadata-example %} {% data reusables.actions.workflow-templates-metadata-keys %} {% ifversion fpt or ghec %} ## YAML anchors and aliases You can use YAML anchors and aliases to reduce repetition in your workflows. An anchor (marked with `&`) identifies a piece of content that you want to reuse, while an alias (marked with `\*`) repeats that content in another location. For detailed information about anchors and aliases, see [Node Anchors and Aliases in the YAML specification](https://yaml.org/spec/1.2.2/#3222-anchors-and-aliases). Here's an example that uses YAML anchors and aliases with environment variables: ```yaml jobs: job1: env: &env\_vars # Define the anchor on first use NODE\_ENV: production DATABASE\_URL: {% raw %}${{ secrets.DATABASE\_URL }}{% endraw %} steps: - run: echo "Using production settings" job2: env: \*env\_vars # Reuse the environment variables steps: - run: echo "Same environment variables here" ``` This is equivalent to writing the following YAML without anchors and aliases: ```yaml jobs: job1: env: NODE\_ENV: production DATABASE\_URL: {% raw %}${{ secrets.DATABASE\_URL }}{% endraw %} steps: - run: echo "Using production settings" job2: env: NODE\_ENV: production DATABASE\_URL: {% raw %}${{ secrets.DATABASE\_URL }}{% endraw %} steps: - run: echo "Same environment variables here" ``` You can also use anchors for more complex configurations, such as reusing an entire job configuration: ```yaml jobs: test: &base\_job # Define the anchor on first use runs-on: ubuntu-latest timeout-minutes: 30 env: NODE\_VERSION: '18' steps: - uses: {% data reusables.actions.action-checkout %} - name: Set up Node.js uses: {% data reusables.actions.action-setup-node %} with: node-version: {% raw %}${{ env.NODE\_VERSION }}{% endraw %} - run: npm test alt-test: \*base\_job # Reuse the entire job configuration ``` {% endif %} | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/reusing-workflow-configurations.md | main | github-actions | [
0.035255689173936844,
-0.008669453673064709,
-0.07576009631156921,
-0.03295329585671425,
0.015519959852099419,
0.038879089057445526,
0.007632819470018148,
0.06982915848493576,
0.04904641956090927,
-0.015407652594149113,
0.00854842085391283,
-0.02942855842411518,
-0.021675625815987587,
-0.0... | 0.074795 |
{% data reusables.actions.enterprise-github-hosted-runners %} ### USER Docker actions must be run by the default Docker user (root). Do not use the `USER` instruction in your `Dockerfile`, because you won't be able to access the `GITHUB\_WORKSPACE` directory. For more information, see [AUTOTITLE](/actions/reference/variables-reference#default-environment-variables) and [USER reference](https://docs.docker.com/engine/reference/builder/#user) in the Docker documentation. ### FROM The first instruction in the `Dockerfile` must be `FROM`, which selects a Docker base image. For more information, see the [FROM reference](https://docs.docker.com/engine/reference/builder/#from) in the Docker documentation. These are some best practices when setting the `FROM` argument: \* It's recommended to use official Docker images. For example, `python` or `ruby`. \* Use a version tag if it exists, preferably with a major version. For example, use `node:10` instead of `node:latest`. \* It's recommended to use Docker images based on the [Debian](https://www.debian.org/) operating system. ### WORKDIR {% data variables.product.github %} sets the working directory path in the `GITHUB\_WORKSPACE` environment variable. It's recommended to not use the `WORKDIR` instruction in your `Dockerfile`. Before the action executes, {% data variables.product.github %} will mount the `GITHUB\_WORKSPACE` directory on top of anything that was at that location in the Docker image and set `GITHUB\_WORKSPACE` as the working directory. For more information, see [AUTOTITLE](/actions/reference/variables-reference#default-environment-variables) and the [WORKDIR reference](https://docs.docker.com/engine/reference/builder/#workdir) in the Docker documentation. ### ENTRYPOINT If you define `entrypoint` in an action's metadata file, it will override the `ENTRYPOINT` defined in the `Dockerfile`. For more information, see [AUTOTITLE](/actions/creating-actions/metadata-syntax-for-github-actions#runsentrypoint). The Docker `ENTRYPOINT` instruction has a \_shell\_ form and \_exec\_ form. The Docker `ENTRYPOINT` documentation recommends using the \_exec\_ form of the `ENTRYPOINT` instruction. For more information about \_exec\_ and \_shell\_ form, see the [ENTRYPOINT reference](https://docs.docker.com/engine/reference/builder/#entrypoint) in the Docker documentation. You should not use `WORKDIR` to specify your entrypoint in your Dockerfile. Instead, you should use an absolute path. For more information, see [WORKDIR](#workdir). If you configure your container to use the \_exec\_ form of the `ENTRYPOINT` instruction, the `args` configured in the action's metadata file won't run in a command shell. If the action's `args` contain an environment variable, the variable will not be substituted. For example, using the following \_exec\_ format will not print the value stored in `$GITHUB\_SHA`, but will instead print `"$GITHUB\_SHA"`. ```dockerfile ENTRYPOINT ["echo $GITHUB\_SHA"] ``` If you want variable substitution, then either use the \_shell\_ form or execute a shell directly. For example, using the following \_exec\_ format, you can execute a shell to print the value stored in the `GITHUB\_SHA` environment variable. ```dockerfile ENTRYPOINT ["sh", "-c", "echo $GITHUB\_SHA"] ``` To supply `args` defined in the action's metadata file to a Docker container that uses the \_exec\_ form in the `ENTRYPOINT`, we recommend creating a shell script called `entrypoint.sh` that you call from the `ENTRYPOINT` instruction: #### Example \_Dockerfile\_ ```dockerfile # Container image that runs your code FROM debian:9.5-slim # Copies your code file from your action repository to the filesystem path `/` of the container COPY entrypoint.sh /entrypoint.sh # Executes `entrypoint.sh` when the Docker container starts up ENTRYPOINT ["/entrypoint.sh"] ``` #### Example \_entrypoint.sh\_ file Using the example Dockerfile above, {% data variables.product.github %} will send the `args` configured in the action's metadata file as arguments to `entrypoint.sh`. Add the `#!/bin/sh` [shebang](https://en.wikipedia.org/wiki/Shebang\_(Unix)) at the top of the `entrypoint.sh` file to explicitly use the system's [POSIX](https://en.wikipedia.org/wiki/POSIX)-compliant shell. ```shell #!/bin/sh # `$#` expands to the number of arguments and `$@` expands to the supplied `args` printf '%d args:' "$#" printf " '%s'" "$@" printf '\n' ``` Your code must be executable. Make sure the `entrypoint.sh` file has `execute` permissions before using it in a workflow. You can modify the permission from your terminal using this command: ```shell chmod +x entrypoint.sh ``` When an `ENTRYPOINT` shell script | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/dockerfile-support.md | main | github-actions | [
0.01356346532702446,
0.0023441410157829523,
-0.01699199341237545,
0.01655976101756096,
0.02602081187069416,
-0.05003492906689644,
-0.013477331958711147,
0.06032547354698181,
-0.02501142956316471,
0.032146427780389786,
-0.05057036131620407,
-0.016106000170111656,
0.04427739605307579,
-0.008... | -0.003112 |
'%d args:' "$#" printf " '%s'" "$@" printf '\n' ``` Your code must be executable. Make sure the `entrypoint.sh` file has `execute` permissions before using it in a workflow. You can modify the permission from your terminal using this command: ```shell chmod +x entrypoint.sh ``` When an `ENTRYPOINT` shell script is not executable, you'll receive an error similar to this: ```shell Error response from daemon: OCI runtime create failed: container\_linux.go:348: starting container process caused "exec: \"/entrypoint.sh\": permission denied": unknown ``` ### CMD If you define `args` in the action's metadata file, `args` will override the `CMD` instruction specified in the `Dockerfile`. For more information, see [AUTOTITLE](/actions/creating-actions/metadata-syntax-for-github-actions#runsargs). If you use `CMD` in your `Dockerfile`, follow these guidelines: {% data reusables.actions.dockerfile-guidelines %} ## Supported Linux capabilities {% data variables.product.prodname\_actions %} supports the default Linux capabilities that Docker supports. Capabilities can't be added or removed. For more information about the default Linux capabilities that Docker supports, see [Linux kernel capabilities](https://docs.docker.com/engine/security/#linux-kernel-capabilities) in the Docker documentation. To learn more about Linux capabilities, see [Overview of Linux capabilities](http://man7.org/linux/man-pages/man7/capabilities.7.html) in the Linux man-pages. | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/dockerfile-support.md | main | github-actions | [
0.04926181957125664,
0.01848651096224785,
-0.07613416761159897,
-0.0619044154882431,
-0.010464520193636417,
-0.0678020790219307,
0.0459478385746479,
0.06227948144078255,
0.024274252355098724,
0.006682414561510086,
-0.05242137983441353,
-0.05439319461584091,
0.04890318587422371,
0.049251053... | 0.054719 |
## Available contexts | Context name | Type | Description | |---------------|------|-------------| | `github` | `object` | Information about the workflow run. For more information, see [`github` context](#github-context). | | `env` | `object` | Contains variables set in a workflow, job, or step. For more information, see [`env` context](#env-context). | | `vars` | `object` | Contains variables set at the repository, organization, or environment levels. For more information, see [`vars` context](#vars-context). | | `job` | `object` | Information about the currently running job. For more information, see [`job` context](#job-context). | | `jobs` | `object` | For reusable workflows only, contains outputs of jobs from the reusable workflow. For more information, see [`jobs` context](#jobs-context). | | `steps` | `object` | Information about the steps that have been run in the current job. For more information, see [`steps` context](#steps-context). | | `runner` | `object` | Information about the runner that is running the current job. For more information, see [`runner` context](#runner-context). | | `secrets` | `object` | Contains the names and values of secrets that are available to a workflow run. For more information, see [`secrets` context](#secrets-context). | | `strategy` | `object` | Information about the matrix execution strategy for the current job. For more information, see [`strategy` context](#strategy-context). | | `matrix` | `object` | Contains the matrix properties defined in the workflow that apply to the current job. For more information, see [`matrix` context](#matrix-context). | | `needs` | `object` | Contains the outputs of all jobs that are defined as a dependency of the current job. For more information, see [`needs` context](#needs-context). | | `inputs` | `object` | Contains the inputs of a reusable or manually triggered workflow. For more information, see [`inputs` context](#inputs-context). | As part of an expression, you can access context information using one of two syntaxes. \* Index syntax: `github['sha']` \* Property dereference syntax: `github.sha` In order to use property dereference syntax, the property name must start with a letter or `\_` and contain only alphanumeric characters, `-`, or `\_`. If you attempt to dereference a nonexistent property, it will evaluate to an empty string. ### Determining when to use contexts {% data variables.product.prodname\_actions %} includes a collection of variables called \_contexts\_ and a similar collection of variables called \_default variables\_. These variables are intended for use at different points in the workflow: \* \*\*Default environment variables:\*\* These environment variables exist only on the runner that is executing your job. For more information, see [AUTOTITLE](/actions/reference/variables-reference#default-environment-variables). \* \*\*Contexts:\*\* You can use most contexts at any point in your workflow, including when \_default variables\_ would be unavailable. For example, you can use contexts with expressions to perform initial processing before the job is routed to a runner for execution; this allows you to use a context with the conditional `if` keyword to determine whether a step should run. Once the job is running, you can also retrieve context variables from the runner that is executing the job, such as `runner.os`. For details of where you can use various contexts within a workflow, see [Context availability](#context-availability). The following example demonstrates how these different types of variables can be used together in a job: {% raw %} ```yaml copy name: CI on: push jobs: prod-check: if: ${{ github.ref == 'refs/heads/main' }} runs-on: ubuntu-latest steps: - run: echo "Deploying to production server on branch $GITHUB\_REF" ``` {% endraw %} In this example, the `if` statement checks the [`github.ref`](/actions/learn-github-actions/contexts#github-context) context to determine the current branch name; if the name is `refs/heads/main`, then the subsequent steps are executed. The `if` check is processed by {% data variables.product.prodname\_actions %}, and the job is only sent | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/contexts.md | main | github-actions | [
-0.024083318188786507,
-0.028760062530636787,
-0.08697772771120071,
0.060876209288835526,
0.058728475123643875,
-0.05822982266545296,
0.05367672070860863,
-0.020562874153256416,
-0.02241457626223564,
-0.05482902005314827,
-0.05415183678269386,
0.008307201787829399,
0.05333308130502701,
-0.... | 0.129402 |
on branch $GITHUB\_REF" ``` {% endraw %} In this example, the `if` statement checks the [`github.ref`](/actions/learn-github-actions/contexts#github-context) context to determine the current branch name; if the name is `refs/heads/main`, then the subsequent steps are executed. The `if` check is processed by {% data variables.product.prodname\_actions %}, and the job is only sent to the runner if the result is `true`. Once the job is sent to the runner, the step is executed and refers to the [`$GITHUB\_REF`](/actions/reference/variables-reference#default-environment-variables) variable from the runner. ### Context availability Different contexts are available throughout a workflow run. For example, the `secrets` context may only be used at certain places within a job. In addition, some functions may only be used in certain places. For example, the `hashFiles` function is not available everywhere. The following table lists the restrictions on where each context and special function can be used within a workflow. The listed contexts are only available for the given workflow key, and may not be used anywhere else. Unless listed below, a function can be used anywhere. | Workflow key | Context | Special functions | | ---- | ------- | ----------------- | | `run-name` | `github, inputs, vars` | None | | `concurrency` | `github, inputs, vars` | None | | `env` | `github, secrets, inputs, vars` | None | | `jobs..concurrency` | `github, needs, strategy, matrix, inputs, vars` | None | | `jobs..container` | `github, needs, strategy, matrix, vars, inputs` | None | | `jobs..container.credentials` | `github, needs, strategy, matrix, env, vars, secrets, inputs` | None | | `jobs..container.env.` | `github, needs, strategy, matrix, job, runner, env, vars, secrets, inputs` | None | | `jobs..container.image` | `github, needs, strategy, matrix, vars, inputs` | None | | `jobs..continue-on-error` | `github, needs, strategy, vars, matrix, inputs` | None | | `jobs..defaults.run` | `github, needs, strategy, matrix, env, vars, inputs` | None | | `jobs..env` | `github, needs, strategy, matrix, vars, secrets, inputs` | None | | `jobs..environment` | `github, needs, strategy, matrix, vars, inputs` | None | | `jobs..environment.url` | `github, needs, strategy, matrix, job, runner, env, vars, steps, inputs` | None | | `jobs..if` | `github, needs, vars, inputs` | `always, cancelled, success, failure` | | `jobs..name` | `github, needs, strategy, matrix, vars, inputs` | None | | `jobs..outputs.` | `github, needs, strategy, matrix, job, runner, env, vars, secrets, steps, inputs` | None | | `jobs..runs-on` | `github, needs, strategy, matrix, vars, inputs` | None | | `jobs..secrets.` | `github, needs, strategy, matrix, secrets, inputs, vars` | None | | `jobs..services` | `github, needs, strategy, matrix, vars, inputs` | None | | `jobs..services..credentials` | `github, needs, strategy, matrix, env, vars, secrets, inputs` | None | | `jobs..services..env.` | `github, needs, strategy, matrix, job, runner, env, vars, secrets, inputs` | None | | `jobs..steps.continue-on-error` | `github, needs, strategy, matrix, job, runner, env, vars, secrets, steps, inputs` | `hashFiles` | | `jobs..steps.env` | `github, needs, strategy, matrix, job, runner, env, vars, secrets, steps, inputs` | `hashFiles` | | `jobs..steps.if` | `github, needs, strategy, matrix, job, runner, env, vars, steps, inputs` | `always, cancelled, success, failure, hashFiles` | | `jobs..steps.name` | `github, needs, strategy, matrix, job, runner, env, vars, secrets, steps, inputs` | `hashFiles` | | `jobs..steps.run` | `github, needs, strategy, matrix, job, runner, env, vars, secrets, steps, inputs` | `hashFiles` | | `jobs..steps.timeout-minutes` | `github, needs, strategy, matrix, job, runner, env, vars, secrets, steps, inputs` | `hashFiles` | | `jobs..steps.with` | `github, needs, strategy, matrix, job, runner, env, vars, secrets, steps, inputs` | `hashFiles` | | `jobs..steps.working-directory` | `github, needs, strategy, matrix, job, runner, env, vars, secrets, steps, inputs` | `hashFiles` | | `jobs..strategy` | `github, needs, | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/contexts.md | main | github-actions | [
-0.02572164684534073,
-0.017958352342247963,
-0.07525794953107834,
-0.005292157642543316,
0.10372547805309296,
-0.025670411065220833,
0.02788121998310089,
-0.003959506284445524,
0.03727864846587181,
-0.003484137589111924,
0.033547475934028625,
0.022632034495472908,
0.036811232566833496,
-0... | 0.118284 |
matrix, job, runner, env, vars, secrets, steps, inputs` | `hashFiles` | | `jobs..steps.with` | `github, needs, strategy, matrix, job, runner, env, vars, secrets, steps, inputs` | `hashFiles` | | `jobs..steps.working-directory` | `github, needs, strategy, matrix, job, runner, env, vars, secrets, steps, inputs` | `hashFiles` | | `jobs..strategy` | `github, needs, vars, inputs` | None | | `jobs..timeout-minutes` | `github, needs, strategy, matrix, vars, inputs` | None | | `jobs..with.` | `github, needs, strategy, matrix, inputs, vars` | None | | `on.workflow\_call.inputs..default` | `github, inputs, vars` | None | | `on.workflow\_call.outputs..value` | `github, jobs, vars, inputs` | None | ### Example: printing context information to the log You can print the contents of contexts to the log for debugging. The [`toJSON` function](/actions/learn-github-actions/expressions#tojson) is required to pretty-print JSON objects to the log. {% data reusables.actions.github-context-warning %} {% raw %} ```yaml copy name: Context testing on: push jobs: dump\_contexts\_to\_log: runs-on: ubuntu-latest steps: - name: Dump GitHub context env: GITHUB\_CONTEXT: ${{ toJson(github) }} run: echo "$GITHUB\_CONTEXT" - name: Dump job context env: JOB\_CONTEXT: ${{ toJson(job) }} run: echo "$JOB\_CONTEXT" - name: Dump steps context env: STEPS\_CONTEXT: ${{ toJson(steps) }} run: echo "$STEPS\_CONTEXT" - name: Dump runner context env: RUNNER\_CONTEXT: ${{ toJson(runner) }} run: echo "$RUNNER\_CONTEXT" - name: Dump strategy context env: STRATEGY\_CONTEXT: ${{ toJson(strategy) }} run: echo "$STRATEGY\_CONTEXT" - name: Dump matrix context env: MATRIX\_CONTEXT: ${{ toJson(matrix) }} run: echo "$MATRIX\_CONTEXT" ``` {% endraw %} ## `github` context The `github` context contains information about the workflow run and the event that triggered the run. You can read most of the `github` context data in environment variables. For more information about environment variables, see [AUTOTITLE](/actions/learn-github-actions/variables). {% data reusables.actions.github-context-warning %} {% data reusables.actions.context-injection-warning %} | Property name | Type | Description | |---------------|------|-------------| | `github` | `object` | The top-level context available during any job or step in a workflow. This object contains all the properties listed below. | | `github.action` | `string` | The name of the action currently running, or the [`id`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idstepsid) of a step. {% data variables.product.prodname\_dotcom %} removes special characters, and uses the name `\_\_run` when the current step runs a script without an `id`. If you use the same action more than once in the same job, the name will include a suffix with the sequence number with underscore before it. For example, the first script you run will have the name `\_\_run`, and the second script will be named `\_\_run\_2`. Similarly, the second invocation of `actions/checkout` will be `actionscheckout2`. | | `github.action\_path` | `string` | The path where an action is located. This property is only supported in composite actions. You can use this path to access files located in the same repository as the action, for example by changing directories to the path: {% raw %} `cd ${{ github.action\_path }}` {% endraw %}. | | `github.action\_ref` | `string` | For a step executing an action, this is the ref of the action being executed. For example, `v2`. {% data reusables.actions.composite-actions-unsupported-refs %} | | `github.action\_repository` | `string` | For a step executing an action, this is the owner and repository name of the action. For example, `actions/checkout`. {% data reusables.actions.composite-actions-unsupported-refs %} | | `github.action\_status` | `string` | For a composite action, the current result of the composite action. | | `github.actor` | `string` | The username of the user that triggered the initial workflow run. If the workflow run is a re-run, this value may differ from `github.triggering\_actor`. Any workflow re-runs will use the privileges of `github.actor`, even if the actor initiating the re-run (`github.triggering\_actor`) has different privileges. | | `github.actor\_id` | `string` | {% data reusables.actions.actor\_id-description %} | | | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/contexts.md | main | github-actions | [
-0.05312144756317139,
0.008627218194305897,
-0.16381199657917023,
-0.029658805578947067,
-0.022792741656303406,
-0.03354550898075104,
0.023300552740693092,
0.0470271036028862,
-0.035640470683574677,
0.021996047347784042,
0.01985577866435051,
0.02948281727731228,
0.11183338612318039,
-0.046... | 0.133751 |
triggered the initial workflow run. If the workflow run is a re-run, this value may differ from `github.triggering\_actor`. Any workflow re-runs will use the privileges of `github.actor`, even if the actor initiating the re-run (`github.triggering\_actor`) has different privileges. | | `github.actor\_id` | `string` | {% data reusables.actions.actor\_id-description %} | | `github.api\_url` | `string` | The URL of the {% data variables.product.prodname\_dotcom %} REST API. | | `github.base\_ref` | `string` | The `base\_ref` or target branch of the pull request in a workflow run. This property is only available when the event that triggers a workflow run is either `pull\_request` or `pull\_request\_target`. | | `github.env` | `string` | Path on the runner to the file that sets environment variables from workflow commands. This file is unique to the current step and is a different file for each step in a job. For more information, see [AUTOTITLE](/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable). | | `github.event` | `object` | The full event webhook payload. You can access individual properties of the event using this context. This object is identical to the webhook payload of the event that triggered the workflow run, and is different for each event. The webhooks for each {% data variables.product.prodname\_actions %} event is linked in [AUTOTITLE](/actions/using-workflows/events-that-trigger-workflows). For example, for a workflow run triggered by the [`push` event](/actions/using-workflows/events-that-trigger-workflows#push), this object contains the contents of the [push webhook payload](/webhooks-and-events/webhooks/webhook-events-and-payloads#push). | | `github.event\_name` | `string` | The name of the event that triggered the workflow run. | | `github.event\_path` | `string` | The path to the file on the runner that contains the full event webhook payload. | | `github.graphql\_url` | `string` | The URL of the {% data variables.product.prodname\_dotcom %} GraphQL API. | | `github.head\_ref` | `string` | The `head\_ref` or source branch of the pull request in a workflow run. This property is only available when the event that triggers a workflow run is either `pull\_request` or `pull\_request\_target`. | | `github.job` | `string` | The [`job\_id`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_id) of the current job. | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/contexts.md | main | github-actions | [
-0.008675536140799522,
-0.03575853258371353,
-0.016150474548339844,
-0.03153027221560478,
-0.02052140422165394,
0.029885906726121902,
0.022649366408586502,
0.018140094354748726,
0.03600772097706795,
-0.028721943497657776,
-0.022139569744467735,
-0.02600223571062088,
0.03706922382116318,
0.... | 0.087687 |
{% data reusables.actions.enterprise-github-hosted-runners %} ## About YAML syntax for workflows Workflow files use YAML syntax, and must have either a `.yml` or `.yaml` file extension. {% data reusables.actions.learn-more-about-yaml %} You must store workflow files in the `.github/workflows` directory of your repository. ## `name` {% data reusables.actions.workflows.workflow-syntax-name %} ## `run-name` The name for workflow runs generated from the workflow. {% data variables.product.prodname\_dotcom %} displays the workflow run name in the list of workflow runs on your repository's "Actions" tab. If `run-name` is omitted or is only whitespace, then the run name is set to event-specific information for the workflow run. For example, for a workflow triggered by a `push` or `pull\_request` event, it is set as the commit message or the title of the pull request. This value can include expressions and can reference the [`github`](/actions/learn-github-actions/contexts#github-context) and [`inputs`](/actions/learn-github-actions/contexts#inputs-context) contexts. ### Example of `run-name` {% raw %} ```yaml run-name: Deploy to ${{ inputs.deploy\_target }} by @${{ github.actor }} ``` {% endraw %} ## `on` {% data reusables.actions.workflows.section-triggering-a-workflow %} ## `on..types` {% data reusables.actions.workflows.section-triggering-a-workflow-types %} ## `on..` {% data reusables.actions.workflows.triggering-workflow-branches1 %} ### Example: Including branches {% data reusables.actions.workflows.triggering-workflow-branches2 %} ### Example: Excluding branches {% data reusables.actions.workflows.triggering-workflow-branches3 %} ### Example: Including and excluding branches {% data reusables.actions.workflows.triggering-workflow-branches4 %} ## `on.push.` {% data reusables.actions.workflows.run-on-specific-branches-or-tags1 %} ### Example: Including branches and tags {% data reusables.actions.workflows.run-on-specific-branches-or-tags2 %} ### Example: Excluding branches and tags {% data reusables.actions.workflows.run-on-specific-branches-or-tags3 %} ### Example: Including and excluding branches and tags {% data reusables.actions.workflows.run-on-specific-branches-or-tags4 %} ## `on..` {% data reusables.actions.workflows.triggering-a-workflow-paths1 %} ### Example: Including paths {% data reusables.actions.workflows.triggering-a-workflow-paths2 %} ### Example: Excluding paths {% data reusables.actions.workflows.triggering-a-workflow-paths3 %} ### Example: Including and excluding paths {% data reusables.actions.workflows.triggering-a-workflow-paths4 %} ### Git diff comparisons {% data reusables.actions.workflows.triggering-a-workflow-paths5 %} ## `on.schedule` You can use `on.schedule` to define a time schedule for your workflows. {% data reusables.repositories.actions-scheduled-workflow-example %} For more information about `schedule` events, see [AUTOTITLE](/actions/reference/workflows-and-actions/events-that-trigger-workflows#schedule). ## `on.workflow\_call` Use `on.workflow\_call` to define the inputs and outputs for a reusable workflow. You can also map the secrets that are available to the called workflow. For more information on reusable workflows, see [AUTOTITLE](/actions/using-workflows/reusing-workflows). ## `on.workflow\_call.inputs` When using the `workflow\_call` keyword, you can optionally specify inputs that are passed to the called workflow from the caller workflow. For more information about the `workflow\_call` keyword, see [AUTOTITLE](/actions/using-workflows/events-that-trigger-workflows#workflow-reuse-events). In addition to the standard input parameters that are available, `on.workflow\_call.inputs` requires a `type` parameter. For more information, see [`on.workflow\_call.inputs..type`](#onworkflow\_callinputsinput\_idtype). If a `default` parameter is not set, the default value of the input is `false` for a boolean, `0` for a number, and `""` for a string. Within the called workflow, you can use the `inputs` context to refer to an input. For more information, see [AUTOTITLE](/actions/learn-github-actions/contexts#inputs-context). If a caller workflow passes an input that is not specified in the called workflow, this results in an error. ### Example of `on.workflow\_call.inputs` {% raw %} ```yaml on: workflow\_call: inputs: username: description: 'A username passed from the caller workflow' default: 'john-doe' required: false type: string jobs: print-username: runs-on: ubuntu-latest steps: - name: Print the input name to STDOUT run: echo The username is ${{ inputs.username }} ``` {% endraw %} For more information, see [AUTOTITLE](/actions/using-workflows/reusing-workflows). ## `on.workflow\_call.inputs..type` Required if input is defined for the `on.workflow\_call` keyword. The value of this parameter is a string specifying the data type of the input. This must be one of: `boolean`, `number`, or `string`. ## `on.workflow\_call.outputs` A map of outputs for a called workflow. Called workflow outputs are available to all downstream jobs in the caller workflow. Each output has an identifier, an optional `description,` and a `value.` The `value` must be set to the value of an output from a | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/workflow-syntax.md | main | github-actions | [
-0.028921471908688545,
-0.08056489378213882,
-0.038672443479299545,
0.02050480619072914,
0.02096594125032425,
-0.007316499017179012,
0.05576111003756523,
0.02785218134522438,
0.04456574097275734,
-0.018073394894599915,
0.011619465425610542,
0.05356353893876076,
0.0046930015087127686,
-0.07... | 0.142099 |
`number`, or `string`. ## `on.workflow\_call.outputs` A map of outputs for a called workflow. Called workflow outputs are available to all downstream jobs in the caller workflow. Each output has an identifier, an optional `description,` and a `value.` The `value` must be set to the value of an output from a job within the called workflow. In the example below, two outputs are defined for this reusable workflow: `workflow\_output1` and `workflow\_output2`. These are mapped to outputs called `job\_output1` and `job\_output2`, both from a job called `my\_job`. ### Example of `on.workflow\_call.outputs` {% raw %} ```yaml on: workflow\_call: # Map the workflow outputs to job outputs outputs: workflow\_output1: description: "The first job output" value: ${{ jobs.my\_job.outputs.job\_output1 }} workflow\_output2: description: "The second job output" value: ${{ jobs.my\_job.outputs.job\_output2 }} ``` {% endraw %} For information on how to reference a job output, see [`jobs..outputs`](#jobsjob\_idoutputs). For more information, see [AUTOTITLE](/actions/using-workflows/reusing-workflows). ## `on.workflow\_call.secrets` A map of the secrets that can be used in the called workflow. Within the called workflow, you can use the `secrets` context to refer to a secret. > [!NOTE] > If you are passing the secret to a nested reusable workflow, then you must use [`jobs..secrets`](#jobsjob\_idsecrets) again to pass the secret. For more information, see [AUTOTITLE](/actions/using-workflows/reusing-workflows#passing-secrets-to-nested-workflows). If a caller workflow passes a secret that is not specified in the called workflow, this results in an error. ### Example of `on.workflow\_call.secrets` {% raw %} ```yaml on: workflow\_call: secrets: access-token: description: 'A token passed from the caller workflow' required: false jobs: pass-secret-to-action: runs-on: ubuntu-latest steps: # passing the secret to an action - name: Pass the received secret to an action uses: ./.github/actions/my-action with: token: ${{ secrets.access-token }} # passing the secret to a nested reusable workflow pass-secret-to-workflow: uses: ./.github/workflows/my-workflow secrets: token: ${{ secrets.access-token }} ``` {% endraw %} ## `on.workflow\_call.secrets.` A string identifier to associate with the secret. ## `on.workflow\_call.secrets..required` A boolean specifying whether the secret must be supplied. ## `on.workflow\_run.` {% data reusables.actions.workflows.section-specifying-branches %} ## `on.workflow\_dispatch` {% data reusables.actions.workflow-dispatch %} ## `on.workflow\_dispatch.inputs` {% data reusables.actions.workflow-dispatch-inputs %} ### Example of `on.workflow\_dispatch.inputs` {% data reusables.actions.workflow-dispatch-inputs-example %} ## `on.workflow\_dispatch.inputs..required` A boolean specifying whether the input must be supplied. ## `on.workflow\_dispatch.inputs..type` The value of this parameter is a string specifying the data type of the input. This must be one of: `boolean`, `choice`, `number`, `environment` or `string`. ## `permissions` {% data reusables.actions.jobs.section-assigning-permissions-to-jobs %} ### Defining access for the `GITHUB\_TOKEN` scopes {% data reusables.actions.github-token-available-permissions %} #### Changing the permissions in a forked repository {% data reusables.actions.forked-write-permission %} ## How permissions are calculated for a workflow job The permissions for the `GITHUB\_TOKEN` are initially set to the default setting for the enterprise, organization, or repository. If the default is set to the restricted permissions at any of these levels then this will apply to the relevant repositories. For example, if you choose the restricted default at the organization level then all repositories in that organization will use the restricted permissions as the default. The permissions are then adjusted based on any configuration within the workflow file, first at the workflow level and then at the job level. Finally, if the workflow was triggered by a pull request from a forked repository, and the \*\*Send write tokens to workflows from pull requests\*\* setting is not selected, the permissions are adjusted to change any write permissions to read only. ### Setting the `GITHUB\_TOKEN` permissions for all jobs in a workflow You can specify `permissions` at the top level of a workflow, so that the setting applies to all jobs in the workflow. #### Example: Setting the `GITHUB\_TOKEN` permissions for an entire workflow {% data reusables.actions.jobs.setting-permissions-all-jobs-example %} ### Using the `permissions` key | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/workflow-syntax.md | main | github-actions | [
-0.05728762596845627,
-0.0069100079126656055,
-0.021419065073132515,
0.010674001649022102,
-0.03981447592377663,
-0.027576450258493423,
0.029091883450746536,
-0.006283849012106657,
0.054938752204179764,
-0.08913600444793701,
-0.027025939896702766,
-0.017657935619354248,
-0.019905896857380867... | 0.079943 |
the `GITHUB\_TOKEN` permissions for all jobs in a workflow You can specify `permissions` at the top level of a workflow, so that the setting applies to all jobs in the workflow. #### Example: Setting the `GITHUB\_TOKEN` permissions for an entire workflow {% data reusables.actions.jobs.setting-permissions-all-jobs-example %} ### Using the `permissions` key for forked repositories You can use the `permissions` key to add and remove `read` permissions for forked repositories, but typically you can't grant `write` access. The exception to this behavior is where an admin user has selected the \*\*Send write tokens to workflows from pull requests\*\* option in the {% data variables.product.prodname\_actions %} settings. For more information, see [AUTOTITLE](/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#enabling-workflows-for-private-repository-forks). ### Permissions for workflow runs triggered by {% data variables.product.prodname\_dependabot %} {% data reusables.actions.workflow-runs-dependabot-note %} ## `env` A `map` of variables that are available to the steps of all jobs in the workflow. You can also set variables that are only available to the steps of a single job or to a single step. For more information, see [`jobs..env`](#jobsjob\_idenv) and [`jobs..steps[\*].env`](#jobsjob\_idstepsenv). Variables in the `env` map cannot be defined in terms of other variables in the map. {% data reusables.repositories.actions-env-var-note %} ### Example of `env` ```yaml env: SERVER: production ``` ## `defaults` {% data reusables.actions.jobs.setting-default-values-for-jobs-defaults %} ## `defaults.run` {% data reusables.actions.jobs.setting-default-values-for-jobs-defaults-run %} ## `defaults.run.shell` {% data reusables.actions.jobs.setting-default-values-for-jobs-defaults-run-shell %} ## `defaults.run.working-directory` {% data reusables.actions.jobs.setting-default-values-for-jobs-defaults-run-working-directory %} ## `concurrency` {% data reusables.actions.jobs.section-using-concurrency %} ## `jobs` {% data reusables.actions.jobs.section-using-jobs-in-a-workflow %} ## `jobs.` {% data reusables.actions.jobs.section-using-jobs-in-a-workflow-id %} ## `jobs..name` {% data reusables.actions.jobs.section-using-jobs-in-a-workflow-name %} ## `jobs..permissions` {% data reusables.actions.jobs.section-assigning-permissions-to-jobs-specific %} {% data reusables.actions.github-token-scope-descriptions %} ### Defining access for the `GITHUB\_TOKEN` scopes {% data reusables.actions.github-token-available-permissions %} #### Changing the permissions in a forked repository {% data reusables.actions.forked-write-permission %} #### Example: Setting the `GITHUB\_TOKEN` permissions for one job in a workflow {% data reusables.actions.jobs.setting-permissions-specific-jobs-example %} ## `jobs..needs` {% data reusables.actions.jobs.section-using-jobs-in-a-workflow-needs %} ## `jobs..if` {% data reusables.actions.jobs.section-using-conditions-to-control-job-execution %} ## `jobs..runs-on` {% data reusables.actions.jobs.choosing-runner-overview %} ### Choosing {% data variables.product.prodname\_dotcom %}-hosted runners {% data reusables.actions.jobs.choosing-runner-github-hosted %} ### Choosing self-hosted runners {% data reusables.actions.jobs.choosing-runner-self-hosted %} ### Choosing runners in a group {% data reusables.actions.jobs.choosing-runner-group %} {% ifversion not ghes %} ## `jobs..snapshot` {% data reusables.actions.jobs.choosing-runner-custom-images %} {% endif %} ## `jobs..environment` {% data reusables.actions.jobs.section-using-environments-for-jobs %} ## `jobs..concurrency` {% data reusables.actions.jobs.section-using-concurrency-jobs %} ## `jobs..outputs` {% data reusables.actions.jobs.section-defining-outputs-for-jobs %} ## `jobs..env` A `map` of variables that are available to all steps in the job. You can set variables for the entire workflow or an individual step. For more information, see [`env`](#env) and [`jobs..steps[\*].env`](#jobsjob\_idstepsenv). {% data reusables.repositories.actions-env-var-note %} ### Example of `jobs..env` ```yaml jobs: job1: env: FIRST\_NAME: Mona ``` ## `jobs..defaults` {% data reusables.actions.jobs.setting-default-values-for-jobs-defaults-job %} ## `jobs..defaults.run` {% data reusables.actions.jobs.setting-default-values-for-jobs-defaults-job-run %} ## `jobs..defaults.run.shell` {% data reusables.actions.jobs.setting-default-values-for-jobs-defaults-run-shell %} ## `jobs..defaults.run.working-directory` {% data reusables.actions.jobs.setting-default-values-for-jobs-defaults-run-working-directory %} ### Example: Setting default `run` step options for a job {% data reusables.actions.jobs.setting-default-run-value-for-job-example %} ## `jobs..steps` A job contains a sequence of tasks called `steps`. Steps can run commands, run setup tasks, or run an action in your repository, a public repository, or an action published in a Docker registry. Not all steps run actions, but all actions run as a step. Each step runs in its own process in the runner environment and has access to the workspace and filesystem. Because steps run in their own process, changes to environment variables are not preserved between steps. {% data variables.product.prodname\_dotcom %} provides built-in steps to set up and complete a job. {% data variables.product.prodname\_dotcom %} only displays the first 1,000 checks, however, you can run an unlimited number of steps as long as you are within the workflow usage limits. For more information, see [AUTOTITLE](/actions/learn-github-actions/usage-limits-billing-and-administration) for {% data variables.product.prodname\_dotcom %}-hosted runners and | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/workflow-syntax.md | main | github-actions | [
-0.03756077215075493,
-0.0846482515335083,
-0.04441027343273163,
0.015658274292945862,
-0.027340970933437347,
-0.018013257533311844,
0.04740489274263382,
0.028411436825990677,
-0.01231568306684494,
0.027186201885342598,
-0.019234037026762962,
0.038515716791152954,
0.011767992749810219,
-0.... | 0.075256 |
built-in steps to set up and complete a job. {% data variables.product.prodname\_dotcom %} only displays the first 1,000 checks, however, you can run an unlimited number of steps as long as you are within the workflow usage limits. For more information, see [AUTOTITLE](/actions/learn-github-actions/usage-limits-billing-and-administration) for {% data variables.product.prodname\_dotcom %}-hosted runners and [AUTOTITLE](/actions/hosting-your-own-runners/managing-self-hosted-runners/usage-limits-for-self-hosted-runners) for self-hosted runner usage limits. ### Example of `jobs..steps` {% raw %} ```yaml name: Greeting from Mona on: push jobs: my-job: name: My Job runs-on: ubuntu-latest steps: - name: Print a greeting env: MY\_VAR: Hi there! My name is FIRST\_NAME: Mona MIDDLE\_NAME: The LAST\_NAME: Octocat run: | echo $MY\_VAR $FIRST\_NAME $MIDDLE\_NAME $LAST\_NAME. ``` {% endraw %} ## `jobs..steps[\*].id` A unique identifier for the step. You can use the `id` to reference the step in contexts. For more information, see [AUTOTITLE](/actions/learn-github-actions/contexts). ## `jobs..steps[\*].if` You can use the `if` conditional to prevent a step from running unless a condition is met. {% data reusables.actions.if-supported-contexts %} {% data reusables.actions.expression-syntax-if %} For more information, see [AUTOTITLE](/actions/learn-github-actions/expressions). ### Example: Using contexts This step only runs when the event type is a `pull\_request` and the event action is `unassigned`. ```yaml steps: - name: My first step if: {% raw %}${{ github.event\_name == 'pull\_request' && github.event.action == 'unassigned' }}{% endraw %} run: echo This event is a pull request that had an assignee removed. ``` ### Example: Using status check functions The `my backup step` only runs when the previous step of a job fails. For more information, see [AUTOTITLE](/actions/learn-github-actions/expressions#status-check-functions). ```yaml steps: - name: My first step uses: octo-org/action-name@main - name: My backup step if: {% raw %}${{ failure() }}{% endraw %} uses: actions/heroku@1.0.0 ``` ### Example: Using secrets Secrets cannot be directly referenced in `if:` conditionals. Instead, consider setting secrets as job-level environment variables, then referencing the environment variables to conditionally run steps in the job. If a secret has not been set, the return value of an expression referencing the secret (such as {% raw %}`${{ secrets.SuperSecret }}`{% endraw %} in the example) will be an empty string. {% raw %} ```yaml name: Run a step if a secret has been set on: push jobs: my-jobname: runs-on: ubuntu-latest env: super\_secret: ${{ secrets.SuperSecret }} steps: - if: ${{ env.super\_secret != '' }} run: echo 'This step will only run if the secret has a value set.' - if: ${{ env.super\_secret == '' }} run: echo 'This step will only run if the secret does not have a value set.' ``` {% endraw %} For more information, see [AUTOTITLE](/actions/learn-github-actions/contexts#context-availability) and [AUTOTITLE](/actions/security-guides/using-secrets-in-github-actions). ## `jobs..steps[\*].name` A name for your step to display on {% data variables.product.prodname\_dotcom %}. ## `jobs..steps[\*].uses` Selects an action to run as part of a step in your job. An action is a reusable unit of code. You can use an action defined in the same repository as the workflow, a public repository, or in a [published Docker container image](https://hub.docker.com/). We strongly recommend that you include the version of the action you are using by specifying a Git ref, SHA, or Docker tag. If you don't specify a version, it could break your workflows or cause unexpected behavior when the action owner publishes an update. \* Using the commit SHA of a released action version is the safest for stability and security. \* If the action publishes major version tags, you should expect to receive critical fixes and security patches while still retaining compatibility. Note that this behavior is at the discretion of the action's author. \* Using the default branch of an action may be convenient, but if someone releases a new major version with a breaking change, your workflow could break. Some actions | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/workflow-syntax.md | main | github-actions | [
-0.03782511502504349,
-0.039965271949768066,
-0.06324261426925659,
0.003406950505450368,
0.001346216187812388,
-0.057927243411540985,
-0.02882877178490162,
0.06663664430379868,
-0.053374987095594406,
0.0015549762174487114,
-0.0036988272331655025,
0.003940128721296787,
0.009777842089533806,
... | 0.148138 |
critical fixes and security patches while still retaining compatibility. Note that this behavior is at the discretion of the action's author. \* Using the default branch of an action may be convenient, but if someone releases a new major version with a breaking change, your workflow could break. Some actions require inputs that you must set using the [`with`](#jobsjob\_idstepswith) keyword. Review the action's README file to determine the inputs required. Actions are either JavaScript files or Docker containers. If the action you're using is a Docker container you must run the job in a Linux environment. For more details, see [`runs-on`](#jobsjob\_idruns-on). ### Example: Using versioned actions ```yaml steps: # Reference a specific commit - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # Reference the major version of a release - uses: {% data reusables.actions.action-checkout %} # Reference a specific version - uses: {% data reusables.actions.action-checkout %}.2.0 # Reference a branch - uses: actions/checkout@main ``` ### Example: Using a public action `{owner}/{repo}@{ref}` You can specify a branch, ref, or SHA in a public {% data variables.product.prodname\_dotcom %} repository. ```yaml jobs: my\_first\_job: steps: - name: My first step # Uses the default branch of a public repository uses: actions/heroku@main - name: My second step # Uses a specific version tag of a public repository uses: actions/aws@v2.0.1 ``` ### Example: Using a public action in a subdirectory `{owner}/{repo}/{path}@{ref}` A subdirectory in a public {% data variables.product.prodname\_dotcom %} repository at a specific branch, ref, or SHA. ```yaml jobs: my\_first\_job: steps: - name: My first step uses: actions/aws/ec2@main ``` ### Example: Using an action in the same repository as the workflow `./path/to/dir` The path to the directory that contains the action in your workflow's repository. You must check out your repository before using the action. {% data reusables.actions.workflows.section-referencing-an-action-from-the-same-repository %} ### Example: Using a Docker Hub action `docker://{image}:{tag}` A Docker image published on [Docker Hub](https://hub.docker.com/). ```yaml jobs: my\_first\_job: steps: - name: My first step uses: docker://alpine:3.8 ``` {% ifversion fpt or ghec %} ### Example: Using the {% data variables.product.prodname\_registry %} {% data variables.product.prodname\_container\_registry %} `docker://{host}/{image}:{tag}` A public Docker image in the {% data variables.product.prodname\_registry %} {% data variables.product.prodname\_container\_registry %}. ```yaml jobs: my\_first\_job: steps: - name: My first step uses: docker://ghcr.io/OWNER/IMAGE\_NAME ``` {% endif %} ### Example: Using a Docker public registry action `docker://{host}/{image}:{tag}` A Docker image in a public registry. This example uses the Google Container Registry at `gcr.io`. ```yaml jobs: my\_first\_job: steps: - name: My first step uses: docker://gcr.io/cloud-builders/gradle ``` ### Example: Using an action inside a different private repository than the workflow Your workflow must checkout the private repository and reference the action locally. Generate a {% data variables.product.pat\_generic %} and add the token as a secret. For more information, see [AUTOTITLE](/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) and [AUTOTITLE](/actions/security-guides/using-secrets-in-github-actions). Replace `PERSONAL\_ACCESS\_TOKEN` in the example with the name of your secret. ```yaml jobs: my\_first\_job: steps: - name: Check out repository uses: {% data reusables.actions.action-checkout %} with: repository: octocat/my-private-repo ref: v1.0 token: {% raw %}${{ secrets.PERSONAL\_ACCESS\_TOKEN }}{% endraw %} path: ./.github/actions/my-private-repo - name: Run my action uses: ./.github/actions/my-private-repo/my-action ``` Alternatively, use a {% data variables.product.prodname\_github\_app %} instead of a {% data variables.product.pat\_generic %} in order to ensure your workflow continues to run even if the {% data variables.product.pat\_generic %} owner leaves. For more information, see [AUTOTITLE](/apps/creating-github-apps/guides/making-authenticated-api-requests-with-a-github-app-in-a-github-actions-workflow). ## `jobs..steps[\*].run` Runs command-line programs that do not exceed 21,000 characters using the operating system's shell. If you do not provide a `name`, the step name will default to the text specified in the `run` command. Commands run using non-login shells by default. You can choose a different shell and customize the shell used to run commands. For more information, see [`jobs..steps[\*].shell`](#jobsjob\_idstepsshell). Each `run` keyword represents a new process | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/workflow-syntax.md | main | github-actions | [
-0.05536777526140213,
-0.023319128900766373,
-0.0003025987825822085,
-0.020794780924916267,
0.04606632515788078,
-0.028495270758867264,
-0.04283430799841881,
-0.06030873581767082,
-0.026218073442578316,
0.0230883676558733,
-0.0035999626852571964,
0.07690735906362534,
-0.07685238867998123,
... | 0.083608 |
not provide a `name`, the step name will default to the text specified in the `run` command. Commands run using non-login shells by default. You can choose a different shell and customize the shell used to run commands. For more information, see [`jobs..steps[\*].shell`](#jobsjob\_idstepsshell). Each `run` keyword represents a new process and shell in the runner environment. When you provide multi-line commands, each line runs in the same shell. For example: \* A single-line command: ```yaml - name: Install Dependencies run: npm install ``` \* A multi-line command: ```yaml - name: Clean install dependencies and build run: | npm ci npm run build ``` ## `jobs..steps[\*].working-directory` Using the `working-directory` keyword, you can specify the working directory of where to run the command. ```yaml - name: Clean temp directory run: rm -rf \* working-directory: ./temp ``` Alternatively, you can specify a default working directory for all `run` steps in a job, or for all `run` steps in the entire workflow. For more information, see [`defaults.run.working-directory`](/actions/using-workflows/workflow-syntax-for-github-actions#defaultsrunworking-directory) and [`jobs..defaults.run.working-directory`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_iddefaultsrunworking-directory). You can also use a `run` step to run a script. For more information, see [AUTOTITLE](/actions/writing-workflows/choosing-what-your-workflow-does/adding-scripts-to-your-workflow). ## `jobs..steps[\*].shell` You can override the default shell settings in the runner's operating system and the job's default using the `shell` keyword. You can use built-in `shell` keywords, or you can define a custom set of shell options. The shell command that is run internally executes a temporary file that contains the commands specified in the `run` keyword. {% data reusables.actions.supported-shells %} Alternatively, you can specify a default shell for all `run` steps in a job, or for all `run` steps in the entire workflow. For more information, see [`defaults.run.shell`](/actions/using-workflows/workflow-syntax-for-github-actions#defaultsrunshell) and [`jobs..defaults.run.shell`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_iddefaultsrunshell). ### Example: Running a command using Bash ```yaml steps: - name: Display the path shell: bash run: echo $PATH ``` ### Example: Running a command using Windows `cmd` ```yaml steps: - name: Display the path shell: cmd run: echo %PATH% ``` ### Example: Running a command using PowerShell Core ```yaml steps: - name: Display the path shell: pwsh run: echo ${env:PATH} ``` ### Example: Using PowerShell Desktop to run a command ```yaml steps: - name: Display the path shell: powershell run: echo ${env:PATH} ``` ### Example: Running an inline Python script ```yaml steps: - name: Display the path shell: python run: | import os print(os.environ['PATH']) ``` ### Custom shell You can set the `shell` value to a template string using `command [options] {0} [more\_options]`. {% data variables.product.prodname\_dotcom %} interprets the first whitespace-delimited word of the string as the command, and inserts the file name for the temporary script at `{0}`. For example: ```yaml steps: - name: Display the environment variables and their values shell: perl {0} run: | print %ENV ``` The command used, `perl` in this example, must be installed on the runner. {% ifversion fpt or ghec %} For information about the software included on GitHub-hosted runners, see [AUTOTITLE](/actions/using-github-hosted-runners/about-github-hosted-runners#supported-software). {% endif %} ### Exit codes and error action preference For built-in shell keywords, we provide the following defaults that are executed by {% data variables.product.prodname\_dotcom %}-hosted runners. You should use these guidelines when running shell scripts. \* `bash`/`sh`: \* By default, fail-fast behavior is enforced using `set -e` for both `sh` and `bash`. When `shell: bash` is specified, `-o pipefail` is also applied to enforce early exit from pipelines that generate a non-zero exit status. \* You can take full control over shell parameters by providing a template string to the shell options. For example, `bash {0}`. \* `sh`-like shells exit with the exit code of the last command executed in a script, which is also the default behavior for actions. The runner will report | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/workflow-syntax.md | main | github-actions | [
-0.049278367310762405,
0.00034453850821591914,
-0.029073182493448257,
-0.00514580961316824,
-0.01576361618936062,
-0.04796380549669266,
-0.043413158506155014,
0.006790101062506437,
0.012188894674181938,
0.06648316234350204,
-0.027878187596797943,
-0.030923951417207718,
0.004419470671564341,
... | 0.104493 |
\* You can take full control over shell parameters by providing a template string to the shell options. For example, `bash {0}`. \* `sh`-like shells exit with the exit code of the last command executed in a script, which is also the default behavior for actions. The runner will report the status of the step as fail/succeed based on this exit code. \* `powershell`/`pwsh` \* Fail-fast behavior when possible. For `pwsh` and `powershell` built-in shell, we will prepend `$ErrorActionPreference = 'stop'` to script contents. \* We append `if ((Test-Path -LiteralPath variable:\LASTEXITCODE)) { exit $LASTEXITCODE }` to powershell scripts so action statuses reflect the script's last exit code. \* Users can always opt out by not using the built-in shell, and providing a custom shell option like: `pwsh -File {0}`, or `powershell -Command "& '{0}'"`, depending on need. \* `cmd` \* There doesn't seem to be a way to fully opt into fail-fast behavior other than writing your script to check each error code and respond accordingly. Because we can't actually provide that behavior by default, you need to write this behavior into your script. \* `cmd.exe` will exit with the error level of the last program it executed, and it will return the error code to the runner. This behavior is internally consistent with the previous `sh` and `pwsh` default behavior and is the `cmd.exe` default, so this behavior remains intact. ## `jobs..steps[\*].with` A `map` of the input parameters defined by the action. Each input parameter is a key/value pair. Input parameters are set as environment variables. The variable is prefixed with `INPUT\_` and converted to upper case. Input parameters defined for a Docker container must use `args`. For more information, see [`jobs..steps[\*].with.args`](#jobsjob\_idstepswithargs). ### Example of `jobs..steps[\*].with` Defines the three input parameters (`first\_name`, `middle\_name`, and `last\_name`) defined by the `hello\_world` action. These input variables will be accessible to the `hello-world` action as `INPUT\_FIRST\_NAME`, `INPUT\_MIDDLE\_NAME`, and `INPUT\_LAST\_NAME` environment variables. ```yaml jobs: my\_first\_job: steps: - name: My first step uses: actions/hello\_world@main with: first\_name: Mona middle\_name: The last\_name: Octocat ``` ## `jobs..steps[\*].with.args` A `string` that defines the inputs for a Docker container. {% data variables.product.prodname\_dotcom %} passes the `args` to the container's `ENTRYPOINT` when the container starts up. An `array of strings` is not supported by this parameter. A single argument that includes spaces should be surrounded by double quotes `""`. ### Example of `jobs..steps[\*].with.args` {% raw %} ```yaml steps: - name: Explain why this job ran uses: octo-org/action-name@main with: entrypoint: /bin/echo args: The ${{ github.event\_name }} event triggered this step. ``` {% endraw %} The `args` are used in place of the `CMD` instruction in a `Dockerfile`. If you use `CMD` in your `Dockerfile`, use the guidelines ordered by preference: 1. Document required arguments in the action's README and omit them from the `CMD` instruction. 1. Use defaults that allow using the action without specifying any `args`. 1. If the action exposes a `--help` flag, or something similar, use that as the default to make your action self-documenting. ## `jobs..steps[\*].with.entrypoint` Overrides the Docker `ENTRYPOINT` in the `Dockerfile`, or sets it if one wasn't already specified. Unlike the Docker `ENTRYPOINT` instruction which has a shell and exec form, `entrypoint` keyword accepts only a single string defining the executable to be run. ### Example of `jobs..steps[\*].with.entrypoint` ```yaml steps: - name: Run a custom command uses: octo-org/action-name@main with: entrypoint: /a/different/executable ``` The `entrypoint` keyword is meant to be used with Docker container actions, but you can also use it with JavaScript actions that don't define any inputs. ## `jobs..steps[\*].env` Sets variables for steps to use in the runner environment. You can also set variables for | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/workflow-syntax.md | main | github-actions | [
0.032408084720373154,
0.03449646010994911,
-0.049329813569784164,
0.08324877917766571,
0.026791641488671303,
0.07248172909021378,
-0.014498330652713776,
0.02656743675470352,
-0.007771153934299946,
0.07990185171365738,
-0.06552769988775253,
-0.031354133039712906,
0.000424950267188251,
-0.00... | 0.031357 |
uses: octo-org/action-name@main with: entrypoint: /a/different/executable ``` The `entrypoint` keyword is meant to be used with Docker container actions, but you can also use it with JavaScript actions that don't define any inputs. ## `jobs..steps[\*].env` Sets variables for steps to use in the runner environment. You can also set variables for the entire workflow or a job. For more information, see [`env`](#env) and [`jobs..env`](#jobsjob\_idenv). {% data reusables.repositories.actions-env-var-note %} Public actions may specify expected variables in the README file. If you are setting a secret or sensitive value, such as a password or token, you must set secrets using the `secrets` context. For more information, see [AUTOTITLE](/actions/learn-github-actions/contexts). ### Example of `jobs..steps[\*].env` {% raw %} ```yaml steps: - name: My first action env: GITHUB\_TOKEN: ${{ secrets.GITHUB\_TOKEN }} FIRST\_NAME: Mona LAST\_NAME: Octocat ``` {% endraw %} ## `jobs..steps[\*].continue-on-error` Prevents a job from failing when a step fails. Set to `true` to allow a job to pass when this step fails. ## `jobs..steps[\*].timeout-minutes` The maximum number of minutes to run the step before killing the process. Maximum: 360 for both {% data variables.product.github %}-hosted and self-hosted runners. Fractional values are not supported. `timeout-minutes` must be a positive integer. ## `jobs..timeout-minutes` The maximum number of minutes to let a job run before {% data variables.product.prodname\_dotcom %} automatically cancels it. Default: 360 If the timeout exceeds the job execution time limit for the runner, the job will be canceled when the execution time limit is met instead. For more information about job execution time limits, see [AUTOTITLE](/actions/learn-github-actions/usage-limits-billing-and-administration#usage-limits) for {% data variables.product.prodname\_dotcom %}-hosted runners and [AUTOTITLE](/actions/hosting-your-own-runners/managing-self-hosted-runners/usage-limits-for-self-hosted-runners) for self-hosted runner usage limits. > [!NOTE] > {% data reusables.actions.github-token-expiration %} For self-hosted runners, the token may be the limiting factor if the job timeout is greater than 24 hours. For more information on the `GITHUB\_TOKEN`, see [AUTOTITLE](/actions/security-guides/automatic-token-authentication#about-the-github\_token-secret). ## `jobs..strategy` Use `jobs..strategy` to use a matrix strategy for your jobs. {% data reusables.actions.jobs.about-matrix-strategy %} For more information, see [AUTOTITLE](/actions/using-jobs/using-a-matrix-for-your-jobs). ## `jobs..strategy.matrix` Use `jobs..strategy.matrix` to define a matrix of different job configurations. For more information, see [AUTOTITLE](/actions/how-tos/writing-workflows/choosing-what-your-workflow-does/running-variations-of-jobs-in-a-workflow). A matrix will generate a maximum of 256 jobs per workflow run. This limit applies to both {% data variables.product.github %}-hosted and self-hosted runners. The variables that you define become properties in the `matrix` context, and you can reference the property in other areas of your workflow file. In this example, you can use `matrix.version` and `matrix.os` to access the current value of `version` and `os` that the job is using. For more information, see [AUTOTITLE](/actions/learn-github-actions/contexts). By default, {% data variables.product.github %} will maximize the number of jobs run in parallel depending on runner availability. The order of the variables in the matrix determines the order in which the jobs are created. The first variable you define will be the first job that is created in your workflow run. ### Using a single-dimension matrix The following workflow defines the variable `version` with the values `[10, 12, 14]`. The workflow will run three jobs, one for each value in the variable. Each job will access the `version` value through the `matrix.version` context and pass the value as `node-version` to the `actions/setup-node` action. ```yaml jobs: example\_matrix: strategy: matrix: version: [10, 12, 14] steps: - uses: {% data reusables.actions.action-setup-node %} with: node-version: {% raw %}${{ matrix.version }}{% endraw %} ``` ### Using a multi-dimensional matrix Specify multiple variables to create a multi-dimensional matrix. A job will run for each possible combination of the variables. For example, the following workflow specifies two variables: \* Two operating systems specified in the `os` variable \* Three Node.js versions specified in the `version` variable The workflow will run six jobs, one for | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/workflow-syntax.md | main | github-actions | [
-0.048216067254543304,
0.0016761320875957608,
-0.08469599485397339,
0.034953538328409195,
-0.00593458442017436,
-0.02846102975308895,
0.00805810559540987,
-0.014094693586230278,
-0.0032268259674310684,
-0.030989225953817368,
-0.04315357655286789,
0.0013154556509107351,
-0.0025813502725213766... | 0.109798 |
to create a multi-dimensional matrix. A job will run for each possible combination of the variables. For example, the following workflow specifies two variables: \* Two operating systems specified in the `os` variable \* Three Node.js versions specified in the `version` variable The workflow will run six jobs, one for each combination of the `os` and `version` variables. Each job will set the `runs-on` value to the current `os` value and will pass the current `version` value to the `actions/setup-node` action. ```yaml jobs: example\_matrix: strategy: matrix: os: [ubuntu-22.04, ubuntu-20.04] version: [10, 12, 14] runs-on: {% raw %}${{ matrix.os }}{% endraw %} steps: - uses: {% data reusables.actions.action-setup-node %} with: node-version: {% raw %}${{ matrix.version }}{% endraw %} ``` A variable configuration in a matrix can be an `array` of `object`s. For example, the following matrix produces 4 jobs with corresponding contexts. ```yaml matrix: os: - ubuntu-latest - macos-latest node: - version: 14 - version: 20 env: NODE\_OPTIONS=--openssl-legacy-provider ``` Each job in the matrix will have its own combination of `os` and `node` values, as shown below. ```yaml - matrix.os: ubuntu-latest matrix.node.version: 14 - matrix.os: ubuntu-latest matrix.node.version: 20 matrix.node.env: NODE\_OPTIONS=--openssl-legacy-provider - matrix.os: macos-latest matrix.node.version: 14 - matrix.os: macos-latest matrix.node.version: 20 matrix.node.env: NODE\_OPTIONS=--openssl-legacy-provider ``` ## `jobs..strategy.matrix.include` For each object in the `include` list, the key:value pairs in the object will be added to each of the matrix combinations if none of the key:value pairs overwrite any of the original matrix values. If the object cannot be added to any of the matrix combinations, a new matrix combination will be created instead. Note that the original matrix values will not be overwritten, but added matrix values can be overwritten. ### Example: Expanding configurations {% data reusables.actions.jobs.matrix-expand-with-include %} ### Example: Adding configurations {% data reusables.actions.jobs.matrix-add-with-include %} ## `jobs..strategy.matrix.exclude` An excluded configuration only has to be a partial match for it to be excluded. All `include` combinations are processed after `exclude`. This allows you to use `include` to add back combinations that were previously excluded. ## `jobs..strategy.fail-fast` {% data reusables.actions.jobs.section-using-a-build-matrix-for-your-jobs-failfast %} ## `jobs..strategy.max-parallel` By default, {% data variables.product.github %} will maximize the number of jobs run in parallel depending on runner availability. ## `jobs..continue-on-error` `jobs..continue-on-error` applies to a single job. If `jobs..continue-on-error` is `true`, other jobs in the matrix will continue running even if the job with `jobs..continue-on-error: true` fails. Prevents a workflow run from failing when a job fails. Set to `true` to allow a workflow run to pass when this job fails. ### Example: Preventing a specific failing matrix job from failing a workflow run You can allow specific jobs in a job matrix to fail without failing the workflow run. For example, if you wanted to only allow an experimental job with `node` set to `15` to fail without failing the workflow run. {% raw %} ```yaml runs-on: ${{ matrix.os }} continue-on-error: ${{ matrix.experimental }} strategy: fail-fast: false matrix: node: [13, 14] os: [macos-latest, ubuntu-latest] experimental: [false] include: - node: 15 os: ubuntu-latest experimental: true ``` {% endraw %} ## `jobs..container` {% data reusables.actions.docker-container-os-support %} {% data reusables.actions.jobs.section-running-jobs-in-a-container %} ## `jobs..container.image` {% data reusables.actions.jobs.section-running-jobs-in-a-container-image %} ## `jobs..container.credentials` {% data reusables.actions.jobs.section-running-jobs-in-a-container-credentials %} ## `jobs..container.env` {% data reusables.actions.jobs.section-running-jobs-in-a-container-env %} ## `jobs..container.ports` {% data reusables.actions.jobs.section-running-jobs-in-a-container-ports %} ## `jobs..container.volumes` {% data reusables.actions.jobs.section-running-jobs-in-a-container-volumes %} ## `jobs..container.options` {% data reusables.actions.jobs.section-running-jobs-in-a-container-options %} ## `jobs..services` {% data reusables.actions.docker-container-os-support %} Used to host service containers for a job in a workflow. Service containers are useful for creating databases or cache services like Redis. The runner automatically creates a Docker network and manages the life cycle of the service containers. If you configure your job to run in a container, or your | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/workflow-syntax.md | main | github-actions | [
-0.0006901324377395213,
-0.024477606639266014,
-0.108205646276474,
0.03599974513053894,
-0.026782076805830002,
-0.01963363029062748,
-0.06759870797395706,
-0.06172054633498192,
-0.016563015058636665,
0.02787260338664055,
-0.0070384182035923,
0.05307765677571297,
0.008610537275671959,
-0.00... | -0.003758 |
to host service containers for a job in a workflow. Service containers are useful for creating databases or cache services like Redis. The runner automatically creates a Docker network and manages the life cycle of the service containers. If you configure your job to run in a container, or your step uses container actions, you don't need to map ports to access the service or action. Docker automatically exposes all ports between containers on the same Docker user-defined bridge network. You can directly reference the service container by its hostname. The hostname is automatically mapped to the label name you configure for the service in the workflow. If you configure the job to run directly on the runner machine and your step doesn't use a container action, you must map any required Docker service container ports to the Docker host (the runner machine). You can access the service container using localhost and the mapped port. For more information about the differences between networking service containers, see [AUTOTITLE](/actions/using-containerized-services/about-service-containers). ### Example: Using localhost This example creates two services: nginx and redis. When you specify the container port but not the host port, the container port is randomly assigned to a free port on the host. {% data variables.product.prodname\_dotcom %} sets the assigned host port in the {% raw %}`${{job.services..ports}}`{% endraw %} context. In this example, you can access the service host ports using the {% raw %}`${{ job.services.nginx.ports['80'] }}`{% endraw %} and {% raw %}`${{ job.services.redis.ports['6379'] }}`{% endraw %} contexts. ```yaml services: nginx: image: nginx # Map port 8080 on the Docker host to port 80 on the nginx container ports: - 8080:80 redis: image: redis # Map random free TCP port on Docker host to port 6379 on redis container ports: - 6379/tcp steps: - run: | echo "Redis available on 127.0.0.1:{% raw %}${{ job.services.redis.ports['6379'] }}{% endraw %}" echo "Nginx available on 127.0.0.1:{% raw %}${{ job.services.nginx.ports['80'] }}{% endraw %}" ``` ## `jobs..services..image` The Docker image to use as the service container to run the action. The value can be the Docker Hub image name or a registry name. If `jobs..services..image` is assigned an empty string, the service will not start. You can use this to set up conditional services, similar to the following example. ```yaml services: nginx: image: {% raw %}${{ options.nginx == true && 'nginx' || '' }}{% endraw %} ``` ## `jobs..services..credentials` {% data reusables.actions.registry-credentials %} ### Example of `jobs..services..credentials` {% raw %} ```yaml services: myservice1: image: ghcr.io/owner/myservice1 credentials: username: ${{ github.actor }} password: ${{ secrets.github\_token }} myservice2: image: dockerhub\_org/myservice2 credentials: username: ${{ secrets.DOCKER\_USER }} password: ${{ secrets.DOCKER\_PASSWORD }} ``` {% endraw %} ## `jobs..services..env` Sets a `map` of environment variables in the service container. ## `jobs..services..ports` Sets an `array` of ports to expose on the service container. ## `jobs..services..volumes` Sets an `array` of volumes for the service container to use. You can use volumes to share data between services or other steps in a job. You can specify named Docker volumes, anonymous Docker volumes, or bind mounts on the host. To specify a volume, you specify the source and destination path: `:`. The `` is a volume name or an absolute path on the host machine, and `` is an absolute path in the container. ### Example of `jobs..services..volumes` ```yaml volumes: - my\_docker\_volume:/volume\_mount - /data/my\_data - /source/directory:/destination/directory ``` ## `jobs..services..options` Additional Docker container resource options. For a list of options, see [`docker create` options](https://docs.docker.com/engine/reference/commandline/create/#options). > [!WARNING] > The `--network` option is not supported. ## `jobs..uses` The location and version of a reusable workflow file to run as a job. Use one of the following syntaxes: {% data reusables.actions.reusable-workflow-calling-syntax | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/workflow-syntax.md | main | github-actions | [
-0.053630318492650986,
0.022015368565917015,
-0.061942826956510544,
-0.02533133141696453,
-0.015543741174042225,
-0.05391078069806099,
-0.05998249351978302,
-0.012189877219498158,
-0.0026334496214985847,
0.005883479490876198,
-0.10775279998779297,
0.008171440102159977,
-0.016566826030611992,... | 0.079475 |
## `jobs..services..options` Additional Docker container resource options. For a list of options, see [`docker create` options](https://docs.docker.com/engine/reference/commandline/create/#options). > [!WARNING] > The `--network` option is not supported. ## `jobs..uses` The location and version of a reusable workflow file to run as a job. Use one of the following syntaxes: {% data reusables.actions.reusable-workflow-calling-syntax %} ### Example of `jobs..uses` {% data reusables.actions.uses-keyword-example %} For more information, see [AUTOTITLE](/actions/using-workflows/reusing-workflows). ## `jobs..with` When a job is used to call a reusable workflow, you can use `with` to provide a map of inputs that are passed to the called workflow. Any inputs that you pass must match the input specifications defined in the called workflow. Unlike [`jobs..steps[\*].with`](#jobsjob\_idstepswith), the inputs you pass with `jobs..with` are not available as environment variables in the called workflow. Instead, you can reference the inputs by using the `inputs` context. ### Example of `jobs..with` ```yaml jobs: call-workflow: uses: octo-org/example-repo/.github/workflows/called-workflow.yml@main with: username: mona ``` ## `jobs..with.` A pair consisting of a string identifier for the input and the value of the input. The identifier must match the name of an input defined by [`on.workflow\_call.inputs.`](/actions/creating-actions/metadata-syntax-for-github-actions#inputsinput\_id) in the called workflow. The data type of the value must match the type defined by [`on.workflow\_call.inputs..type`](#onworkflow\_callinputsinput\_idtype) in the called workflow. Allowed expression contexts: `github`, and `needs`. ## `jobs..secrets` When a job is used to call a reusable workflow, you can use `secrets` to provide a map of secrets that are passed to the called workflow. Any secrets that you pass must match the names defined in the called workflow. ### Example of `jobs..secrets` {% raw %} ```yaml jobs: call-workflow: uses: octo-org/example-repo/.github/workflows/called-workflow.yml@main secrets: access-token: ${{ secrets.PERSONAL\_ACCESS\_TOKEN }} ``` {% endraw %} ## `jobs..secrets.inherit` Use the `inherit` keyword to pass all the calling workflow's secrets to the called workflow. This includes all secrets the calling workflow has access to, namely organization, repository, and environment secrets. The `inherit` keyword can be used to pass secrets across repositories within the same organization, or across organizations within the same enterprise. ### Example of `jobs..secrets.inherit` {% raw %} ```yaml on: workflow\_dispatch: jobs: pass-secrets-to-workflow: uses: ./.github/workflows/called-workflow.yml secrets: inherit ``` ```yaml on: workflow\_call: jobs: pass-secret-to-action: runs-on: ubuntu-latest steps: - name: Use a repo or org secret from the calling workflow. run: echo ${{ secrets.CALLING\_WORKFLOW\_SECRET }} ``` {% endraw %} ## `jobs..secrets.` A pair consisting of a string identifier for the secret and the value of the secret. The identifier must match the name of a secret defined by [`on.workflow\_call.secrets.`](#onworkflow\_callsecretssecret\_id) in the called workflow. Allowed expression contexts: `github`, `needs`, and `secrets`. ## Filter pattern cheat sheet You can use special characters in path, branch, and tag filters. \* `\*`: Matches zero or more characters, but does not match the `/` character. For example, `Octo\*` matches `Octocat`. \* `\*\*`: Matches zero or more of any character. \* `?`: Matches zero or one of the preceding character. \* `+`: Matches one or more of the preceding character. \* `[]` Matches one alphanumeric character listed in the brackets or included in ranges. Ranges can only include `a-z`, `A-Z`, and `0-9`. For example, the range`[0-9a-z]` matches any digit or lowercase letter. For example, `[CB]at` matches `Cat` or `Bat` and `[1-2]00` matches `100` and `200`. \* `!`: At the start of a pattern makes it negate previous positive patterns. It has no special meaning if not the first character. The characters `\*`, `[`, and `!` are special characters in YAML. If you start a pattern with `\*`, `[`, or `!`, you must enclose the pattern in quotes. Also, if you use a [flow sequence](https://yaml.org/spec/1.2.2/#flow-sequences) with a pattern containing `[` and/or `]`, the pattern must be enclosed in quotes. ```yaml # Valid paths: - | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/workflow-syntax.md | main | github-actions | [
-0.06918814778327942,
0.025309575721621513,
0.005991639103740454,
0.051665060222148895,
0.0010787720093503594,
-0.03493958339095116,
0.01778385229408741,
-0.03838557377457619,
-0.05178123340010643,
-0.02456880919635296,
-0.06307563185691833,
0.04158881679177284,
0.013921835459768772,
0.010... | 0.023632 |
and `!` are special characters in YAML. If you start a pattern with `\*`, `[`, or `!`, you must enclose the pattern in quotes. Also, if you use a [flow sequence](https://yaml.org/spec/1.2.2/#flow-sequences) with a pattern containing `[` and/or `]`, the pattern must be enclosed in quotes. ```yaml # Valid paths: - '\*\*/README.md' # Invalid - creates a parse error that # prevents your workflow from running. paths: - \*\*/README.md # Valid branches: [ main, 'release/v[0-9].[0-9]' ] # Invalid - creates a parse error branches: [ main, release/v[0-9].[0-9] ] ``` For more information about branch, tag, and path filter syntax, see [`on..`](#onpushbranchestagsbranches-ignoretags-ignore), [`on..`](#onpull\_requestpull\_request\_targetbranchesbranches-ignore), and [`on..paths`](#onpushpull\_requestpull\_request\_targetpathspaths-ignore). ### Patterns to match branches and tags | Pattern | Description | Example matches | | ------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------- | | `feature/\*` | The `\*` wildcard matches any character, but does not match slash (`/`). | `feature/my-branch` `feature/your-branch` | | `feature/\*\*` | The `\*\*` wildcard matches any character including slash (`/`) in branch and tag names. | `feature/beta-a/my-branch` `feature/your-branch` `feature/mona/the/octocat` | | `main` `releases/mona-the-octocat` | Matches the exact name of a branch or tag name. | `main` `releases/mona-the-octocat` | | `'\*'` | Matches all branch and tag names that don't contain a slash (`/`). The `\*` character is a special character in YAML. When you start a pattern with `\*`, you must use quotes. | `main` `releases` | | `'\*\*'` | Matches all branch and tag names. This is the default behavior when you don't use a `branches` or `tags` filter. | `all/the/branches` `every/tag` | | `'\*feature'` | The `\*` character is a special character in YAML. When you start a pattern with `\*`, you must use quotes. | `mona-feature` `feature` `ver-10-feature` | | `v2\*` | Matches branch and tag names that start with `v2`. | `v2` `v2.0` `v2.9` | | `v[12].[0-9]+.[0-9]+` | Matches all semantic versioning branches and tags with major version 1 or 2. | `v1.10.1` `v2.0.0` | ### Patterns to match file paths Path patterns must match the whole path, and start from the repository's root. | Pattern | Description of matches | Example matches | | --------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | | `'\*'` | The `\*` wildcard matches any character, but does not match slash (`/`). The `\*` character is a special character in YAML. When you start a pattern with `\*`, you must use quotes. | `README.md` `server.rb` | | `'\*.jsx?'` | The `?` character matches zero or one of the preceding character. | `page.js` `page.jsx` | | `'\*\*'` | The `\*\*` wildcard matches any character including slash (`/`). This is the default behavior when you don't use a `path` filter. | `all/the/files.md` | | `'\*.js'` | The `\*` wildcard matches any character, but does not match slash (`/`). Matches all `.js` files at the root of the repository. | `app.js` `index.js` | | `'\*\*.js'` | Matches all `.js` files in the repository. | `index.js` `js/index.js` `src/js/app.js` | | `docs/\*` | All files within the root of the `docs` directory only, at the root of the repository. | `docs/README.md` `docs/file.txt` | | `docs/\*\*` | Any files in the `docs` directory and its subdirectories at the root of the repository. | `docs/README.md` `docs/mona/octocat.txt` | | `docs/\*\*/\*.md` | A file with a `.md` suffix anywhere in the `docs` directory. | `docs/README.md` `docs/mona/hello-world.md` `docs/a/markdown/file.md` | | `'\*\*/docs/\*\*'` | Any files in a `docs` directory anywhere in the repository. | `docs/hello.md` `dir/docs/my-file.txt` `space/docs/plan/space.doc` | | `'\*\*/README.md'` | A README.md file anywhere in the repository. | `README.md` `js/README.md` | | `'\*\*/\*src/\*\*'` | Any file in a folder with a `src` suffix anywhere in the repository. | `a/src/app.js` `my-src/code/js/app.js` | | `'\*\*/\*-post.md'` | A file | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/workflow-syntax.md | main | github-actions | [
-0.0177372507750988,
-0.007903475314378738,
0.032414693385362625,
-0.0650869682431221,
0.03318006545305252,
-0.04236596077680588,
0.007924458011984825,
-0.015867382287979126,
0.06228809431195259,
-0.019146721810102463,
-0.015257873572409153,
-0.015806445851922035,
-0.010382919572293758,
-0... | 0.011735 |
`docs` directory anywhere in the repository. | `docs/hello.md` `dir/docs/my-file.txt` `space/docs/plan/space.doc` | | `'\*\*/README.md'` | A README.md file anywhere in the repository. | `README.md` `js/README.md` | | `'\*\*/\*src/\*\*'` | Any file in a folder with a `src` suffix anywhere in the repository. | `a/src/app.js` `my-src/code/js/app.js` | | `'\*\*/\*-post.md'` | A file with the suffix `-post.md` anywhere in the repository. | `my-post.md` `path/their-post.md` | | `'\*\*/migrate-\*.sql'` | A file with the prefix `migrate-` and suffix `.sql` anywhere in the repository. | `migrate-10909.sql` `db/migrate-v1.0.sql` `db/sept/migrate-v1.sql` | | `'\*.md'` `'!README.md'` | Using an exclamation mark (`!`) in front of a pattern negates it. When a file matches a pattern and also matches a negative pattern defined later in the file, the file will not be included. | `hello.md` \_Does not match\_ `README.md` `docs/hello.md` | | `'\*.md'` `'!README.md'` `README\*` | Patterns are checked sequentially. A pattern that negates a previous pattern will re-include file paths. | `hello.md` `README.md` `README.doc` | | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/workflow-syntax.md | main | github-actions | [
-0.06711471825838089,
-0.02315792813897133,
-0.04094121977686882,
-0.04090060666203499,
0.09040895104408264,
-0.02378634363412857,
0.01024075411260128,
0.06937691569328308,
0.07497040927410126,
0.044020555913448334,
0.06148075312376022,
0.10458140075206757,
0.054231077432632446,
-0.0011348... | 0.011558 |
{% data reusables.actions.enterprise-github-hosted-runners %} ## About workflow commands Actions can communicate with the runner machine to set environment variables, output values used by other actions, add debug messages to the output logs, and other tasks. Most workflow commands use the `echo` command in a specific format, while others are invoked by writing to a file. For more information, see [Environment files](#environment-files). ### Example of a workflow command {% bash %} ```bash copy echo "::workflow-command parameter1={data},parameter2={data}::{command value}" ``` {% endbash %} {% powershell %} ```powershell copy Write-Output "::workflow-command parameter1={data},parameter2={data}::{command value}" ``` {% endpowershell %} > [!NOTE] > Workflow command and parameter names are case insensitive. > [!WARNING] > If you are using Command Prompt, omit double quote characters (`"`) when using workflow commands. ## Using workflow commands to access toolkit functions The [actions/toolkit](https://github.com/actions/toolkit) includes a number of functions that can be executed as workflow commands. Use the `::` syntax to run the workflow commands within your YAML file; these commands are then sent to the runner over `stdout`. For example, instead of using code to create an error annotation, as below: ```javascript copy core.error('Missing semicolon', {file: 'app.js', startLine: 1}) ``` ### Example: Creating an annotation for an error You can use the `error` command in your workflow to create the same error annotation: {% bash %} ```yaml copy - name: Create annotation for build error run: echo "::error file=app.js,line=1::Missing semicolon" ``` {% endbash %} {% powershell %} ```yaml copy - name: Create annotation for build error run: Write-Output "::error file=app.js,line=1::Missing semicolon" ``` {% endpowershell %} The following table shows which toolkit functions are available within a workflow: | Toolkit function | Equivalent workflow command | | ----------------- | ------------- | | `core.addPath` | Accessible using environment file `GITHUB\_PATH` | | `core.debug` | `debug` | | `core.notice` | `notice` | | `core.error` | `error` | | `core.endGroup` | `endgroup` | | `core.exportVariable` | Accessible using environment file `GITHUB\_ENV` | | `core.getInput` | Accessible using environment variable `INPUT\_{NAME}` | | `core.getState` | Accessible using environment variable `STATE\_{NAME}` | | `core.isDebug` | Accessible using environment variable `RUNNER\_DEBUG` | | `core.summary` | Accessible using environment file `GITHUB\_STEP\_SUMMARY` | | `core.saveState` | Accessible using environment file `GITHUB\_STATE` | | `core.setCommandEcho` | `echo` | | `core.setFailed` | Used as a shortcut for `::error` and `exit 1` | | `core.setOutput` | Accessible using environment file `GITHUB\_OUTPUT` | | `core.setSecret` | `add-mask` | | `core.startGroup` | `group` | | `core.warning` | `warning` | ## Setting a debug message Prints a debug message to the log. You must create a secret named `ACTIONS\_STEP\_DEBUG` with the value `true` to see the debug messages set by this command in the log. For more information, see [AUTOTITLE](/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging). ```text copy ::debug::{message} ``` ### Example: Setting a debug message {% bash %} ```bash copy echo "::debug::Set the Octocat variable" ``` {% endbash %} {% powershell %} ```powershell copy Write-Output "::debug::Set the Octocat variable" ``` {% endpowershell %} ## Setting a notice message Creates a notice message and prints the message to the log. {% data reusables.actions.message-annotation-explanation %} ```text copy ::notice file={name},line={line},endLine={endLine},title={title}::{message} ``` {% data reusables.actions.message-parameters %} ### Example: Setting a notice message {% bash %} ```bash copy echo "::notice file=app.js,line=1,col=5,endColumn=7::Missing semicolon" ``` {% endbash %} {% powershell %} ```powershell copy Write-Output "::notice file=app.js,line=1,col=5,endColumn=7,title=YOUR-TITLE::Missing semicolon" ``` {% endpowershell %} ## Setting a warning message Creates a warning message and prints the message to the log. {% data reusables.actions.message-annotation-explanation %} ```text copy ::warning file={name},line={line},endLine={endLine},title={title}::{message} ``` {% data reusables.actions.message-parameters %} ### Example: Setting a warning message {% bash %} ```bash copy echo "::warning file=app.js,line=1,col=5,endColumn=7,title=YOUR-TITLE::Missing semicolon" ``` {% endbash %} {% powershell %} ```powershell copy Write-Output "::warning file=app.js,line=1,col=5,endColumn=7,title=YOUR-TITLE::Missing semicolon" | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/workflow-commands.md | main | github-actions | [
0.04904913902282715,
-0.026648031547665596,
-0.0760466530919075,
0.07768677175045013,
-0.02671229839324951,
-0.014636141248047352,
0.025955896824598312,
0.029255099594593048,
0.000908521527890116,
0.01166441012173891,
-0.014693616889417171,
-0.04694743454456329,
0.04965468868613243,
-0.041... | 0.093169 |
warning message and prints the message to the log. {% data reusables.actions.message-annotation-explanation %} ```text copy ::warning file={name},line={line},endLine={endLine},title={title}::{message} ``` {% data reusables.actions.message-parameters %} ### Example: Setting a warning message {% bash %} ```bash copy echo "::warning file=app.js,line=1,col=5,endColumn=7,title=YOUR-TITLE::Missing semicolon" ``` {% endbash %} {% powershell %} ```powershell copy Write-Output "::warning file=app.js,line=1,col=5,endColumn=7,title=YOUR-TITLE::Missing semicolon" ``` {% endpowershell %} ## Setting an error message Creates an error message and prints the message to the log. {% data reusables.actions.message-annotation-explanation %} ```text copy ::error file={name},line={line},endLine={endLine},title={title}::{message} ``` {% data reusables.actions.message-parameters %} ### Example: Setting an error message {% bash %} ```bash copy echo "::error file=app.js,line=1,col=5,endColumn=7,title=YOUR-TITLE::Missing semicolon" ``` {% endbash %} {% powershell %} ```powershell copy Write-Output "::error file=app.js,line=1,col=5,endColumn=7,title=YOUR-TITLE::Missing semicolon" ``` {% endpowershell %} ## Grouping log lines Creates an expandable group in the log. To create a group, use the `group` command and specify a `title`. Anything you print to the log between the `group` and `endgroup` commands is nested inside an expandable entry in the log. ```text copy ::group::{title} ::endgroup:: ``` ### Example: Grouping log lines {% bash %} ```yaml copy jobs: bash-example: runs-on: ubuntu-latest steps: - name: Group of log lines run: | echo "::group::My title" echo "Inside group" echo "::endgroup::" ``` {% endbash %} {% powershell %} ```yaml copy jobs: powershell-example: runs-on: windows-latest steps: - name: Group of log lines run: | Write-Output "::group::My title" Write-Output "Inside group" Write-Output "::endgroup::" ``` {% endpowershell %}  ## Masking a value in a log ```text copy ::add-mask::{value} ``` Masking a value prevents a string or variable from being printed in the log. Each masked word separated by whitespace is replaced with the `\*` character. You can use an environment variable or string for the mask's `value`. When you mask a value, it is treated as a secret and will be redacted on the runner. For example, after you mask a value, you won't be able to set that value as an output. ### Example: Masking a string When you print `"Mona The Octocat"` in the log, you'll see `"\*\*\*"`. {% bash %} ```bash copy echo "::add-mask::Mona The Octocat" ``` {% endbash %} {% powershell %} ```powershell copy Write-Output "::add-mask::Mona The Octocat" ``` {% endpowershell %} > [!WARNING] > Make sure you register the secret with 'add-mask' before outputting it in the build logs or using it in any other workflow commands. ### Example: Masking an environment variable When you print the variable `MY\_NAME` or the value `"Mona The Octocat"` in the log, you'll see `"\*\*\*"` instead of `"Mona The Octocat"`. {% bash %} ```yaml copy jobs: bash-example: runs-on: ubuntu-latest env: MY\_NAME: "Mona The Octocat" steps: - name: bash-version run: echo "::add-mask::$MY\_NAME" ``` {% endbash %} {% powershell %} ```yaml copy jobs: powershell-example: runs-on: windows-latest env: MY\_NAME: "Mona The Octocat" steps: - name: powershell-version run: Write-Output "::add-mask::$env:MY\_NAME" ``` {% endpowershell %} ### Example: Masking a generated output within a single job If you do not need to pass your secret from one job to another job, you can: 1. Generate the secret (without outputting it). 1. Mask it with `add-mask`. 1. Use `GITHUB\_OUTPUT` to make the secret available to other steps within the job. {% bash %} ```yaml copy on: push jobs: generate-a-secret-output: runs-on: ubuntu-latest steps: - id: sets-a-secret name: Generate, mask, and output a secret run: | the\_secret=$((RANDOM)) echo "::add-mask::$the\_secret" echo "secret-number=$the\_secret" >> "$GITHUB\_OUTPUT" - name: Use that secret output (protected by a mask) run: |{% raw %} echo "the secret number is ${{ steps.sets-a-secret.outputs.secret-number }}"{% endraw %} ``` {% endbash %} {% | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/workflow-commands.md | main | github-actions | [
0.035847824066877365,
0.03001854196190834,
-0.008473730646073818,
0.10650038719177246,
0.0814051628112793,
0.008272653445601463,
0.11039088666439056,
0.03327860310673714,
0.029238516464829445,
0.004490568768233061,
0.03676779195666313,
-0.08446025103330612,
0.07954810559749603,
-0.00193499... | 0.0594 |
ubuntu-latest steps: - id: sets-a-secret name: Generate, mask, and output a secret run: | the\_secret=$((RANDOM)) echo "::add-mask::$the\_secret" echo "secret-number=$the\_secret" >> "$GITHUB\_OUTPUT" - name: Use that secret output (protected by a mask) run: |{% raw %} echo "the secret number is ${{ steps.sets-a-secret.outputs.secret-number }}"{% endraw %} ``` {% endbash %} {% powershell %} ```yaml copy on: push jobs: generate-a-secret-output: runs-on: ubuntu-latest steps: - id: sets-a-secret name: Generate, mask, and output a secret shell: pwsh run: | Set-Variable -Name TheSecret -Value (Get-Random) Write-Output "::add-mask::$TheSecret" "secret-number=$TheSecret" >> $env:GITHUB\_OUTPUT - name: Use that secret output (protected by a mask) shell: pwsh run: |{% raw %} Write-Output "the secret number is ${{ steps.sets-a-secret.outputs.secret-number }}"{% endraw %} ``` {% endpowershell %} ### Example: Masking and passing a secret between jobs or workflows If you want to pass a masked secret between jobs or workflows, you should store the secret in a store and then retrieve it in the subsequent job or workflow. #### Setup 1. Set up a secret store to store the secret that you will generate during your workflow. For example, Vault. 1. Generate a key for reading and writing to that secret store. Store the key as a repository secret. In the following example workflow, the secret name is `SECRET\_STORE\_CREDENTIALS`. For more information, see [AUTOTITLE](/actions/security-guides/using-secrets-in-github-actions). #### Workflow > [!NOTE] > This workflow uses an imaginary secret store, `secret-store`, which has imaginary commands `store-secret` and `retrieve-secret`. `some/secret-store@ 27b31702a0e7fc50959f5ad993c78deac1bdfc29` is an imaginary action that installs the `secret-store` application and configures it to connect to an `instance` with `credentials`. {% bash %} ```yaml copy on: push jobs: secret-generator: runs-on: ubuntu-latest outputs: handle: {% raw %}${{ steps.generate-secret.outputs.handle }}{% endraw %} steps: - uses: some/secret-store@27b31702a0e7fc50959f5ad993c78deac1bdfc29 with:{% raw %} credentials: ${{ secrets.SECRET\_STORE\_CREDENTIALS }} instance: ${{ secrets.SECRET\_STORE\_INSTANCE }}{% endraw %} - name: generate secret id: generate-secret shell: bash run: | GENERATED\_SECRET=$((RANDOM)) echo "::add-mask::$GENERATED\_SECRET" SECRET\_HANDLE=$(secret-store store-secret "$GENERATED\_SECRET") echo "handle=$SECRET\_HANDLE" >> "$GITHUB\_OUTPUT" secret-consumer: runs-on: macos-latest needs: secret-generator steps: - uses: some/secret-store@27b31702a0e7fc50959f5ad993c78deac1bdfc29 with:{% raw %} credentials: ${{ secrets.SECRET\_STORE\_CREDENTIALS }} instance: ${{ secrets.SECRET\_STORE\_INSTANCE }}{% endraw %} - name: use secret shell: bash run: |{% raw %} SECRET\_HANDLE="${{ needs.secret-generator.outputs.handle }}"{% endraw %} RETRIEVED\_SECRET=$(secret-store retrieve-secret "$SECRET\_HANDLE") echo "::add-mask::$RETRIEVED\_SECRET" echo "We retrieved our masked secret: $RETRIEVED\_SECRET" ``` {% endbash %} {% powershell %} ```yaml copy on: push jobs: secret-generator: runs-on: ubuntu-latest steps: - uses: some/secret-store@27b31702a0e7fc50959f5ad993c78deac1bdfc29 with:{% raw %} credentials: ${{ secrets.SECRET\_STORE\_CREDENTIALS }} instance: ${{ secrets.SECRET\_STORE\_INSTANCE }}{% endraw %} - name: generate secret shell: pwsh run: | Set-Variable -Name Generated\_Secret -Value (Get-Random) Write-Output "::add-mask::$Generated\_Secret" Set-Variable -Name Secret\_Handle -Value (Store-Secret "$Generated\_Secret") "handle=$Secret\_Handle" >> $env:GITHUB\_OUTPUT secret-consumer: runs-on: macos-latest needs: secret-generator steps: - uses: some/secret-store@27b31702a0e7fc50959f5ad993c78deac1bdfc29 with:{% raw %} credentials: ${{ secrets.SECRET\_STORE\_CREDENTIALS }} instance: ${{ secrets.SECRET\_STORE\_INSTANCE }}{% endraw %} - name: use secret shell: pwsh run: |{% raw %} Set-Variable -Name Secret\_Handle -Value "${{ needs.secret-generator.outputs.handle }}"{% endraw %} Set-Variable -Name Retrieved\_Secret -Value (Retrieve-Secret "$Secret\_Handle") echo "::add-mask::$Retrieved\_Secret" echo "We retrieved our masked secret: $Retrieved\_Secret" ``` {% endpowershell %} ## Stopping and starting workflow commands Stops processing any workflow commands. This special command allows you to log anything without accidentally running a workflow command. For example, you could stop logging to output an entire script that has comments. ```text copy ::stop-commands::{endtoken} ``` To stop the processing of workflow commands, pass a unique token to `stop-commands`. To resume processing workflow commands, pass the same token that you used to stop workflow commands. > [!WARNING] > Make sure the token you're using is randomly generated and unique for each run. ```text copy ::{endtoken}:: ``` ### Example: Stopping and starting workflow commands {% bash %} ```yaml copy jobs: workflow-command-job: runs-on: ubuntu-latest steps: - name: Disable workflow commands run: | echo '::warning:: This is a warning message, to | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/workflow-commands.md | main | github-actions | [
-0.020729878917336464,
-0.02007877826690674,
-0.1054229885339737,
0.07249905914068222,
0.031126417219638824,
0.009824542328715324,
0.02274928241968155,
-0.04210493713617325,
0.03895234689116478,
0.039978768676519394,
0.03801487386226654,
-0.046701084822416306,
0.047676604241132736,
-0.0659... | -0.00859 |
Make sure the token you're using is randomly generated and unique for each run. ```text copy ::{endtoken}:: ``` ### Example: Stopping and starting workflow commands {% bash %} ```yaml copy jobs: workflow-command-job: runs-on: ubuntu-latest steps: - name: Disable workflow commands run: | echo '::warning:: This is a warning message, to demonstrate that commands are being processed.' stopMarker=$(uuidgen) echo "::stop-commands::$stopMarker" echo '::warning:: This will NOT be rendered as a warning, because stop-commands has been invoked.' echo "::$stopMarker::" echo '::warning:: This is a warning again, because stop-commands has been turned off.' ``` {% endbash %} {% powershell %} ```yaml copy jobs: workflow-command-job: runs-on: windows-latest steps: - name: Disable workflow commands run: | Write-Output '::warning:: This is a warning message, to demonstrate that commands are being processed.' $stopMarker = New-Guid Write-Output "::stop-commands::$stopMarker" Write-Output '::warning:: This will NOT be rendered as a warning, because stop-commands has been invoked.' Write-Output "::$stopMarker::" Write-Output '::warning:: This is a warning again, because stop-commands has been turned off.' ``` {% endpowershell %} ## Sending values to the pre and post actions You can create environment variables for sharing with your workflow's `pre:` or `post:` actions by writing to the file located at `GITHUB\_STATE`. For example, you can create a file with the `pre:` action, pass the file location to the `main:` action, and then use the `post:` action to delete the file. Alternatively, you could create a file with the `main:` action, pass the file location to the `post:` action, and also use the `post:` action to delete the file. If you have multiple `pre:` or `post:` actions, you can only access the saved value in the action where it was written to `GITHUB\_STATE`. For more information on the `post:` action, see [AUTOTITLE](/actions/creating-actions/metadata-syntax-for-github-actions#runspost). The `GITHUB\_STATE` file is only available within an action. The saved value is stored as an environment value with the `STATE\_` prefix. This example uses JavaScript to write to the `GITHUB\_STATE` file. The resulting environment variable is named `STATE\_processID` with the value of `12345`: ```javascript copy import \* as fs from 'fs' import \* as os from 'os' fs.appendFileSync(process.env.GITHUB\_STATE, `processID=12345${os.EOL}`, { encoding: 'utf8' }) ``` The `STATE\_processID` variable is then exclusively available to the cleanup script running under the `main` action. This example runs in `main` and uses JavaScript to display the value assigned to the `STATE\_processID` environment variable: ```javascript copy console.log("The running PID from the main action is: " + process.env.STATE\_processID); ``` ## Environment files During the execution of a workflow, the runner generates temporary files that can be used to perform certain actions. The path to these files can be accessed and edited using GitHub's default environment variables. See [AUTOTITLE](/actions/reference/variables-reference#default-environment-variables). You will need to use UTF-8 encoding when writing to these files to ensure proper processing of the commands. Multiple commands can be written to the same file, separated by newlines. To use environment variables in a GitHub Action, you create or modify `.env` files using specific GitHub Actions commands. Here's how: ```yaml copy name: Example Workflow for Environment Files on: push jobs: set\_and\_use\_env\_vars: runs-on: ubuntu-latest steps: - name: Set environment variable run: echo "MY\_ENV\_VAR=myValue" >> $GITHUB\_ENV - name: Use environment variable run: | echo "The value of MY\_ENV\_VAR is $MY\_ENV\_VAR" ``` Another example would be to use it to store metadata like build timestamps, commit SHAs, or artifact names: ```yaml copy steps: - name: Store build timestamp run: echo "BUILD\_TIME=$(date +'%T')" >> $GITHUB\_ENV - name: Deploy using stored timestamp run: echo "Deploying at $BUILD\_TIME" ``` {% powershell %} > [!NOTE] > PowerShell versions 5.1 and below (`shell: powershell`) do not use UTF-8 by default, so you must specify the UTF-8 encoding. For example: | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/workflow-commands.md | main | github-actions | [
-0.003889373503625393,
0.01236666552722454,
-0.0010571840684860945,
0.050519783049821854,
0.10965873301029205,
0.03202353045344353,
0.0356171689927578,
-0.06318702548742294,
0.05758723244071007,
-0.008124702610075474,
0.016441890969872475,
-0.10047220438718796,
-0.014035003259778023,
-0.02... | 0.039344 |
name: Store build timestamp run: echo "BUILD\_TIME=$(date +'%T')" >> $GITHUB\_ENV - name: Deploy using stored timestamp run: echo "Deploying at $BUILD\_TIME" ``` {% powershell %} > [!NOTE] > PowerShell versions 5.1 and below (`shell: powershell`) do not use UTF-8 by default, so you must specify the UTF-8 encoding. For example: > > ```yaml copy > jobs: > legacy-powershell-example: > runs-on: windows-latest > steps: > - shell: powershell > run: | > "mypath" | Out-File -FilePath $env:GITHUB\_PATH -Encoding utf8 -Append > ``` > > PowerShell Core versions 6 and higher (`shell: pwsh`) use UTF-8 by default. For example: > > ```yaml copy > jobs: > powershell-core-example: > runs-on: windows-latest > steps: > - shell: pwsh > run: | > "mypath" >> $env:GITHUB\_PATH > ``` {% endpowershell %} ## Setting an environment variable {% data reusables.actions.environment-variables-as-case-sensitive %} {% bash %} ```bash copy echo "{environment\_variable\_name}={value}" >> "$GITHUB\_ENV" ``` {% endbash %} {% powershell %} \* Using PowerShell version 6 and higher: ```powershell copy "{environment\_variable\_name}={value}" >> $env:GITHUB\_ENV ``` \* Using PowerShell version 5.1 and below: ```powershell copy "{environment\_variable\_name}={value}" | Out-File -FilePath $env:GITHUB\_ENV -Encoding utf8 -Append ``` {% endpowershell %} You can make an environment variable available to any subsequent steps in a workflow job by defining or updating the environment variable and writing this to the `GITHUB\_ENV` environment file. The step that creates or updates the environment variable does not have access to the new value, but all subsequent steps in a job will have access. {% data reusables.actions.environment-variables-are-fixed %} For more information about the default environment variables, see [AUTOTITLE](/actions/learn-github-actions/environment-variables#default-environment-variables). > [!NOTE] > Due to security restrictions, `GITHUB\_ENV` cannot be used to set the `NODE\_OPTIONS` environment variable. ### Example of writing an environment variable to `GITHUB\_ENV` {% bash %} ```yaml copy steps: - name: Set the value id: step\_one run: | echo "action\_state=yellow" >> "$GITHUB\_ENV" - name: Use the value id: step\_two run: | printf '%s\n' "$action\_state" # This will output 'yellow' ``` {% endbash %} {% powershell %} ```yaml copy steps: - name: Set the value id: step\_one run: | "action\_state=yellow" >> $env:GITHUB\_ENV - name: Use the value id: step\_two run: | Write-Output "$env:action\_state" # This will output 'yellow' ``` {% endpowershell %} ### Multiline strings For multiline strings, you may use a delimiter with the following syntax. ```text copy {name}<<{delimiter} {value} {delimiter} ``` > [!WARNING] > Make sure the delimiter you're using won't occur on a line of its own within the value. If the value is completely arbitrary then you shouldn't use this format. Write the value to a file instead. #### Example of a multiline string This example uses `EOF` as the delimiter, and sets the `JSON\_RESPONSE` environment variable to the value of the `curl` response. {% bash %} ```yaml copy steps: - name: Set the value in bash id: step\_one run: | { echo 'JSON\_RESPONSE<> "$GITHUB\_ENV" ``` {% endbash %} {% powershell %} ```yaml copy steps: - name: Set the value in pwsh id: step\_one run: | $EOF = (New-Guid).Guid "JSON\_RESPONSE<<$EOF" >> $env:GITHUB\_ENV (Invoke-WebRequest -Uri "https://example.com").Content >> $env:GITHUB\_ENV "$EOF" >> $env:GITHUB\_ENV shell: pwsh ``` {% endpowershell %} ## Setting an output parameter Sets a step's output parameter. Note that the step will need an `id` to be defined to later retrieve the output value. You can set multi-line output values with the same technique used in the [Multiline strings](/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings) section to define multi-line environment variables. {% bash %} ```bash copy echo "{name}={value}" >> "$GITHUB\_OUTPUT" ``` {% endbash %} {% powershell %} ```powershell copy "{name}=value" >> $env:GITHUB\_OUTPUT ``` {% endpowershell %} ### Example of setting an output parameter {% bash %} This example demonstrates how to set the `SELECTED\_COLOR` output | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/workflow-commands.md | main | github-actions | [
0.06467602401971817,
-0.0002660163736436516,
-0.05658143013715744,
0.018770065158605576,
-0.017788013443350792,
0.0698966458439827,
0.012240193784236908,
-0.020900970324873924,
0.03758009523153305,
0.06639060378074646,
0.0020035833586007357,
-0.09961897879838943,
0.002000696025788784,
0.02... | -0.060551 |
section to define multi-line environment variables. {% bash %} ```bash copy echo "{name}={value}" >> "$GITHUB\_OUTPUT" ``` {% endbash %} {% powershell %} ```powershell copy "{name}=value" >> $env:GITHUB\_OUTPUT ``` {% endpowershell %} ### Example of setting an output parameter {% bash %} This example demonstrates how to set the `SELECTED\_COLOR` output parameter and later retrieve it: ```yaml copy - name: Set color id: color-selector run: echo "SELECTED\_COLOR=green" >> "$GITHUB\_OUTPUT" - name: Get color env:{% raw %} SELECTED\_COLOR: ${{ steps.color-selector.outputs.SELECTED\_COLOR }}{% endraw %} run: echo "The selected color is $SELECTED\_COLOR" ``` {% endbash %} {% powershell %} This example demonstrates how to set the `SELECTED\_COLOR` output parameter and later retrieve it: ```yaml copy - name: Set color id: color-selector run: | "SELECTED\_COLOR=green" >> $env:GITHUB\_OUTPUT - name: Get color env:{% raw %} SELECTED\_COLOR: ${{ steps.color-selector.outputs.SELECTED\_COLOR }}{% endraw %} run: Write-Output "The selected color is $env:SELECTED\_COLOR" ``` {% endpowershell %} ## Adding a job summary {% bash %} ```bash copy echo "{markdown content}" >> $GITHUB\_STEP\_SUMMARY ``` {% endbash %} {% powershell %} ```powershell copy "{markdown content}" >> $env:GITHUB\_STEP\_SUMMARY ``` {% endpowershell %} You can set some custom Markdown for each job so that it will be displayed on the summary page of a workflow run. You can use job summaries to display and group unique content, such as test result summaries, so that someone viewing the result of a workflow run doesn't need to go into the logs to see important information related to the run, such as failures. Job summaries support [{% data variables.product.prodname\_dotcom %} flavored Markdown](https://github.github.com/gfm/), and you can add your Markdown content for a step to the `GITHUB\_STEP\_SUMMARY` environment file. `GITHUB\_STEP\_SUMMARY` is unique for each step in a job. For more information about the per-step file that `GITHUB\_STEP\_SUMMARY` references, see [Environment files](#environment-files). When a job finishes, the summaries for all steps in a job are grouped together into a single job summary and are shown on the workflow run summary page. If multiple jobs generate summaries, the job summaries are ordered by job completion time. ### Example of adding a job summary {% bash %} ```bash copy echo "### Hello world! :rocket:" >> $GITHUB\_STEP\_SUMMARY ``` {% endbash %} {% powershell %} ```powershell copy "### Hello world! :rocket:" >> $env:GITHUB\_STEP\_SUMMARY ``` {% endpowershell %}  ### Multiline Markdown content For multiline Markdown content, you can use `>>` to continuously append content for the current step. With every append operation, a newline character is automatically added. #### Example of multiline Markdown content {% bash %} ```yaml - name: Generate list using Markdown run: | echo "This is the lead in sentence for the list" >> $GITHUB\_STEP\_SUMMARY echo "" >> $GITHUB\_STEP\_SUMMARY # this is a blank line echo "- Lets add a bullet point" >> $GITHUB\_STEP\_SUMMARY echo "- Lets add a second bullet point" >> $GITHUB\_STEP\_SUMMARY echo "- How about a third one?" >> $GITHUB\_STEP\_SUMMARY ``` {% endbash %} {% powershell %} ```yaml - name: Generate list using Markdown run: | "This is the lead in sentence for the list" >> $env:GITHUB\_STEP\_SUMMARY "" >> $env:GITHUB\_STEP\_SUMMARY # this is a blank line "- Lets add a bullet point" >> $env:GITHUB\_STEP\_SUMMARY "- Lets add a second bullet point" >> $env:GITHUB\_STEP\_SUMMARY "- How about a third one?" >> $env:GITHUB\_STEP\_SUMMARY ``` {% endpowershell %} ### Overwriting job summaries To clear all content for the current step, you can use `>` to overwrite any previously added content in Bash, or remove `-Append` in PowerShell #### Example of overwriting job summaries {% bash %} ```yaml - name: Overwrite Markdown run: | echo | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/workflow-commands.md | main | github-actions | [
0.06163064017891884,
-0.026035891845822334,
-0.06041428819298744,
0.07308351248502731,
0.011238538660109043,
0.051390063017606735,
0.0852012112736702,
0.010867240838706493,
-0.0203852578997612,
0.011897263117134571,
-0.03977157548069954,
-0.11435888707637787,
0.0532514713704586,
-0.0519211... | -0.012859 |
``` {% endpowershell %} ### Overwriting job summaries To clear all content for the current step, you can use `>` to overwrite any previously added content in Bash, or remove `-Append` in PowerShell #### Example of overwriting job summaries {% bash %} ```yaml - name: Overwrite Markdown run: | echo "Adding some Markdown content" >> $GITHUB\_STEP\_SUMMARY echo "There was an error, we need to clear the previous Markdown with some new content." > $GITHUB\_STEP\_SUMMARY ``` {% endbash %} {% powershell %} ```yaml - name: Overwrite Markdown run: | "Adding some Markdown content" >> $env:GITHUB\_STEP\_SUMMARY "There was an error, we need to clear the previous Markdown with some new content." >> $env:GITHUB\_STEP\_SUMMARY ``` {% endpowershell %} ### Removing job summaries To completely remove a summary for the current step, the file that `GITHUB\_STEP\_SUMMARY` references can be deleted. #### Example of removing job summaries {% bash %} ```yaml - name: Delete all summary content run: | echo "Adding Markdown content that we want to remove before the step ends" >> $GITHUB\_STEP\_SUMMARY rm $GITHUB\_STEP\_SUMMARY ``` {% endbash %} {% powershell %} ```yaml - name: Delete all summary content run: | "Adding Markdown content that we want to remove before the step ends" >> $env:GITHUB\_STEP\_SUMMARY Remove-Item $env:GITHUB\_STEP\_SUMMARY ``` {% endpowershell %} After a step has completed, job summaries are uploaded and subsequent steps cannot modify previously uploaded Markdown content. Summaries automatically mask any secrets that might have been added accidentally. If a job summary contains sensitive information that must be deleted, you can delete the entire workflow run to remove all its job summaries. For more information see [AUTOTITLE](/actions/managing-workflow-runs/deleting-a-workflow-run). ### Step isolation and limits Job summaries are isolated between steps and each step is restricted to a maximum size of 1MiB. Isolation is enforced between steps so that potentially malformed Markdown from a single step cannot break Markdown rendering for subsequent steps. If more than 1MiB of content is added for a step, then the upload for the step will fail and an error annotation will be created. Upload failures for job summaries do not affect the overall status of a step or a job. A maximum of 20 job summaries from steps are displayed per job. ## Adding a system path Prepends a directory to the system `PATH` variable and automatically makes it available to all subsequent actions in the current job; the currently running action cannot access the updated path variable. To see the currently defined paths for your job, you can use `echo "$PATH"` in a step or an action. ### Example of adding a system path {% bash %} This example demonstrates how to add the user `$HOME/.local/bin` directory to `PATH`: ```bash copy echo "$HOME/.local/bin" >> "$GITHUB\_PATH" ``` {% endbash %} {% powershell %} This example demonstrates how to add the user `$env:HOMEPATH/.local/bin` directory to `PATH`: ```powershell copy "$env:HOMEPATH/.local/bin" | Out-File -FilePath "$env:GITHUB\_PATH" -Append ``` {% endpowershell %} | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/workflow-commands.md | main | github-actions | [
0.012328089214861393,
0.046416301280260086,
0.028291162103414536,
0.026382489129900932,
0.0493522547185421,
0.046403151005506516,
-0.019408728927373886,
-0.041062574833631516,
0.04823464900255203,
0.07331547141075134,
-0.010485210455954075,
0.006225238088518381,
0.039037443697452545,
-0.01... | 0.006778 |
{% data reusables.actions.types-of-actions %} ## `name` \*\*Required\*\* The name of your action. {% data variables.product.prodname\_dotcom %} displays the `name` in the \*\*Actions\*\* tab to help visually identify actions in each job. ## `author` \*\*Optional\*\* The name of the action's author. ## `description` \*\*Required\*\* A short description of the action. ## `inputs` \*\*Optional\*\* Input parameters allow you to specify data that the action expects to use during runtime. {% data variables.product.prodname\_dotcom %} stores input parameters as environment variables. We recommend using lowercase input ids. ### Example: Specifying inputs This example configures two inputs: `num-octocats` and `octocat-eye-color`. The `num-octocats` input is not required and will default to a value of `1`. `octocat-eye-color` is required and has no default value. > [!NOTE] > Actions using `required: true` will not automatically return an error if the input is not specified. Workflow files that use this action can use the `with` keyword to set an input value for `octocat-eye-color`. For more information about the `with` syntax, see [AUTOTITLE](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idstepswith). ```yaml inputs: num-octocats: description: 'Number of Octocats' required: false default: '1' octocat-eye-color: description: 'Eye color of the Octocats' required: true ``` When you specify an input, {% data variables.product.prodname\_dotcom %} creates an environment variable for the input with the name `INPUT\_`. The environment variable created converts input names to uppercase letters and replaces spaces with `\_` characters. If the action is written using a [composite](/actions/creating-actions/creating-a-composite-action), then it will not automatically get `INPUT\_`. With composite actions you can use `inputs` [AUTOTITLE](/actions/learn-github-actions/contexts) to access action inputs. To access the environment variable in a Docker container action, you must pass the input using the `args` keyword in the action metadata file. For more information about the action metadata file for Docker container actions, see [AUTOTITLE](/actions/creating-actions/creating-a-docker-container-action#creating-an-action-metadata-file). For example, if a workflow defined the `num-octocats` and `octocat-eye-color` inputs, the action code could read the values of the inputs using the `INPUT\_NUM-OCTOCATS` and `INPUT\_OCTOCAT-EYE-COLOR` environment variables. ### `inputs.` \*\*Required\*\* A `string` identifier to associate with the input. The value of `` is a map of the input's metadata. The `` must be a unique identifier within the `inputs` object. The `` must start with a letter or `\_` and contain only alphanumeric characters, `-`, or `\_`. ### `inputs..description` \*\*Required\*\* A `string` description of the input parameter. ### `inputs..required` \*\*Optional\*\* A `boolean` to indicate whether the action requires the input parameter. Set to `true` when the parameter is required. ### `inputs..default` \*\*Optional\*\* A `string` representing the default value. The default value is used when an input parameter isn't specified in a workflow file. ### `inputs..deprecationMessage` \*\*Optional\*\* If the input parameter is used, this `string` is logged as a warning message. You can use this warning to notify users that the input is {% data variables.release-phases.closing\_down %} and mention any alternatives. ## `outputs` for Docker container and JavaScript actions \*\*Optional\*\* Output parameters allow you to declare data that an action sets. Actions that run later in a workflow can use the output data set in previously run actions. For example, if you had an action that performed the addition of two inputs (x + y = z), the action could output the sum (z) for other actions to use as an input. {% data reusables.actions.output-limitations %} If you don't declare an output in your action metadata file, you can still set outputs and use them in a workflow. For more information on setting outputs in an action, see [AUTOTITLE](/actions/using-workflows/workflow-commands-for-github-actions#setting-an-output-parameter). ### Example: Declaring outputs for Docker container and JavaScript actions ```yaml outputs: sum: # id of the output description: 'The sum of the inputs' ``` ### `outputs.` \*\*Required\*\* A `string` identifier to associate with the output. | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/metadata-syntax.md | main | github-actions | [
-0.021299060434103012,
-0.012686106376349926,
-0.07740388810634613,
0.038664426654577255,
-0.01765364408493042,
0.041911929845809937,
0.14425639808177948,
0.0748024731874466,
-0.11696559190750122,
0.004078767262399197,
0.004428924527019262,
-0.0518130287528038,
0.052382927387952805,
0.0053... | 0.073979 |
in a workflow. For more information on setting outputs in an action, see [AUTOTITLE](/actions/using-workflows/workflow-commands-for-github-actions#setting-an-output-parameter). ### Example: Declaring outputs for Docker container and JavaScript actions ```yaml outputs: sum: # id of the output description: 'The sum of the inputs' ``` ### `outputs.` \*\*Required\*\* A `string` identifier to associate with the output. The value of `` is a map of the output's metadata. The `` must be a unique identifier within the `outputs` object. The `` must start with a letter or `\_` and contain only alphanumeric characters, `-`, or `\_`. ### `outputs..description` \*\*Required\*\* A `string` description of the output parameter. ## `outputs` for composite actions \*\*Optional\*\* `outputs` use the same parameters as `outputs.` and `outputs..description` (see [`outputs` for Docker container and JavaScript actions](#outputs-for-docker-container-and-javascript-actions)), but also includes the `value` token. {% data reusables.actions.output-limitations %} ### Example: Declaring outputs for composite actions {% raw %} ```yaml outputs: random-number: description: "Random number" value: ${{ steps.random-number-generator.outputs.random-id }} runs: using: "composite" steps: - id: random-number-generator run: echo "random-id=$(echo $RANDOM)" >> $GITHUB\_OUTPUT shell: bash ``` {% endraw %} ### `outputs..value` \*\*Required\*\* The value that the output parameter will be mapped to. You can set this to a `string` or an expression with context. For example, you can use the `steps` context to set the `value` of an output to the output value of a step. For more information on how to use context syntax, see [AUTOTITLE](/actions/learn-github-actions/contexts). ## `runs` \*\*Required\*\* Specifies whether this is a JavaScript action, a composite action, or a Docker container action and how the action is executed. ## `runs` for JavaScript actions \*\*Required\*\* Configures the path to the action's code and the runtime used to execute the code. ### Example: Using Node.js v24 ```yaml runs: using: 'node24' main: 'main.js' ``` ### `runs.using` for JavaScript actions \*\*Required\*\* The runtime used to execute the code specified in [`main`](#runsmain). \* Use `node20` for Node.js v20. \* Use `node24` for Node.js v24. ### `runs.main` \*\*Required\*\* The file that contains your action code. The runtime specified in [`using`](#runsusing-for-javascript-actions) executes this file. ### `runs.pre` \*\*Optional\*\* Allows you to run a script at the start of a job, before the `main:` action begins. For example, you can use `pre:` to run a prerequisite setup script. The runtime specified with the [`using`](#runsusing-for-javascript-actions) syntax will execute this file. The `pre:` action always runs by default but you can override this using [`runs.pre-if`](#runspre-if). > [!NOTE] > `runs.pre` is not supported for local actions. In this example, the `pre:` action runs a script called `setup.js`: ```yaml runs: using: 'node24' pre: 'setup.js' main: 'index.js' post: 'cleanup.js' ``` ### `runs.pre-if` \*\*Optional\*\* Allows you to define conditions for the `pre:` action execution. The `pre:` action will only run if the conditions in `pre-if` are met. If not set, then `pre-if` defaults to `always()`. In `pre-if`, status check functions evaluate against the job's status, not the action's own status. Note that the `step` context is unavailable, as no steps have run yet. In this example, `cleanup.js` only runs on Linux-based runners: ```yaml pre: 'cleanup.js' pre-if: runner.os == 'linux' ``` ### `runs.post` \*\*Optional\*\* Allows you to run a script at the end of a job, once the `main:` action has completed. For example, you can use `post:` to terminate certain processes or remove unneeded files. The runtime specified with the [`using`](#runsusing-for-javascript-actions) syntax will execute this file. In this example, the `post:` action runs a script called `cleanup.js`: ```yaml runs: using: 'node24' main: 'index.js' post: 'cleanup.js' ``` The `post:` action always runs by default but you can override this using `post-if`. ### `runs.post-if` \*\*Optional\*\* Allows you to define conditions for the `post:` action execution. The `post:` action will only run if | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/metadata-syntax.md | main | github-actions | [
-0.021587088704109192,
0.003530851099640131,
-0.05664743483066559,
0.014906219206750393,
-0.017666466534137726,
0.014656956307590008,
0.033633265644311905,
0.004071040078997612,
0.05752978473901749,
-0.02097780629992485,
-0.04870759695768356,
-0.06566621363162994,
0.054602738469839096,
-0.... | 0.122205 |
`post:` action runs a script called `cleanup.js`: ```yaml runs: using: 'node24' main: 'index.js' post: 'cleanup.js' ``` The `post:` action always runs by default but you can override this using `post-if`. ### `runs.post-if` \*\*Optional\*\* Allows you to define conditions for the `post:` action execution. The `post:` action will only run if the conditions in `post-if` are met. If not set, then `post-if` defaults to `always()`. In `post-if`, status check functions evaluate against the job's status, not the action's own status. For example, this `cleanup.js` will only run on Linux-based runners: ```yaml post: 'cleanup.js' post-if: runner.os == 'linux' ``` ## `runs` for composite actions \*\*Required\*\* Configures the path to the composite action. ### `runs.using` for composite actions \*\*Required\*\* You must set this value to `'composite'`. ### `runs.steps` \*\*Required\*\* The steps that you plan to run in this action. These can be either `run` steps or `uses` steps. #### `runs.steps[\*].run` \*\*Optional\*\* The command you want to run. This can be inline or a script in your action repository: {% raw %} ```yaml runs: using: "composite" steps: - run: ${{ github.action\_path }}/test/script.sh shell: bash ``` {% endraw %} Alternatively, you can use `$GITHUB\_ACTION\_PATH`: ```yaml runs: using: "composite" steps: - run: $GITHUB\_ACTION\_PATH/script.sh shell: bash ``` For more information, see [AUTOTITLE](/actions/learn-github-actions/contexts#github-context). #### `runs.steps[\*].shell` \*\*Optional\*\* The shell where you want to run the command. You can use any of the shells listed in [AUTOTITLE](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idstepsshell). Required if `run` is set. #### `runs.steps[\*].if` \*\*Optional\*\* You can use the `if` conditional to prevent a step from running unless a condition is met. You can use any supported context and expression to create a conditional. {% data reusables.actions.expression-syntax-if %} For more information, see [AUTOTITLE](/actions/learn-github-actions/expressions). \*\*Example: Using contexts\*\* This step only runs when the event type is a `pull\_request` and the event action is `unassigned`. ```yaml steps: - run: echo This event is a pull request that had an assignee removed. if: {% raw %}${{ github.event\_name == 'pull\_request' && github.event.action == 'unassigned' }}{% endraw %} ``` \*\*Example: Using status check functions\*\* The `my backup step` only runs when the previous step of a composite action fails. For more information, see [AUTOTITLE](/actions/learn-github-actions/expressions#status-check-functions). ```yaml steps: - name: My first step uses: octo-org/action-name@main - name: My backup step if: {% raw %}${{ failure() }}{% endraw %} uses: actions/heroku@1.0.0 ``` #### `runs.steps[\*].name` \*\*Optional\*\* The name of the composite step. #### `runs.steps[\*].id` \*\*Optional\*\* A unique identifier for the step. You can use the `id` to reference the step in contexts. For more information, see [AUTOTITLE](/actions/learn-github-actions/contexts). #### `runs.steps[\*].env` \*\*Optional\*\* Sets a `map` of environment variables for only that step. If you want to modify the environment variable stored in the workflow, use `echo "{name}={value}" >> $GITHUB\_ENV` in a composite step. #### `runs.steps[\*].working-directory` \*\*Optional\*\* Specifies the working directory where the command is run. #### `runs.steps[\*].uses` \*\*Optional\*\* Selects an action to run as part of a step in your job. An action is a reusable unit of code. You can use an action defined in the same repository as the workflow, a public repository, or in a [published Docker container image](https://hub.docker.com/). We strongly recommend that you include the version of the action you are using by specifying a Git ref, SHA, or Docker tag number. If you don't specify a version, it could break your workflows or cause unexpected behavior when the action owner publishes an update. \* Using the commit SHA of a released action version is the safest for stability and security. \* Using the specific major action version allows you to receive critical fixes and security patches while still maintaining compatibility. It also assures that your workflow should still work. \* Using the default branch of an | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/metadata-syntax.md | main | github-actions | [
-0.039420366287231445,
0.010347113944590092,
0.01786312274634838,
0.006075813435018063,
0.04595291242003441,
-0.08290338516235352,
-0.046708445996046066,
-0.05628326162695885,
0.053564224392175674,
0.07638377696275711,
0.005250949412584305,
0.0860290676355362,
-0.047054216265678406,
0.0100... | 0.1024 |
commit SHA of a released action version is the safest for stability and security. \* Using the specific major action version allows you to receive critical fixes and security patches while still maintaining compatibility. It also assures that your workflow should still work. \* Using the default branch of an action may be convenient, but if someone releases a new major version with a breaking change, your workflow could break. Some actions require inputs that you must set using the [`with`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idstepswith) keyword. Review the action's README file to determine the inputs required. ```yaml runs: using: "composite" steps: # Reference a specific commit - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # Reference the major version of a release - uses: {% data reusables.actions.action-checkout %} # Reference a specific version - uses: {% data reusables.actions.action-checkout %}.2.0 # Reference a branch - uses: actions/checkout@main # References a subdirectory in a public GitHub repository at a specific branch, ref, or SHA - uses: actions/aws/ec2@main # References a local action - uses: ./.github/actions/my-action # References a docker public registry action - uses: docker://gcr.io/cloud-builders/gradle # Reference a docker image published on docker hub - uses: docker://alpine:3.8 ``` #### `runs.steps[\*].with` \*\*Optional\*\* A `map` of the input parameters defined by the action. Each input parameter is a key/value pair. For more information, see [Example: Specifying inputs](#example-specifying-inputs). ```yaml runs: using: "composite" steps: - name: My first step uses: actions/hello\_world@main with: first\_name: Mona middle\_name: The last\_name: Octocat ``` #### `runs.steps[\*].continue-on-error` \*\*Optional\*\* Prevents the action from failing when a step fails. Set to `true` to allow the action to pass when this step fails. ## `runs` for Docker container actions \*\*Required\*\* Configures the image used for the Docker container action. ### Example: Using a Dockerfile in your repository ```yaml runs: using: 'docker' image: 'Dockerfile' ``` ### Example: Using public Docker registry container ```yaml runs: using: 'docker' image: 'docker://debian:stretch-slim' ``` ### `runs.using` for Docker container actions \*\*Required\*\* You must set this value to `'docker'`. ### `runs.pre-entrypoint` \*\*Optional\*\* Allows you to run a script before the `entrypoint` action begins. For example, you can use `pre-entrypoint:` to run a prerequisite setup script. {% data variables.product.prodname\_actions %} uses `docker run` to launch this action, and runs the script inside a new container that uses the same base image. This means that the runtime state is different from the main `entrypoint` container, and any states you require must be accessed in either the workspace, `HOME`, or as a `STATE\_` variable. The `pre-entrypoint:` action always runs by default but you can override this using [`runs.pre-if`](#runspre-if). The runtime specified with the [`using`](#runsusing-for-docker-container-actions) syntax will execute this file. In this example, the `pre-entrypoint:` action runs a script called `setup.sh`: ```yaml runs: using: 'docker' image: 'Dockerfile' args: - 'bzz' pre-entrypoint: 'setup.sh' entrypoint: 'main.sh' ``` ### `runs.image` \*\*Required\*\* The Docker image to use as the container to run the action. The value can be the Docker base image name, a local `Dockerfile` in your repository, or a public image in Docker Hub or another registry. To reference a `Dockerfile` local to your repository, the file must be named `Dockerfile` and you must use a path relative to your action metadata file. The `docker` application will execute this file. ### `runs.env` \*\*Optional\*\* Specifies a key/value map of environment variables to set in the container environment. ### `runs.entrypoint` \*\*Optional\*\* Overrides the Docker `ENTRYPOINT` in the `Dockerfile`, or sets it if one wasn't already specified. Use `entrypoint` when the `Dockerfile` does not specify an `ENTRYPOINT` or you want to override the `ENTRYPOINT` instruction. If you omit `entrypoint`, the commands you specify in the Docker `ENTRYPOINT` instruction will execute. The Docker `ENTRYPOINT` instruction has a \_shell\_ form and \_exec\_ | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/metadata-syntax.md | main | github-actions | [
-0.00047651768545620143,
-0.03522266820073128,
-0.013173609040677547,
-0.04954592511057854,
0.03248060122132301,
0.042714688926935196,
-0.04507357254624367,
-0.06685956567525864,
0.05658108368515968,
0.041258104145526886,
0.03705501928925514,
0.08945059776306152,
-0.025718828663229942,
-0.... | 0.05033 |
sets it if one wasn't already specified. Use `entrypoint` when the `Dockerfile` does not specify an `ENTRYPOINT` or you want to override the `ENTRYPOINT` instruction. If you omit `entrypoint`, the commands you specify in the Docker `ENTRYPOINT` instruction will execute. The Docker `ENTRYPOINT` instruction has a \_shell\_ form and \_exec\_ form. The Docker `ENTRYPOINT` documentation recommends using the \_exec\_ form of the `ENTRYPOINT` instruction. For more information about how the `entrypoint` executes, see [AUTOTITLE](/actions/creating-actions/dockerfile-support-for-github-actions#entrypoint). ### `runs.post-entrypoint` \*\*Optional\*\* Allows you to run a cleanup script once the `runs.entrypoint` action has completed. {% data variables.product.prodname\_actions %} uses `docker run` to launch this action. Because {% data variables.product.prodname\_actions %} runs the script inside a new container using the same base image, the runtime state is different from the main `entrypoint` container. You can access any state you need in either the workspace, `HOME`, or as a `STATE\_` variable. The `post-entrypoint:` action always runs by default but you can override this using [`runs.post-if`](#runspost-if). ```yaml runs: using: 'docker' image: 'Dockerfile' args: - 'bzz' entrypoint: 'main.sh' post-entrypoint: 'cleanup.sh' ``` ### `runs.args` \*\*Optional\*\* An array of strings that define the inputs for a Docker container. Inputs can include hardcoded strings. {% data variables.product.prodname\_dotcom %} passes the `args` to the container's `ENTRYPOINT` when the container starts up. The `args` are used in place of the `CMD` instruction in a `Dockerfile`. If you use `CMD` in your `Dockerfile`, use the guidelines ordered by preference: {% data reusables.actions.dockerfile-guidelines %} If you need to pass environment variables into an action, make sure your action runs a command shell to perform variable substitution. For example, if your `entrypoint` attribute is set to `"sh -c"`, `args` will be run in a command shell. Alternatively, if your `Dockerfile` uses an `ENTRYPOINT` to run the same command (`"sh -c"`), `args` will execute in a command shell. For more information about using the `CMD` instruction with {% data variables.product.prodname\_actions %}, see [AUTOTITLE](/actions/creating-actions/dockerfile-support-for-github-actions#cmd). #### Example: Defining arguments for the Docker container {% raw %} ```yaml runs: using: 'docker' image: 'Dockerfile' args: - ${{ inputs.greeting }} - 'foo' - 'bar' ``` {% endraw %} ## `branding` \*\*Optional\*\* You can use a color and [Feather](https://feathericons.com/) icon to create a badge to personalize and distinguish your action. Badges are shown next to your action name in [{% data variables.product.prodname\_marketplace %}](https://github.com/marketplace?type=actions). ### Example: Configuring branding for an action ```yaml branding: icon: 'award' color: 'green' ``` ### `branding.color` The background color of the badge. Can be one of: `white`, `black`, `yellow`, `blue`, `green`, `orange`, `red`, `purple`, or `gray-dark`. ### `branding.icon` The name of the v4.28.0 [Feather](https://feathericons.com/) icon to use. #### Omitted icons Brand icons, and all the following icons, are omitted. * coffee * columns * divide-circle * divide-square * divide * frown * hexagon * key * meh * mouse-pointer * smile * tool * x-octagon #### Exhaustive list of all currently supported icons * activity * airplay * alert-circle * alert-octagon * alert-triangle * align-center * align-justify * align-left * align-right * anchor * aperture * archive * arrow-down-circle * arrow-down-left * arrow-down-right * arrow-down * arrow-left-circle * arrow-left * arrow-right-circle * arrow-right * arrow-up-circle * arrow-up-left * arrow-up-right * arrow-up * at-sign * award * bar-chart-2 * bar-chart * battery-charging * battery * bell-off * bell * bluetooth * bold * book-open * book * bookmark * box * briefcase * calendar * camera-off * camera * cast * check-circle * check-square * check * chevron-down * chevron-left * chevron-right * chevron-up * chevrons-down * chevrons-left * chevrons-right * chevrons-up * circle * clipboard * clock * cloud-drizzle * cloud-lightning * cloud-off * cloud-rain * cloud-snow * cloud * | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/metadata-syntax.md | main | github-actions | [
-0.006803448777645826,
0.021119961515069008,
-0.04672113433480263,
-0.011542168445885181,
-0.0252423956990242,
-0.013832099735736847,
0.061261340975761414,
0.051108218729496,
0.02222798764705658,
0.03437613695859909,
-0.03311388939619064,
-0.0007485483656637371,
0.06473058462142944,
-0.041... | 0.067811 |
briefcase * calendar * camera-off * camera * cast * check-circle * check-square * check * chevron-down * chevron-left * chevron-right * chevron-up * chevrons-down * chevrons-left * chevrons-right * chevrons-up * circle * clipboard * clock * cloud-drizzle * cloud-lightning * cloud-off * cloud-rain * cloud-snow * cloud * code * command * compass * copy * corner-down-left * corner-down-right * corner-left-down * corner-left-up * corner-right-down * corner-right-up * corner-up-left * corner-up-right * cpu * credit-card * crop * crosshair * database * delete * disc * dollar-sign * download-cloud * download * droplet * edit-2 * edit-3 * edit * external-link * eye-off * eye * fast-forward * feather * file-minus * file-plus * file-text * file * film * filter * flag * folder-minus * folder-plus * folder * gift * git-branch * git-commit * git-merge * git-pull-request * globe * grid * hard-drive * hash * headphones * heart * help-circle * home * image * inbox * info * italic * layers * layout * life-buoy * link-2 * link * list * loader * lock * log-in * log-out * mail * map-pin * map * maximize-2 * maximize * menu * message-circle * message-square * mic-off * mic * minimize-2 * minimize * minus-circle * minus-square * minus * monitor * moon * more-horizontal * more-vertical * move * music * navigation-2 * navigation * octagon * package * paperclip * pause-circle * pause * percent * phone-call * phone-forwarded * phone-incoming * phone-missed * phone-off * phone-outgoing * phone * pie-chart * play-circle * play * plus-circle * plus-square * plus * pocket * power * printer * radio * refresh-ccw * refresh-cw * repeat * rewind * rotate-ccw * rotate-cw * rss * save * scissors * search * send * server * settings * share-2 * share * shield-off * shield * shopping-bag * shopping-cart * shuffle * sidebar * skip-back * skip-forward * slash * sliders * smartphone * speaker * square * star * stop-circle * sun * sunrise * sunset * table * tablet * tag * target * terminal * thermometer * thumbs-down * thumbs-up * toggle-left * toggle-right * trash-2 * trash * trending-down * trending-up * triangle * truck * tv * type * umbrella * underline * unlock * upload-cloud * upload * user-check * user-minus * user-plus * user-x * user * users * video-off * video * voicemail * volume-1 * volume-2 * volume-x * volume * watch * wifi-off * wifi * wind * x-circle * x-square * x * zap-off * zap * zoom-in * zoom-out {% ifversion fpt or ghec %} ## Changing the metadata file name While the actions metadata file supports both YAML formats, changing the metadata file name (from `action.yml` to `action.yaml` or vice versa) between releases will affect previous release versions that have been published to {% data variables.product.prodname\_marketplace %}. Changing the file name will hide all release versions associated with the previous file name from {% data variables.product.prodname\_marketplace %}. Previous release versions will still be accessible to users through the source repository. When releasing new versions of actions, only versions released after the metadata file name change will have the {% data variables.product.prodname\_marketplace %} tag and will show up on {% data variables.product.prodname\_marketplace %} {% endif %} | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/metadata-syntax.md | main | github-actions | [
-0.015758896246552467,
0.007449882570654154,
-0.021518858149647713,
0.0006376145174726844,
0.09898415952920914,
0.03457249701023102,
0.07033958286046982,
-0.01995680294930935,
-0.005071697290986776,
0.037132296711206436,
0.02340289019048214,
0.02424558252096176,
0.04065673053264618,
-0.022... | 0.105531 |
%} {% endif %} | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/metadata-syntax.md | main | github-actions | [
0.07199739664793015,
0.10648374259471893,
-0.027777597308158875,
0.019711632281541824,
0.055391356348991394,
0.029465099796652794,
0.03413700312376022,
0.06406694650650024,
0.0005953488289378583,
0.022352486848831177,
0.09547363221645355,
-0.04361147806048393,
-0.010353559628129005,
0.0588... | 0.165722 |
## Deployment protection rules Deployment protection rules require specific conditions to pass before a job referencing the environment can proceed. You can use deployment protection rules to require a manual approval, delay a job, or restrict the environment to certain branches. You can also create and implement custom protection rules powered by {% data variables.product.prodname\_github\_apps %} to use third-party systems to control deployments referencing environments configured on {% data variables.product.github %}. Third-party systems can be observability systems, change management systems, code quality systems, or other manual configurations that you use to assess readiness before deployments are safely rolled out to environments. {% data reusables.actions.custom-deployment-protection-rules-limits %} ### Required reviewers Use required reviewers to require a specific person or team to approve workflow jobs that reference the environment. You can list up to six users or teams as reviewers. The reviewers must have at least read access to the repository. Only one of the required reviewers needs to approve the job for it to proceed. You also have the option to prevent self-reviews for deployments to protected environments. If you enable this setting, users who initiate a deployment cannot approve the deployment job, even if they are a required reviewer. This ensures that deployments to protected environments are always reviewed by more than one person. For more information on reviewing jobs that reference an environment with required reviewers, see [AUTOTITLE](/actions/managing-workflow-runs/reviewing-deployments). {% ifversion fpt %} > [!NOTE] > If you are on a {% data variables.product.prodname\_free\_user %}, {% data variables.product.prodname\_pro %}, or {% data variables.product.prodname\_team %} plan, required reviewers are only available for public repositories. {% endif %} ### Wait timer Use a wait timer to delay a job for a specific amount of time after the job is initially triggered. The time (in minutes) must be an integer between 1 and 43,200 (30 days). Wait time will not count towards your billable time. {% ifversion fpt %} > [!NOTE] > If you are on a {% data variables.product.prodname\_free\_user %}, {% data variables.product.prodname\_pro %}, or {% data variables.product.prodname\_team %} plan, wait timers are only available for public repositories. {% endif %} ### Deployment branches and tags Use deployment branches and tags to restrict which branches and tags can deploy to the environment. Below are the options for deployment branches and tags for an environment: \* \*\*No restriction:\*\* No restriction on which branch or tag can deploy to the environment. \* \*\*Protected branches only:\*\* Only branches with branch protection rules enabled can deploy to the environment. If no branch protection rules are defined for any branch in the repository, then all branches can deploy. For more information about branch protection rules, see [AUTOTITLE](/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/about-protected-branches). > [!NOTE] > Deployment workflow runs triggered by tags with the same name as a protected branch and forks with branches that match the protected branch name cannot deploy to the environment. \* \*\*Selected branches and tags:\*\* Only branches and tags that match your specified name patterns can deploy to the environment. The deployment branch or tag rule is matched against the `GITHUB\_REF` of the workflow run. For values of `GITHUB\_REF` for each workflow trigger, see [AUTOTITLE](/actions/using-workflows/events-that-trigger-workflows). If you specify `releases/\*` as a deployment branch or tag rule, only a `GITHUB\_REF` whose name begins with `releases/` can deploy to the environment. Adding another branch rule for `refs/pull/\*/merge` would also allow workflows triggered by `pull\_request` events to deploy to the environment. Wildcard characters will not match `/`, to match branches or tags that begin with `release/` and contain an additional single slash, use `release/\*/\*`. For more information about syntax options for deployment branches, see the [Ruby `File.fnmatch` documentation](https://ruby-doc.org/core-2.5.1/File.html#method-c-fnmatch). {% data reusables.actions.branch-and-tag-deployment-rules-configuration %} | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/deployments-and-environments.md | main | github-actions | [
-0.02600252442061901,
-0.02759047970175743,
-0.051964737474918365,
-0.026514625176787376,
0.0651824027299881,
-0.015935733914375305,
0.03802270442247391,
0.02526894584298134,
-0.04195592179894447,
0.0740945041179657,
0.012987182475626469,
-0.03829684481024742,
0.08008085936307907,
0.000351... | 0.126224 |
triggered by `pull\_request` events to deploy to the environment. Wildcard characters will not match `/`, to match branches or tags that begin with `release/` and contain an additional single slash, use `release/\*/\*`. For more information about syntax options for deployment branches, see the [Ruby `File.fnmatch` documentation](https://ruby-doc.org/core-2.5.1/File.html#method-c-fnmatch). {% data reusables.actions.branch-and-tag-deployment-rules-configuration %} {% ifversion fpt %} > [!NOTE] > Deployment branches and tags are available for all public repositories. For users on {% data variables.product.prodname\_pro %} or {% data variables.product.prodname\_team %} plans, deployment branches and tags are also available for private repositories. {% endif %} ### Allow administrators to bypass configured protection rules By default, administrators can bypass the protection rules and force deployments to specific environments. For more information, see [AUTOTITLE](/actions/managing-workflow-runs/reviewing-deployments#bypassing-environment-protection-rules). Alternatively, you can configure environments to disallow bypassing the protection rules for all deployments to the environment. {% ifversion fpt %} > [!NOTE] > Allowing administrators to bypass protection rules is only available for public repositories for users on {% data variables.product.prodname\_free\_user %}, {% data variables.product.prodname\_pro %}, and {% data variables.product.prodname\_team %} plans. {% endif %} ### Custom deployment protection rules {% data reusables.actions.custom-deployment-protection-rules-beta-note %} {% data reusables.actions.about-custom-deployment-protection-rules %} For more information, see [AUTOTITLE](/actions/deployment/protecting-deployments/creating-custom-deployment-protection-rules). Once custom deployment protection rules have been created and installed on a repository, you can enable the custom deployment protection rule for any environment in the repository. For more information about configuring and enabling custom deployment protection rules, see [AUTOTITLE](/actions/deployment/protecting-deployments/configuring-custom-deployment-protection-rules). {% ifversion fpt %} > [!NOTE] > Custom deployment protection rules are only available for public repositories for users on {% data variables.product.prodname\_free\_user %}, {% data variables.product.prodname\_pro %}, and {% data variables.product.prodname\_team %} plans. {% endif %} ## Environment secrets Secrets stored in an environment are only available to workflow jobs that reference the environment. If the environment requires approval, a job cannot access environment secrets until one of the required reviewers approves it. For more information about secrets, see [AUTOTITLE](/actions/security-for-github-actions/security-guides/about-secrets). {% ifversion fpt %} > [!NOTE] > \* Workflows that run on self-hosted runners are not run in an isolated container, even if they use environments. Environment secrets should be treated with the same level of security as repository and organization secrets. For more information, see [AUTOTITLE](/actions/security-guides/security-hardening-for-github-actions#hardening-for-self-hosted-runners). > \* If you are using {% data variables.product.prodname\_free\_user %}, environment secrets are only available in public repositories. For access to environment secrets in private or internal repositories, you must use {% data variables.product.prodname\_pro %}, {% data variables.product.prodname\_team %}, or {% data variables.product.prodname\_enterprise %}. For more information on switching your plan, see [AUTOTITLE](/billing/managing-the-plan-for-your-github-account/upgrading-your-accounts-plan). {% else %} > [!NOTE] > Workflows that run on self-hosted runners are not run in an isolated container, even if they use environments. Environment secrets should be treated with the same level of security as repository and organization secrets. For more information, see [AUTOTITLE](/actions/security-guides/security-hardening-for-github-actions#hardening-for-self-hosted-runners). {% endif %} ## Environment variables Variables stored in an environment are only available to workflow jobs that reference the environment. These variables are only accessible using the [`vars`](/actions/learn-github-actions/contexts#vars-context) context. For more information, see [AUTOTITLE](/actions/learn-github-actions/variables). {% ifversion fpt %} > [!NOTE] > Environment variables are available for all public repositories. For users on {% data variables.product.prodname\_pro %} or {% data variables.product.prodname\_team %} plans, environment variables are also available for private repositories. {% endif %} | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/deployments-and-environments.md | main | github-actions | [
0.012573705986142159,
-0.02190639078617096,
-0.00020508430316112936,
-0.02166554145514965,
0.06010749936103821,
-0.016450852155685425,
0.02003924362361431,
0.08006279915571213,
-0.0520663745701313,
0.05342401564121246,
0.05115261301398277,
-0.006050164811313152,
-0.01109418272972107,
0.029... | 0.03496 |
When canceling a workflow run, you may be running other software that uses resources related to the workflow run. To help you free up resources related to the workflow run, it may help to understand the steps {% data variables.product.prodname\_dotcom %} performs to cancel a workflow run. 1. To cancel the workflow run, the server re-evaluates `if` conditions for all currently running jobs. If the condition evaluates to `true`, the job will not get canceled. For example, the condition `if: always()` would evaluate to true and the job continues to run. When there is no condition, that is the equivalent of the condition `if: success()`, which only runs if the previous step finished successfully. 1. For jobs that need to be canceled, the server sends a cancellation message to all the runner machines with jobs that need to be canceled. 1. For jobs that continue to run, the server re-evaluates `if` conditions for the unfinished steps. If the condition evaluates to `true`, the step continues to run. You can use the `cancelled` expression to apply a status check of `cancelled()`. For more information, see [AUTOTITLE](/actions/reference/evaluate-expressions-in-workflows-and-actions#cancelled). 1. For steps that need to be canceled, the runner machine sends `SIGINT/Ctrl-C` to the step's entry process (`node` for JavaScript actions, `docker` for container actions, and `bash/cmd/pwd` when using `run` in a step). If the process doesn't exit within 7500 ms, the runner will send `SIGTERM/Ctrl-Break` to the process, then wait for 2500 ms for the process to exit. If the process is still running, the runner kills the process tree. 1. After the 5 minute cancellation timeout period, the server will forcibly terminate all jobs and steps that are still running. | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/workflow-cancellation.md | main | github-actions | [
-0.05773939937353134,
0.01667679473757744,
0.004123582970350981,
-0.004295999649912119,
0.04403643310070038,
-0.06616640090942383,
0.05606449395418167,
-0.03840647637844086,
0.03614770621061325,
0.020804649218916893,
0.011220095679163933,
0.0558193102478981,
-0.007957491092383862,
-0.09787... | 0.156614 |
## `cache` action usage The [`cache` action](https://github.com/actions/cache) will attempt the following sequence when restoring a cache: 1. First, it searches for an exact match to your provided `key`. 1. If no exact match is found, it will search for partial matches of the `key`. 1. If there is still no match found, and you've provided `restore-keys`, these keys will be checked sequentially for partial matches. For more information, see [Cache key matching](#cache-key-matching). If there is an exact match to the provided `key`, this is considered a cache hit. If no cache exactly matches the provided `key`, this is considered a cache miss. On a cache miss, the action automatically creates a new cache if the job completes successfully. The new cache will use the `key` you provided and contains the files you specify in `path`. For more information about how this is handled, see [Cache hits and misses](#cache-hits-and-misses). You cannot change the contents of an existing cache. Instead, you can create a new cache with a new key. ### Input parameters for the `cache` action \* `key`: \*\*Required\*\* The key created when saving a cache and the key used to search for a cache. It can be any combination of variables, context values, static strings, and functions. Keys have a maximum length of 512 characters, and keys longer than the maximum length will cause the action to fail. \* `path`: \*\*Required\*\* The path(s) on the runner to cache or restore. \* You can specify a single path, or you can add multiple paths on separate lines. For example: ```yaml - name: Cache Gradle packages uses: {% data reusables.actions.action-cache %} with: path: | ~/.gradle/caches ~/.gradle/wrapper ``` \* You can specify either directories or single files, and glob patterns are supported. \* You can specify absolute paths, or paths relative to the workspace directory. \* `restore-keys`: \*\*Optional\*\* A string containing alternative restore keys, with each restore key placed on a new line. If no cache hit occurs for `key`, these restore keys are used sequentially in the order provided to find and restore a cache. For example: {% raw %} ```yaml restore-keys: | npm-feature-${{ hashFiles('package-lock.json') }} npm-feature- npm- ``` {% endraw %} \* `enableCrossOsArchive`: \*\*Optional\*\* A boolean value that when enabled, allows Windows runners to save or restore caches independent of the operating system the cache was created on. If this parameter is not set, it defaults to `false`. For more information, see [Cross OS cache](https://github.com/actions/cache/blob/main/tips-and-workarounds.md#cross-os-cache) in the Actions Cache documentation. > [!NOTE] > We recommend that you don't store any sensitive information, such as access tokens or login credentials, in files in the cache path. Anyone with read access can create a pull request on a repository and access the contents of a cache. Additionally, forks of a repository can create pull requests on the base branch and access caches on the base branch. ### Output parameters for the `cache` action \* `cache-hit`: A boolean value to indicate an exact match was found for the key. ### Cache hits and misses When `key` exactly matches an existing cache, it's called a \_cache hit\_, and the action restores the cached files to the `path` directory. When `key` doesn't match an existing cache, it's called a \_cache miss\_, and a new cache is automatically created if the job completes successfully. When a cache miss occurs, the action also searches your specified `restore-keys` for any matches: 1. If you provide `restore-keys`, the `cache` action sequentially searches for any caches that match the list of `restore-keys`. \* When there is an exact match, the action restores the files in the cache to the `path` directory. | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/dependency-caching.md | main | github-actions | [
-0.0556306391954422,
-0.027830136939883232,
0.023704053834080696,
0.0509641095995903,
0.0002936602395493537,
-0.10176198184490204,
0.055659402161836624,
-0.08071991801261902,
0.07511619478464127,
0.019283847883343697,
0.037428151816129684,
0.10040832310914993,
0.005452018231153488,
-0.1064... | 0.054584 |
miss occurs, the action also searches your specified `restore-keys` for any matches: 1. If you provide `restore-keys`, the `cache` action sequentially searches for any caches that match the list of `restore-keys`. \* When there is an exact match, the action restores the files in the cache to the `path` directory. \* If there are no exact matches, the action searches for partial matches of the restore keys. When the action finds a partial match, the most recent cache is restored to the `path` directory. 1. The `cache` action completes and the next step in the job runs. 1. If the job completes successfully, the action automatically creates a new cache with the contents of the `path` directory. For a more detailed explanation of the cache matching process, see [Cache key matching](#cache-key-matching). ### Example using the `cache` action This example creates a new cache when the packages in `package-lock.json` file change, or when the runner's operating system changes. The cache key uses contexts and expressions to generate a key that includes the runner's operating system and a SHA-256 hash of the `package-lock.json` file. ```yaml copy name: Caching with npm on: push jobs: build: runs-on: ubuntu-latest steps: - uses: {% data reusables.actions.action-checkout %} - name: Cache node modules id: cache-npm uses: {% data reusables.actions.action-cache %} env: cache-name: cache-node-modules with: # npm cache files are stored in `~/.npm` on Linux/macOS path: ~/.npm key: {% raw %}${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('\*\*/package-lock.json') }}{% endraw %} restore-keys: | {% raw %}${{ runner.os }}-build-${{ env.cache-name }}-{% endraw %} {% raw %}${{ runner.os }}-build-{% endraw %} {% raw %}${{ runner.os }}-{% endraw %} - if: {% raw %}${{ steps.cache-npm.outputs.cache-hit != 'true' }}{% endraw %} name: List the state of node modules continue-on-error: true run: npm list - name: Install dependencies run: npm install - name: Build run: npm run build - name: Test run: npm test ``` ### Using contexts to create cache keys A cache key can include any of the contexts, functions, literals, and operators supported by {% data variables.product.prodname\_actions %}. For more information, see [AUTOTITLE](/actions/learn-github-actions/contexts) and [AUTOTITLE](/actions/learn-github-actions/expressions). Using expressions to create a `key` allows you to automatically create a new cache when dependencies change. For example, you can create a `key` using an expression that calculates the hash of an npm `package-lock.json` file. So, when the dependencies that make up the `package-lock.json` file change, the cache key changes and a new cache is automatically created. {% raw %} ```yaml npm-${{ hashFiles('package-lock.json') }} ``` {% endraw %} {% data variables.product.prodname\_dotcom %} evaluates the expression `hash "package-lock.json"` to derive the final `key`. ```yaml npm-d5ea0750 ``` ### Using the output of the `cache` action You can use the output of the `cache` action to do something based on whether a cache hit or miss occurred. When an exact match is found for a cache for the specified `key`, the `cache-hit` output is set to `true`. In the example workflow above, there is a step that lists the state of the Node modules if a cache miss occurred: ```yaml - if: {% raw %}${{ steps.cache-npm.outputs.cache-hit != 'true' }}{% endraw %} name: List the state of node modules continue-on-error: true run: npm list ``` ## Cache key matching The `cache` action first searches for cache hits for `key` and the cache \_version\_ in the branch containing the workflow run. If there is no hit, it searches for prefix-matches for `key`, and if there is still no hit, it searches for `restore-keys` and the \_version\_. If there are still no hits in the current branch, the `cache` action retries the same steps on the default branch. Please note that the | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/dependency-caching.md | main | github-actions | [
-0.07849161326885223,
-0.007168891374021769,
0.019857635721564293,
0.048360589891672134,
0.03679104149341583,
-0.050063975155353546,
0.05101308971643448,
-0.0739452913403511,
0.06885844469070435,
-0.000588791910558939,
0.03984517604112625,
0.07908698171377182,
-0.024632573127746582,
-0.111... | 0.081438 |
If there is no hit, it searches for prefix-matches for `key`, and if there is still no hit, it searches for `restore-keys` and the \_version\_. If there are still no hits in the current branch, the `cache` action retries the same steps on the default branch. Please note that the scope restrictions apply during the search. For more information, see [Restrictions for accessing a cache](#restrictions-for-accessing-a-cache). Cache version is a way to stamp a cache with metadata of the `path` and the compression tool used while creating the cache. This ensures that the consuming workflow run uniquely matches a cache it can actually decompress and use. For more information, see [Cache Version](https://github.com/actions/cache#cache-version) in the Actions Cache documentation. `restore-keys` allows you to specify a list of alternate restore keys to use when there is a cache miss on `key`. You can create multiple restore keys ordered from the most specific to least specific. The `cache` action searches the `restore-keys` in sequential order. When a key doesn't match directly, the action searches for keys prefixed with the restore key. If there are multiple partial matches for a restore key, the action returns the most recently created cache. ### Example using multiple restore keys {% raw %} ```yaml restore-keys: | npm-feature-${{ hashFiles('package-lock.json') }} npm-feature- npm- ``` {% endraw %} The runner evaluates the expressions, which resolve to these `restore-keys`: {% raw %} ```yaml restore-keys: | npm-feature-d5ea0750 npm-feature- npm- ``` {% endraw %} The restore key `npm-feature-` matches any key that starts with the string `npm-feature-`. For example, both of the keys `npm-feature-fd3052de` and `npm-feature-a9b253ff` match the restore key. The cache with the most recent creation date would be used. The keys in this example are searched in the following order: 1. \*\*`npm-feature-d5ea0750`\*\* matches a specific hash. 1. \*\*`npm-feature-`\*\* matches cache keys prefixed with `npm-feature-`. 1. \*\*`npm-`\*\* matches any keys prefixed with `npm-`. #### Example of search priority ```yaml key: npm-feature-d5ea0750 restore-keys: | npm-feature- npm- ``` For example, if a pull request contains a `feature` branch and targets the default branch (`main`), the action searches for `key` and `restore-keys` in the following order: 1. Key `npm-feature-d5ea0750` in the `feature` branch 1. Key `npm-feature-` in the `feature` branch 1. Key `npm-` in the `feature` branch 1. Key `npm-feature-d5ea0750` in the `main` branch 1. Key `npm-feature-` in the `main` branch 1. Key `npm-` in the `main` branch ## `setup-\*` actions for specific package managers If you are caching the package managers listed below, using their respective setup-\* actions requires minimal configuration and will create and restore dependency caches for you. | Package managers | setup-\* action for caching | | ------------------- | ------------------------------------------------------------------------------------------------- | | npm, Yarn, pnpm | [setup-node](https://github.com/actions/setup-node#caching-global-packages-data) | | pip, pipenv, Poetry | [setup-python](https://github.com/actions/setup-python#caching-packages-dependencies) | | Gradle, Maven | [setup-java](https://github.com/actions/setup-java#caching-packages-dependencies) | | RubyGems | [setup-ruby](https://github.com/ruby/setup-ruby#caching-bundle-install-automatically) | | Go `go.sum` | [setup-go](https://github.com/actions/setup-go#caching-dependency-files-and-build-outputs) | | .NET NuGet | [setup-dotnet](https://github.com/actions/setup-dotnet?tab=readme-ov-file#caching-nuget-packages) | ## Restrictions for accessing a cache Access restrictions provide cache isolation and security by creating a logical boundary between different branches or tags. Workflow runs can restore caches created in either the current branch or the default branch (usually `main`). If a workflow run is triggered for a pull request, it can also restore caches created in the base branch, including base branches of forked repositories. For example, if the branch `feature-b` has the base branch `feature-a`, a workflow run triggered on a pull request would have access to caches created in the default `main` branch, the base `feature-a` branch, and the current `feature-b` branch. Workflow runs cannot restore caches created for child branches or sibling branches. For example, a cache created for the child `feature-b` | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/dependency-caching.md | main | github-actions | [
-0.01911168172955513,
-0.03202449902892113,
0.045105088502168655,
0.052057329565286636,
0.012035388499498367,
-0.07290325313806534,
-0.0155876399949193,
-0.08841271698474884,
0.05847107991576195,
-0.013285202905535698,
0.017439130693674088,
0.08191683143377304,
-0.020676467567682266,
-0.11... | 0.043229 |
`feature-a`, a workflow run triggered on a pull request would have access to caches created in the default `main` branch, the base `feature-a` branch, and the current `feature-b` branch. Workflow runs cannot restore caches created for child branches or sibling branches. For example, a cache created for the child `feature-b` branch would not be accessible to a workflow run triggered on the parent `main` branch. Similarly, a cache created for the `feature-a` branch with the base `main` would not be accessible to its sibling `feature-c` branch with the base `main`. Workflow runs also cannot restore caches created for different tag names. For example, a cache created for the tag `release-a` with the base `main` would not be accessible to a workflow run triggered for the tag `release-b` with the base `main`. When a cache is created by a workflow run triggered on a pull request, the cache is created for the merge ref (`refs/pull/.../merge`). Because of this, the cache will have a limited scope and can only be restored by re-runs of the pull request. It cannot be restored by the base branch or other pull requests targeting that base branch. Multiple workflow runs in a repository can share caches. A cache created for a branch in a workflow run can be accessed and restored from another workflow run for the same repository and branch. {% ifversion ghes %} > [!NOTE] > As objects are retrieved from or put into the cache directly from runners, Actions runners must have direct connectivity to the Actions object storage configured in {% data variables.product.prodname\_ghe\_server %}, such as AWS S3 or Azure Blob Storage. Self-hosted runners authenticate with the blob storage provider using an access URL provided by the {% data variables.product.prodname\_ghe\_server %} instance. This URL supplies the blob storage provider with valid temporary authentication credentials. This process is initiated by the instance itself, which mediates all requests to the object storage. > > This means that `actions/cache` requires a HTTPS connection to the blob storage in order to work correctly. > > All the metadata are managed by the artifact cache service, which is a microservice within {% data variables.product.prodname\_actions %}. > > For more information on cache storage, see [External storage requirements](/admin/github-actions/getting-started-with-github-actions-for-your-enterprise/getting-started-with-github-actions-for-github-enterprise-server#external-storage-requirements). {% endif %} ## Usage limits and eviction policy {% data variables.product.prodname\_dotcom %} applies limits to cache storage and retention to manage storage costs and prevent abuse. Understanding these limits helps you optimize your cache usage. ### Default limits {% data variables.product.github %} will remove any cache entries that have not been accessed in over 7 days. There is no limit on the number of caches you can store, but the total size of all caches in a repository is limited. By default, the limit is 10 GB per repository, but this limit can be increased by enterprise owners, organization owners, or repository administrators. {% ifversion fpt or ghec %}Any usage beyond 10 GB is billed to your account.{% endif %} {% data reusables.actions.cache-eviction-policy %} {% data reusables.actions.cache-eviction-process %} The cache eviction process may cause cache thrashing, where caches are created and deleted at a high frequency. To reduce this, you can review the caches for a repository and take corrective steps, such as removing caching from specific workflows{% ifversion fpt or ghec %} or increasing your cache size. This functionality is only available to users with a payment method on file who opt in by configuring cache settings{% endif %}. See [AUTOTITLE](/actions/how-tos/managing-workflow-runs-and-deployments/managing-workflow-runs/manage-caches).{% ifversion ghes %} You can also increase the cache size limit for a repository. For more information, see [AUTOTITLE](/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#configuring-cache-storage-for-a-repository). {% endif %} {% ifversion fpt or ghec | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/dependency-caching.md | main | github-actions | [
-0.037635479122400284,
-0.06051617115736008,
-0.021516649052500725,
-0.02929716743528843,
0.011232554912567139,
-0.047295067459344864,
-0.006257450673729181,
-0.020556576550006866,
0.056498438119888306,
-0.01604219153523445,
-0.0011274946155026555,
0.061233311891555786,
-0.00290638767182827,... | 0.036388 |
functionality is only available to users with a payment method on file who opt in by configuring cache settings{% endif %}. See [AUTOTITLE](/actions/how-tos/managing-workflow-runs-and-deployments/managing-workflow-runs/manage-caches).{% ifversion ghes %} You can also increase the cache size limit for a repository. For more information, see [AUTOTITLE](/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#configuring-cache-storage-for-a-repository). {% endif %} {% ifversion fpt or ghec %} You can create cache entries at a rate of up to 200 uploads per minute per repository. If you exceed this rate, subsequent cache upload attempts will fail until the rate limit resets. The time until the rate limit resets is returned in the `Retry-After` header of the response. ### Increasing cache size If you want to reduce the rate at which cache entries are evicted, you can increase the storage limits for your cache in the Actions Settings. Repositories owned by users can configure up to 10 TB per repository. For repositories owned by organizations, the maximum configurable limit is determined by the organization's settings. For organizations owned by an enterprise, the maximum configurable limit is determined by the enterprise's settings. Increasing the limit beyond the default 10 GB will incur additional costs, if that storage is used. For more information, see: \* [AUTOTITLE](/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#configuring-cache-settings-for-your-repository) \* [AUTOTITLE](/organizations/managing-organization-settings/disabling-or-limiting-github-actions-for-your-organization#managing-github-actions-cache-storage-for-your-organization) \* [AUTOTITLE](/admin/enforcing-policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-github-actions-in-your-enterprise#artifact-and-log-retention) {% endif %} ## Next steps To manage your dependency caches, see [AUTOTITLE](/actions/how-tos/managing-workflow-runs-and-deployments/managing-workflow-runs/manage-caches). | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/dependency-caching.md | main | github-actions | [
-0.02359996922314167,
-0.029136763885617256,
-0.04323406144976616,
-0.012002132833003998,
-0.029733408242464066,
-0.053136445581912994,
-0.028011245653033257,
0.03431978076696396,
0.03130404278635979,
0.057921141386032104,
-0.005348409526050091,
0.06874294579029083,
0.004390439949929714,
-... | 0.048638 |
This article lists the supported variables you can use in {% data variables.product.prodname\_actions %} workflows, including environment variables, configuration variables, and default variables provided by {% data variables.product.github %}. Use this reference to look up variable names, naming conventions, limits, and supported contexts when configuring your workflows. For more information about variables, see [AUTOTITLE](/actions/concepts/workflows-and-actions/variables). ## Default environment variables The default environment variables that {% data variables.product.prodname\_dotcom %} sets are available to every step in a workflow. Because default environment variables are set by {% data variables.product.prodname\_dotcom %} and not defined in a workflow, they are not accessible through the `env` context. However, most of the default variables have a corresponding, and similarly named, context property. For example, the value of the `GITHUB\_REF` variable can be read during workflow processing using the {% raw %}`${{ github.ref }}`{% endraw %} context property. {% data reusables.actions.environment-variables-are-fixed %} For more information about setting environment variables, see [AUTOTITLE](/actions/how-tos/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables#defining-environment-variables-for-a-single-workflow) and [AUTOTITLE](/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable). We strongly recommend that actions use variables to access the filesystem rather than using hardcoded file paths. {% data variables.product.prodname\_dotcom %} sets variables for actions to use in all runner environments. | Variable | Description | | ---------|------------ | | `CI` | Always set to `true`. | | `GITHUB\_ACTION` | The name of the action currently running, or the [`id`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idstepsid) of a step. For example, for an action, `\_\_repo-owner\_name-of-action-repo`. {% data variables.product.prodname\_dotcom %} removes special characters, and uses the name `\_\_run` when the current step runs a script without an `id`. If you use the same script or action more than once in the same job, the name will include a suffix that consists of the sequence number preceded by an underscore. For example, the first script you run will have the name `\_\_run`, and the second script will be named `\_\_run\_2`. Similarly, the second invocation of `actions/checkout` will be `actionscheckout2`. | | `GITHUB\_ACTION\_PATH` | The path where an action is located. This property is only supported in composite actions. You can use this path to change directories to where the action is located and access other files in that same repository. For example, `/home/runner/work/\_actions/repo-owner/name-of-action-repo/v1`. | | `GITHUB\_ACTION\_REPOSITORY` | For a step executing an action, this is the owner and repository name of the action. For example, `actions/checkout`. | | `GITHUB\_ACTIONS` | Always set to `true` when {% data variables.product.prodname\_actions %} is running the workflow. You can use this variable to differentiate when tests are being run locally or by {% data variables.product.prodname\_actions %}. | | `GITHUB\_ACTOR` | The name of the person or app that initiated the workflow. For example, `octocat`. | | `GITHUB\_ACTOR\_ID` | {% data reusables.actions.actor\_id-description %} | | `GITHUB\_API\_URL` | Returns the API URL. For example: `{% data variables.product.rest\_url %}`. | | `GITHUB\_BASE\_REF` | The name of the base ref or target branch of the pull request in a workflow run. This is only set when the event that triggers a workflow run is either `pull\_request` or `pull\_request\_target`. For example, `main`. | | `GITHUB\_ENV` | The path on the runner to the file that sets variables from workflow commands. The path to this file is unique to the current step and changes for each step in a job. For example, `/home/runner/work/\_temp/\_runner\_file\_commands/set\_env\_87406d6e-4979-4d42-98e1-3dab1f48b13a`. For more information, see [AUTOTITLE](/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable). | | `GITHUB\_EVENT\_NAME` | The name of the event that triggered the workflow. For example, `workflow\_dispatch`. | | `GITHUB\_EVENT\_PATH` | The path to the file on the runner that contains the full event webhook payload. For example, `/github/workflow/event.json`. | | `GITHUB\_GRAPHQL\_URL` | Returns the GraphQL API URL. For example: `{% data variables.product.graphql\_url %}`. | | `GITHUB\_HEAD\_REF` | The head ref or source branch of the | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/variables.md | main | github-actions | [
-0.022088870406150818,
-0.06220466271042824,
-0.08267935365438461,
-0.00928373634815216,
0.01841229945421219,
0.027091283351182938,
0.09064792096614838,
0.08151192218065262,
-0.033480361104011536,
-0.04991249740123749,
0.003327196929603815,
-0.0071837157011032104,
0.04980996623635292,
-0.0... | 0.096482 |
`workflow\_dispatch`. | | `GITHUB\_EVENT\_PATH` | The path to the file on the runner that contains the full event webhook payload. For example, `/github/workflow/event.json`. | | `GITHUB\_GRAPHQL\_URL` | Returns the GraphQL API URL. For example: `{% data variables.product.graphql\_url %}`. | | `GITHUB\_HEAD\_REF` | The head ref or source branch of the pull request in a workflow run. This property is only set when the event that triggers a workflow run is either `pull\_request` or `pull\_request\_target`. For example, `feature-branch-1`. | | `GITHUB\_JOB` | The [job\_id](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_id) of the current job. For example, `greeting\_job`. | | `GITHUB\_OUTPUT` | The path on the runner to the file that sets the current step's outputs from workflow commands. The path to this file is unique to the current step and changes for each step in a job. For example, `/home/runner/work/\_temp/\_runner\_file\_commands/set\_output\_a50ef383-b063-46d9-9157-57953fc9f3f0`. For more information, see [AUTOTITLE](/actions/using-workflows/workflow-commands-for-github-actions#setting-an-output-parameter). | | `GITHUB\_PATH` | The path on the runner to the file that sets system `PATH` variables from workflow commands. The path to this file is unique to the current step and changes for each step in a job. For example, `/home/runner/work/\_temp/\_runner\_file\_commands/add\_path\_899b9445-ad4a-400c-aa89-249f18632cf5`. For more information, see [AUTOTITLE](/actions/using-workflows/workflow-commands-for-github-actions#adding-a-system-path). | | `GITHUB\_REF` | {% data reusables.actions.ref-description %} | | `GITHUB\_REF\_NAME` | {% data reusables.actions.ref\_name-description %} | | `GITHUB\_REF\_PROTECTED` | {% data reusables.actions.ref\_protected-description %} | | `GITHUB\_REF\_TYPE` | {% data reusables.actions.ref\_type-description %} | | `GITHUB\_REPOSITORY` | The owner and repository name. For example, `octocat/Hello-World`. | | `GITHUB\_REPOSITORY\_ID` | {% data reusables.actions.repository\_id-description %} | | `GITHUB\_REPOSITORY\_OWNER` | The repository owner's name. For example, `octocat`. | | `GITHUB\_REPOSITORY\_OWNER\_ID` | {% data reusables.actions.repository\_owner\_id-description %} | | `GITHUB\_RETENTION\_DAYS` | The number of days that workflow run logs and artifacts are kept. For example, `90`. | | `GITHUB\_RUN\_ATTEMPT` | A unique number for each attempt of a particular workflow run in a repository. This number begins at 1 for the workflow run's first attempt, and increments with each re-run. For example, `3`. | | `GITHUB\_RUN\_ID` | {% data reusables.actions.run\_id\_description %} For example, `1658821493`. | | `GITHUB\_RUN\_NUMBER` | {% data reusables.actions.run\_number\_description %} For example, `3`. | | `GITHUB\_SERVER\_URL`| The URL of the {% data variables.product.github %} server. For example: `https://{% data variables.product.product\_url %}`. | | `GITHUB\_SHA` | {% data reusables.actions.github\_sha\_description %} | | `GITHUB\_STEP\_SUMMARY` | The path on the runner to the file that contains job summaries from workflow commands. The path to this file is unique to the current step and changes for each step in a job. For example, `/home/runner/\_layout/\_work/\_temp/\_runner\_file\_commands/step\_summary\_1cb22d7f-5663-41a8-9ffc-13472605c76c`. For more information, see [AUTOTITLE](/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary). | | `GITHUB\_TRIGGERING\_ACTOR` | {% data reusables.actions.github-triggering-actor-description %} | | `GITHUB\_WORKFLOW` | The name of the workflow. For example, `My test workflow`. If the workflow file doesn't specify a `name`, the value of this variable is the full path of the workflow file in the repository. | | `GITHUB\_WORKFLOW\_REF` | {% data reusables.actions.workflow-ref-description %} | | `GITHUB\_WORKFLOW\_SHA` | {% data reusables.actions.workflow-sha-description %} | | `GITHUB\_WORKSPACE` | The default working directory on the runner for steps, and the default location of your repository when using the [`checkout`](https://github.com/actions/checkout) action. For example, `/home/runner/work/my-repo-name/my-repo-name`. | | `RUNNER\_ARCH` | {% data reusables.actions.runner-arch-description %} | | `RUNNER\_DEBUG` | {% data reusables.actions.runner-debug-description %} | | `RUNNER\_ENVIRONMENT` | {% data reusables.actions.runner-environment-description %} | | `RUNNER\_NAME` | {% data reusables.actions.runner-name-description %} For example, `Hosted Agent` | | `RUNNER\_OS` | {% data reusables.actions.runner-os-description %} For example, `Windows` | | `RUNNER\_TEMP` | {% data reusables.actions.runner-temp-directory-description %} For example, `D:\a\\_temp` | | `RUNNER\_TOOL\_CACHE` | {% data reusables.actions.runner-tool-cache-description %} For example, `C:\hostedtoolcache\windows` | > [!NOTE] > If you need to use a workflow run's URL from within a job, you can combine these variables: `$GITHUB\_SERVER\_URL/$GITHUB\_REPOSITORY/actions/runs/$GITHUB\_RUN\_ID` ## Naming conventions for configuration variables The following rules apply to configuration | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/variables.md | main | github-actions | [
-0.07948504388332367,
0.03106760047376156,
-0.03407374396920204,
0.04458007961511612,
-0.015565205365419388,
-0.05990126356482506,
-0.03254152461886406,
0.013610659167170525,
0.04599239304661751,
-0.0043817246332764626,
-0.03766295686364174,
-0.06389882415533066,
-0.0007905002566985786,
-0... | 0.109001 |
%} For example, `D:\a\\_temp` | | `RUNNER\_TOOL\_CACHE` | {% data reusables.actions.runner-tool-cache-description %} For example, `C:\hostedtoolcache\windows` | > [!NOTE] > If you need to use a workflow run's URL from within a job, you can combine these variables: `$GITHUB\_SERVER\_URL/$GITHUB\_REPOSITORY/actions/runs/$GITHUB\_RUN\_ID` ## Naming conventions for configuration variables The following rules apply to configuration variable names: {% data reusables.actions.actions-secrets-and-variables-naming %} ## Naming conventions for environment variables When you set an environment variable, you cannot use any of the default environment variable names. For a complete list of default environment variables, see [AUTOTITLE](/actions/reference/variables-reference#default-environment-variables) below. If you attempt to override the value of one of these default variables, the assignment is ignored. > [!NOTE] > You can list the entire set of environment variables that are available to a workflow step by using `run: env` in a step and then examining the output for the step. ## Configuration variable precedence If a variable with the same name exists at multiple levels, the variable at the lowest level takes precedence. For example, if an organization-level variable has the same name as a repository-level variable, then the repository-level variable takes precedence. Similarly, if an organization, repository, and environment all have a variable with the same name, the environment-level variable takes precedence. > [!NOTE] > Environment-level variables are only available on the runner after the job starts executing. This means that environment-level variables won't overwrite variables in the `env` and `vars` contexts. For reusable workflows, the variables from the caller workflow's repository are used. Variables from the repository that contains the called workflow are not made available to the caller workflow. ## Limits for configuration variables {% ifversion ghes %} Individual variables are limited to 48 KB in size. You can store up to 1,000 organization variables, 500 variables per repository, and 100 variables per environment. The total combined size limit for organization and repository variables is 10 MB per workflow run. A workflow created in a repository can access the following number of variables: \* Up to 500 repository variables, if the total size of repository variables is less than 10 MB. If the total size of repository variables exceeds 10 MB, only the repository variables that fall below the limit will be available (as sorted alphabetically by variable name). \* Up to 1,000 organization variables, if the total combined size of repository and organization variables is less than 10 MB. If the total combined size of organization and repository variables exceeds 10 MB, only the organization variables that fall below that limit will be available (after accounting for repository variables and as sorted alphabetically by variable name). \* Up to 100 environment-level variables. > [!NOTE] > Environment-level variables do not count toward the 10 MB total size limit. If you exceed the combined size limit for repository and organization variables and still need additional variables, you can use an environment and define additional variables in the environment. {% else %} Individual variables are limited to 48 KB in size. You can store up to 1,000 organization variables, 500 variables per repository, and 100 variables per environment. The total combined size limit for organization and repository variables is 256 KB per workflow run. A workflow created in a repository can access the following number of variables: \* Up to 500 repository variables, if the total size of repository variables is less than 256 KB. If the total size of repository variables exceeds 256 KB, only the repository variables that fall below the limit will be available (as sorted alphabetically by variable name). \* Up to 1,000 organization variables, if the total combined size of repository and organization variables | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/variables.md | main | github-actions | [
0.012597892433404922,
-0.02279430441558361,
-0.05479957163333893,
0.03342539817094803,
-0.052374403923749924,
-0.008729013614356518,
0.01945280097424984,
0.0048157647252082825,
-0.008628303185105324,
-0.0032402235083281994,
-0.05030631273984909,
-0.007643487304449081,
0.022732477635145187,
... | 0.011579 |
variables is less than 256 KB. If the total size of repository variables exceeds 256 KB, only the repository variables that fall below the limit will be available (as sorted alphabetically by variable name). \* Up to 1,000 organization variables, if the total combined size of repository and organization variables is less than 256 KB. If the total combined size of organization and repository variables exceeds 256 KB, only the organization variables that fall below that limit will be available (after accounting for repository variables and as sorted alphabetically by variable name). \* Up to 100 environment-level variables. > [!NOTE] > Environment-level variables do not count toward the 256 KB total size limit. If you exceed the combined size limit for repository and organization variables and still need additional variables, you can use an environment and define additional variables in the environment. {% endif %} ## Supported contexts You will commonly use either the `env` or `github` context to access variable values in parts of the workflow that are processed before jobs are sent to runners. > [!WARNING] Do not print the `github` context to logs. It contains sensitive information. | Context | Use case | Example | | --- | --- | --- | | `env` | Reference custom variables defined in the workflow. | {% raw %}`${{ env.MY\_VARIABLE }}`{% endraw %} | | `github` | Reference information about the workflow run and the event that triggered the run. | {% raw %}`${{ github.repository }}`{% endraw %} | | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/variables.md | main | github-actions | [
0.07161186635494232,
-0.04274945333600044,
-0.07364482432603836,
0.041365984827280045,
-0.014264749363064766,
-0.05545034259557724,
-0.014653800055384636,
0.034878525882959366,
-0.04389195889234543,
0.022079627960920334,
0.0070939925499260426,
0.012619450688362122,
0.07920290529727936,
0.0... | 0.030779 |
## About events that trigger workflows Workflow triggers are events that cause a workflow to run. For more information about how to use workflow triggers, see [AUTOTITLE](/actions/using-workflows/triggering-a-workflow). Some events have multiple activity types. For these events, you can specify which activity types will trigger a workflow run. For more information about what each activity type means, see [AUTOTITLE](/webhooks-and-events/webhooks/webhook-events-and-payloads). > [!NOTE] > Not all webhook events trigger workflows. ## `branch\_protection\_rule` | Webhook event payload | Activity types | `GITHUB\_SHA` | `GITHUB\_REF` | | --------------------- | -------------- | ------------ | -------------| | [`branch\_protection\_rule`](/webhooks-and-events/webhooks/webhook-events-and-payloads#branch\_protection\_rule) | - `created` - `edited` - `deleted` | Last commit on default branch | Default branch | > [!NOTE] > \* {% data reusables.developer-site.multiple\_activity\_types %} For information about each activity type, see [AUTOTITLE](/webhooks-and-events/webhooks/webhook-events-and-payloads#branch\_protection\_rule). {% data reusables.developer-site.limit\_workflow\_to\_activity\_types %} > \* {% data reusables.actions.branch-requirement %} Runs your workflow when branch protection rules in the workflow repository are changed. For more information about branch protection rules, see [AUTOTITLE](/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/about-protected-branches). For information about the branch protection rule APIs, see [AUTOTITLE](/graphql/reference/objects#branchprotectionrule) in the GraphQL API documentation or [AUTOTITLE](/rest/branches). For example, you can run a workflow when a branch protection rule has been `created` or `deleted`: ```yaml on: branch\_protection\_rule: types: [created, deleted] ``` ## `check\_run` | Webhook event payload | Activity types | `GITHUB\_SHA` | `GITHUB\_REF` | | --------------------- | -------------- | ------------ | -------------| | [`check\_run`](/webhooks-and-events/webhooks/webhook-events-and-payloads#check\_run) | - `created` - `rerequested` - `completed` - `requested\_action` | Last commit on default branch | Default branch | > [!NOTE] > \* {% data reusables.developer-site.multiple\_activity\_types %} For information about each activity type, see [AUTOTITLE](/webhooks-and-events/webhooks/webhook-events-and-payloads#check\_run). {% data reusables.developer-site.limit\_workflow\_to\_activity\_types %} > \* {% data reusables.actions.branch-requirement %} > \* To prevent recursive workflows, this event does not trigger workflows if the check run's check suite was created by {% data variables.product.prodname\_actions %} or if the check suite's head SHA is associated with {% data variables.product.prodname\_actions %}. Runs your workflow when activity related to a check run occurs. A check run is an individual test that is part of a check suite. For information, see [AUTOTITLE](/rest/guides/using-the-rest-api-to-interact-with-checks). For information about the check run APIs, see [AUTOTITLE](/graphql/reference/objects#checkrun) in the GraphQL API documentation or [AUTOTITLE](/rest/checks/runs). For example, you can run a workflow when a check run has been `rerequested` or `completed`. ```yaml on: check\_run: types: [rerequested, completed] ``` ## `check\_suite` | Webhook event payload | Activity types | `GITHUB\_SHA` | `GITHUB\_REF` | | --------------------- | -------------- | ------------ | -------------| | [`check\_suite`](/webhooks-and-events/webhooks/webhook-events-and-payloads#check\_suite) | - `completed` | Last commit on default branch | Default branch | > [!NOTE] > \* {% data reusables.developer-site.multiple\_activity\_types %} For information about each activity type, see [AUTOTITLE](/webhooks-and-events/webhooks/webhook-events-and-payloads#check\_suite). Although only the `completed` activity type is supported, specifying the activity type will keep your workflow specific if more activity types are added in the future. {% data reusables.developer-site.limit\_workflow\_to\_activity\_types %} > \* {% data reusables.actions.branch-requirement %} > \* To prevent recursive workflows, this event does not trigger workflows if the check suite was created by {% data variables.product.prodname\_actions %} or if the check suite's head SHA is associated with {% data variables.product.prodname\_actions %}. Runs your workflow when check suite activity occurs. A check suite is a collection of the check runs created for a specific commit. Check suites summarize the status and conclusion of the check runs that are in the suite. For information, see [AUTOTITLE](/rest/guides/using-the-rest-api-to-interact-with-checks). For information about the check suite APIs, see [AUTOTITLE](/graphql/reference/objects#checksuite) in the GraphQL API documentation or [AUTOTITLE](/rest/checks/suites). For example, you can run a workflow when a check suite has been `completed`. ```yaml on: check\_suite: types: [completed] ``` ## `create` | Webhook event payload | Activity types | `GITHUB\_SHA` | `GITHUB\_REF` | | --------------------- | -------------- | ------------ | -------------| | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/events-that-trigger-workflows.md | main | github-actions | [
-0.02857338637113571,
-0.00009583339124219492,
-0.008225705474615097,
-0.04913001134991646,
0.05330877751111984,
-0.02524358592927456,
0.053911495953798294,
-0.036286547780036926,
0.0674586147069931,
-0.0472564771771431,
-0.05391160026192665,
-0.0898146703839302,
0.025372304022312164,
-0.0... | 0.133389 |
[AUTOTITLE](/graphql/reference/objects#checksuite) in the GraphQL API documentation or [AUTOTITLE](/rest/checks/suites). For example, you can run a workflow when a check suite has been `completed`. ```yaml on: check\_suite: types: [completed] ``` ## `create` | Webhook event payload | Activity types | `GITHUB\_SHA` | `GITHUB\_REF` | | --------------------- | -------------- | ------------ | -------------| | [`create`](/webhooks-and-events/webhooks/webhook-events-and-payloads#create) | Not applicable | Last commit on the created branch or tag | Branch or tag created | > [!NOTE] > An event will not be created when you create more than three tags at once. Runs your workflow when someone creates a Git reference (Git branch or tag) in the workflow's repository. For information about the APIs to create a Git reference, see [AUTOTITLE](/graphql/reference/mutations#createref) in the GraphQL API documentation or [AUTOTITLE](/rest/git/refs#create-a-reference). For example, you can run a workflow when the `create` event occurs. ```yaml on: create ``` ## `delete` | Webhook event payload | Activity types | `GITHUB\_SHA` | `GITHUB\_REF` | | --------------------- | -------------- | ------------ | -------------| | [`delete`](/webhooks-and-events/webhooks/webhook-events-and-payloads#delete) | Not applicable | Last commit on default branch | Default branch | > [!NOTE] > \* {% data reusables.actions.branch-requirement %} > \* An event will not be created when you delete more than three tags at once. Runs your workflow when someone deletes a Git reference (Git branch or tag) in the workflow's repository. For information about the APIs to delete a Git reference, see [AUTOTITLE](/graphql/reference/mutations#deleteref) in the GraphQL API documentation or [AUTOTITLE](/rest/git/refs#delete-a-reference). For example, you can run a workflow when the `delete` event occurs. ```yaml on: delete ``` ## `deployment` | Webhook event payload | Activity types | `GITHUB\_SHA` | `GITHUB\_REF` | | --------------------- | -------------- | ------------ | -------------| | [`deployment`](/webhooks-and-events/webhooks/webhook-events-and-payloads#deployment) | Not applicable | Commit to be deployed | Branch or tag to be deployed (empty if created with a commit SHA)| Runs your workflow when someone creates a deployment in the workflow's repository. Deployments created with a commit SHA may not have a Git ref. For information about the APIs to create a deployment, see [AUTOTITLE](/graphql/reference/mutations#createdeployment) in the GraphQL API documentation or [AUTOTITLE](/rest/repos#deployments). For example, you can run a workflow when the `deployment` event occurs. ```yaml on: deployment ``` ## `deployment\_status` | Webhook event payload | Activity types | `GITHUB\_SHA` | `GITHUB\_REF` | | --------------------- | -------------- | ------------ | -------------| | [`deployment\_status`](/webhooks-and-events/webhooks/webhook-events-and-payloads#deployment\_status) | Not applicable | Commit to be deployed | Branch or tag to be deployed (empty if commit)| > [!NOTE] > When a deployment status's state is set to `inactive`, a workflow run will not be triggered. Runs your workflow when a third party provides a deployment status. Deployments created with a commit SHA may not have a Git ref. For information about the APIs to create a deployment status, see [AUTOTITLE](/graphql/reference/mutations#createdeploymentstatus) in the GraphQL API documentation or [AUTOTITLE](/rest/deployments#create-a-deployment-status). For example, you can run a workflow when the `deployment\_status` event occurs. ```yaml on: deployment\_status ``` ## `discussion` | Webhook event payload | Activity types | `GITHUB\_SHA` | `GITHUB\_REF` | | --------------------- | -------------- | ------------ | -------------| | [`discussion`](/webhooks-and-events/webhooks/webhook-events-and-payloads#discussion) | - `created` - `edited` - `deleted` - `transferred` - `pinned` - `unpinned` - `labeled` - `unlabeled` - `locked` - `unlocked` - `category\_changed` - `answered` - `unanswered` | Last commit on default branch | Default branch | > [!NOTE] > \* {% data reusables.developer-site.multiple\_activity\_types %} For information about each activity type, see [AUTOTITLE](/webhooks-and-events/webhooks/webhook-events-and-payloads#discussion). {% data reusables.developer-site.limit\_workflow\_to\_activity\_types %} > \* {% data reusables.actions.branch-requirement %} > \* {% data reusables.webhooks.discussions-webhooks-beta %} Runs your workflow when a discussion in the workflow's repository is created or modified. For activity related to comments on a discussion, use the [`discussion\_comment`](#discussion\_comment) event. For more information about | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/events-that-trigger-workflows.md | main | github-actions | [
-0.06816957145929337,
0.05680391564965248,
-0.037954263389110565,
0.015412640757858753,
0.002858998952433467,
-0.029796231538057327,
0.035594645887613297,
-0.055809374898672104,
0.054917968809604645,
0.06535228341817856,
-0.027295641601085663,
-0.09165745973587036,
0.06330810487270355,
0.0... | 0.057892 |
activity type, see [AUTOTITLE](/webhooks-and-events/webhooks/webhook-events-and-payloads#discussion). {% data reusables.developer-site.limit\_workflow\_to\_activity\_types %} > \* {% data reusables.actions.branch-requirement %} > \* {% data reusables.webhooks.discussions-webhooks-beta %} Runs your workflow when a discussion in the workflow's repository is created or modified. For activity related to comments on a discussion, use the [`discussion\_comment`](#discussion\_comment) event. For more information about discussions, see [AUTOTITLE](/discussions/collaborating-with-your-community-using-discussions/about-discussions). For information about the GraphQL API, see [AUTOTITLE](/graphql/reference/objects#discussion). For example, you can run a workflow when a discussion has been `created`, `edited`, or `answered`. ```yaml on: discussion: types: [created, edited, answered] ``` ## `discussion\_comment` | Webhook event payload | Activity types | `GITHUB\_SHA` | `GITHUB\_REF` | | --------------------- | -------------- | ------------ | -------------| | [`discussion\_comment`](/webhooks-and-events/webhooks/webhook-events-and-payloads#discussion\_comment) | - `created` - `edited` - `deleted` | Last commit on default branch | Default branch | > [!NOTE] > \* {% data reusables.developer-site.multiple\_activity\_types %} For information about each activity type, see [AUTOTITLE](/webhooks-and-events/webhooks/webhook-events-and-payloads#discussion\_comment). {% data reusables.developer-site.limit\_workflow\_to\_activity\_types %} > \* {% data reusables.actions.branch-requirement %} > \* {% data reusables.webhooks.discussions-webhooks-beta %} Runs your workflow when a comment on a discussion in the workflow's repository is created or modified. For activity related to a discussion as opposed to comments on the discussion, use the [`discussion`](#discussion) event. For more information about discussions, see [AUTOTITLE](/discussions/collaborating-with-your-community-using-discussions/about-discussions). For information about the GraphQL API, see [AUTOTITLE](/graphql/reference/objects#discussion). For example, you can run a workflow when a discussion comment has been `created` or `deleted`. ```yaml on: discussion\_comment: types: [created, deleted] ``` ## `fork` | Webhook event payload | Activity types | `GITHUB\_SHA` | `GITHUB\_REF` | | --------------------- | -------------- | ------------ | -------------| | [`fork`](/webhooks-and-events/webhooks/webhook-events-and-payloads#fork) | Not applicable | Last commit on default branch | Default branch | > [!NOTE] > {% data reusables.actions.branch-requirement %} Runs your workflow when someone forks a repository. For information about the REST API, see [AUTOTITLE](/rest/repos/forks#create-a-fork). For example, you can run a workflow when the `fork` event occurs. ```yaml on: fork ``` ## `gollum` | Webhook event payload | Activity types | `GITHUB\_SHA` | `GITHUB\_REF` | | --------------------- | -------------- | ------------ | -------------| | [`gollum`](/webhooks-and-events/webhooks/webhook-events-and-payloads#gollum) | Not applicable | Last commit on default branch | Default branch | > [!NOTE] > {% data reusables.actions.branch-requirement %} Runs your workflow when someone creates or updates a Wiki page. For more information, see [AUTOTITLE](/communities/documenting-your-project-with-wikis/about-wikis). For example, you can run a workflow when the `gollum` event occurs. ```yaml on: gollum ``` ## `image\_version` | Webhook event payload | Activity types | `GITHUB\_SHA` | `GITHUB\_REF` | |----------------------| -------------- | ------------ | -------------| | Not applicable | Not applicable | Last commit on default branch | Default branch | Runs your workflow when a new version of a specified image becomes available for use. This event is typically triggered after a successful image version creation, allowing you to automate actions such as deployment or notifications in response to new image versions. This event supports glob patterns for both image names and versions. The example below triggers when a new image version matches any of the specified name and version combinations. For example, `["MyNewImage", 1.0.0]`, `["MyNewImage", 2.53.0]`, `["MyOtherImage", 1.0.0]`, and `["MyOtherImage", 2.0.0]`. ```yaml on: image\_version: names: - "MyNewImage" - "MyOtherImage" versions: - 1.\* - 2.\* ``` ## `issue\_comment` | Webhook event payload | Activity types | `GITHUB\_SHA` | `GITHUB\_REF` | | --------------------- | -------------- | ------------ | -------------| | [`issue\_comment`](/webhooks-and-events/webhooks/webhook-events-and-payloads#issue\_comment) | - `created` - `edited` - `deleted` | Last commit on default branch | Default branch | > [!NOTE] > \* {% data reusables.developer-site.multiple\_activity\_types %} For information about each activity type, see [AUTOTITLE](/webhooks-and-events/webhooks/webhook-events-and-payloads#issue\_comment). {% data reusables.developer-site.limit\_workflow\_to\_activity\_types %} > \* {% data reusables.actions.branch-requirement %} Runs your workflow when an issue or pull request comment is created, edited, or deleted. For information about the | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/events-that-trigger-workflows.md | main | github-actions | [
-0.10116007179021835,
-0.012494797818362713,
-0.019240140914916992,
0.022579722106456757,
-0.01279322151094675,
-0.03313370794057846,
0.05759333446621895,
-0.027754811570048332,
0.08970454335212708,
0.013396849855780602,
-0.08168952167034149,
-0.05647256597876549,
0.004213264212012291,
0.0... | 0.080876 |
branch | Default branch | > [!NOTE] > \* {% data reusables.developer-site.multiple\_activity\_types %} For information about each activity type, see [AUTOTITLE](/webhooks-and-events/webhooks/webhook-events-and-payloads#issue\_comment). {% data reusables.developer-site.limit\_workflow\_to\_activity\_types %} > \* {% data reusables.actions.branch-requirement %} Runs your workflow when an issue or pull request comment is created, edited, or deleted. For information about the issue comment APIs, see [AUTOTITLE](/graphql/reference/objects#issuecomment) in the GraphQL API documentation or [AUTOTITLE](/webhooks-and-events/webhooks/webhook-events-and-payloads#issue\_comment) in the REST API documentation. For example, you can run a workflow when an issue or pull request comment has been `created` or `deleted`. ```yaml on: issue\_comment: types: [created, deleted] ``` ### `issue\_comment` on issues only or pull requests only The `issue\_comment` event occurs for comments on both issues and pull requests. You can use the `github.event.issue.pull\_request` property in a conditional to take different action depending on whether the triggering object was an issue or pull request. For example, this workflow will run the `pr\_commented` job only if the `issue\_comment` event originated from a pull request. It will run the `issue\_commented` job only if the `issue\_comment` event originated from an issue. ```yaml on: issue\_comment jobs: pr\_commented: # This job only runs for pull request comments name: PR comment if: {% raw %}${{ github.event.issue.pull\_request }}{% endraw %} runs-on: ubuntu-latest steps: - run: | echo A comment on PR $NUMBER env: NUMBER: {% raw %}${{ github.event.issue.number }}{% endraw %} issue\_commented: # This job only runs for issue comments name: Issue comment if: {% raw %}${{ !github.event.issue.pull\_request }}{% endraw %} runs-on: ubuntu-latest steps: - run: | echo A comment on issue $NUMBER env: NUMBER: {% raw %}${{ github.event.issue.number }}{% endraw %} ``` ## `issues` | Webhook event payload | Activity types | `GITHUB\_SHA` | `GITHUB\_REF` | | --------------------- | -------------- | ------------ | -------------| | [`issues`](/webhooks-and-events/webhooks/webhook-events-and-payloads#issues) | - `opened` - `edited` - `deleted` - `transferred` - `pinned` - `unpinned` - `closed` - `reopened` - `assigned` - `unassigned` - `labeled` - `unlabeled` - `locked` - `unlocked` - `milestoned` - `demilestoned` - `typed` - `untyped` | Last commit on default branch | Default branch | > [!NOTE] > \* {% data reusables.developer-site.multiple\_activity\_types %} For information about each activity type, see [AUTOTITLE](/webhooks-and-events/webhooks/webhook-events-and-payloads#issues). {% data reusables.developer-site.limit\_workflow\_to\_activity\_types %} > \* {% data reusables.actions.branch-requirement %} Runs your workflow when an issue in the workflow's repository is created or modified. For activity related to comments in an issue, use the [`issue\_comment`](#issue\_comment) event. For more information about issues, see [AUTOTITLE](/issues/tracking-your-work-with-issues/about-issues). For information about the issue APIs, see [AUTOTITLE](/graphql/reference/objects#issue) in the GraphQL API documentation or [AUTOTITLE](/rest/issues). For example, you can run a workflow when an issue has been `opened`, `edited`, or `milestoned`. ```yaml on: issues: types: [opened, edited, milestoned] ``` ## `label` | Webhook event payload | Activity types | `GITHUB\_SHA` | `GITHUB\_REF` | | --------------------- | -------------- | ------------ | -------------| | [`label`](/webhooks-and-events/webhooks/webhook-events-and-payloads#label) | - `created` - `edited` - `deleted` | Last commit on default branch | Default branch | > [!NOTE] > \* {% data reusables.developer-site.multiple\_activity\_types %} For information about each activity type, see [AUTOTITLE](/webhooks-and-events/webhooks/webhook-events-and-payloads#label). {% data reusables.developer-site.limit\_workflow\_to\_activity\_types %} > \* {% data reusables.actions.branch-requirement %} Runs your workflow when a label in your workflow's repository is created or modified. For more information about labels, see [AUTOTITLE](/issues/using-labels-and-milestones-to-track-work/managing-labels). For information about the label APIs, see [AUTOTITLE](/graphql/reference/objects#label) in the GraphQL API documentation or [AUTOTITLE](/rest/issues/labels). If you want to run your workflow when a label is added to or removed from an issue, pull request, or discussion, use the `labeled` or `unlabeled` activity types for the [`issues`](#issues), [`pull\_request`](#pull\_request), [`pull\_request\_target`](#pull\_request\_target), or [`discussion`](#discussion) events instead. For example, you can run a workflow when a label has been `created` or `deleted`. ```yaml on: label: types: [created, deleted] ``` ## `merge\_group` | Webhook event payload | | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/events-that-trigger-workflows.md | main | github-actions | [
-0.06040479615330696,
-0.007517194375395775,
0.006835876498371363,
0.05980651453137398,
-0.0026285273488610983,
-0.01728324219584465,
0.007456623483449221,
-0.03557748720049858,
0.05954214558005333,
0.04262262582778931,
-0.05891930311918259,
-0.00946822389960289,
0.034892838448286057,
0.03... | 0.049268 |
issue, pull request, or discussion, use the `labeled` or `unlabeled` activity types for the [`issues`](#issues), [`pull\_request`](#pull\_request), [`pull\_request\_target`](#pull\_request\_target), or [`discussion`](#discussion) events instead. For example, you can run a workflow when a label has been `created` or `deleted`. ```yaml on: label: types: [created, deleted] ``` ## `merge\_group` | Webhook event payload | Activity types | `GITHUB\_SHA` | `GITHUB\_REF` | | --------------------- | -------------- | ------------ | -------------| | [`merge\_group`](/webhooks-and-events/webhooks/webhook-events-and-payloads#merge\_group) | `checks\_requested` | SHA of the merge group | Ref of the merge group | > [!NOTE] > > \* {% data reusables.developer-site.multiple\_activity\_types %} Although only the `checks\_requested` activity type is supported, specifying the activity type will keep your workflow specific if more activity types are added in the future. For information about each activity type, see [AUTOTITLE](/webhooks-and-events/webhooks/webhook-events-and-payloads#merge\_group). {% data reusables.developer-site.limit\_workflow\_to\_activity\_types %} > \* {% data reusables.actions.merge-group-event-with-required-checks %} Runs your workflow when a pull request is added to a merge queue, which adds the pull request to a merge group. For more information see [AUTOTITLE](/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/merging-a-pull-request-with-a-merge-queue). For example, you can run a workflow when the `checks\_requested` activity has occurred. ```yaml on: pull\_request: branches: [ "main" ] merge\_group: types: [checks\_requested] ``` ## `milestone` | Webhook event payload | Activity types | `GITHUB\_SHA` | `GITHUB\_REF` | | --------------------- | -------------- | ------------ | -------------| | [`milestone`](/webhooks-and-events/webhooks/webhook-events-and-payloads#milestone) | - `created` - `closed` - `opened` - `edited` - `deleted` | Last commit on default branch | Default branch | > [!NOTE] > \* {% data reusables.developer-site.multiple\_activity\_types %} For information about each activity type, see [AUTOTITLE](/webhooks-and-events/webhooks/webhook-events-and-payloads#milestone). {% data reusables.developer-site.limit\_workflow\_to\_activity\_types %} > \* {% data reusables.actions.branch-requirement %} Runs your workflow when a milestone in the workflow's repository is created or modified. For more information about milestones, see [AUTOTITLE](/issues/using-labels-and-milestones-to-track-work/about-milestones). For information about the milestone APIs, see [AUTOTITLE](/graphql/reference/objects#milestone) in the GraphQL API documentation or [AUTOTITLE](/rest/issues/milestones). If you want to run your workflow when an issue is added to or removed from a milestone, use the `milestoned` or `demilestoned` activity types for the [`issues`](#issues) event instead. For example, you can run a workflow when a milestone has been `opened` or `deleted`. ```yaml on: milestone: types: [opened, deleted] ``` ## `page\_build` | Webhook event payload | Activity types | `GITHUB\_SHA` | `GITHUB\_REF` | | --------------------- | -------------- | ------------ | -------------| | [`page\_build`](/webhooks-and-events/webhooks/webhook-events-and-payloads#page\_build) | Not applicable | Last commit on default branch | Default branch | > [!NOTE] > {% data reusables.actions.branch-requirement %} Runs your workflow when someone pushes to a branch that is the publishing source for {% data variables.product.prodname\_pages %}, if {% data variables.product.prodname\_pages %} is enabled for the repository. For more information about {% data variables.product.prodname\_pages %} publishing sources, see [AUTOTITLE](/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site). For information about the REST API, see [AUTOTITLE](/rest/repos#pages). For example, you can run a workflow when the `page\_build` event occurs. ```yaml on: page\_build ``` {% ifversion projects-v1 %} ## `project` | Webhook event payload | Activity types | `GITHUB\_SHA` | `GITHUB\_REF` | | --------------------- | -------------- | ------------ | -------------| | [`project`](/webhooks-and-events/webhooks/webhook-events-and-payloads#project) | - `created` - `closed` - `reopened` - `edited` - `deleted` | Last commit on default branch | Default branch | > [!NOTE] > \* {% data reusables.developer-site.multiple\_activity\_types %} The `edited` activity type refers to when a {% data variables.projects.projects\_v1\_board %}, not a column or card on the {% data variables.projects.projects\_v1\_board %}, is edited. For information about each activity type, see [AUTOTITLE](/webhooks-and-events/webhooks/webhook-events-and-payloads#project). {% data reusables.developer-site.limit\_workflow\_to\_activity\_types %} > \* {% data reusables.actions.branch-requirement %} > \* This event only occurs for projects owned by the workflow's repository, not for organization-owned or user-owned projects or for projects owned by another repository. Runs your workflow when a {% data variables.projects.projects\_v1\_board %} is created or modified. For activity related to cards or columns | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/events-that-trigger-workflows.md | main | github-actions | [
-0.049505721777677536,
-0.03320368379354477,
-0.029120124876499176,
0.01788610778748989,
0.051382359117269516,
-0.005631302483379841,
0.074837826192379,
-0.04831477254629135,
0.09794639050960541,
-0.035331372171640396,
0.010949509218335152,
-0.06413856148719788,
-0.004795139655470848,
0.00... | 0.118536 |
{% data reusables.actions.branch-requirement %} > \* This event only occurs for projects owned by the workflow's repository, not for organization-owned or user-owned projects or for projects owned by another repository. Runs your workflow when a {% data variables.projects.projects\_v1\_board %} is created or modified. For activity related to cards or columns in a {% data variables.projects.projects\_v1\_board %}, use the [`project\_card`](#project\_card) or [`project\_column`](#project\_column) events instead. For more information about {% data variables.projects.projects\_v1\_boards %}, see [AUTOTITLE](/issues/organizing-your-work-with-project-boards/managing-project-boards/about-project-boards). For information about the {% data variables.projects.projects\_v1\_board %} APIs, see [AUTOTITLE](/graphql/reference/objects#project) in the GraphQL API documentation or [AUTOTITLE](/rest/projects-classic). For example, you can run a workflow when a project has been `created` or `deleted`. ```yaml on: project: types: [created, deleted] ``` ## `project\_card` | Webhook event payload | Activity types | `GITHUB\_SHA` | `GITHUB\_REF` | | --------------------- | -------------- | ------------ | -------------| | [`project\_card`](/webhooks-and-events/webhooks/webhook-events-and-payloads#project\_card) | - `created` - `moved` - `converted` to an issue - `edited` - `deleted` | Last commit on default branch | Default branch | > [!NOTE] > \* {% data reusables.developer-site.multiple\_activity\_types %} For information about each activity type, see [AUTOTITLE](/webhooks-and-events/webhooks/webhook-events-and-payloads#project\_card). {% data reusables.developer-site.limit\_workflow\_to\_activity\_types %} > \* {% data reusables.actions.branch-requirement %} > \* This event only occurs for projects owned by the workflow's repository, not for organization-owned or user-owned projects or for projects owned by another repository. Runs your workflow when a card on a {% data variables.projects.projects\_v1\_board %} is created or modified. For activity related to {% data variables.projects.projects\_v1\_boards %} or columns in a {% data variables.projects.projects\_v1\_board %}, use the [`project`](#project) or [`project\_column`](#project\_column) event instead. For more information about {% data variables.projects.projects\_v1\_boards %}, see [AUTOTITLE](/issues/organizing-your-work-with-project-boards/managing-project-boards/about-project-boards). For information about the project card APIs, see [AUTOTITLE](/graphql/reference/objects#projectcard) in the GraphQL API documentation or [AUTOTITLE](/rest/projects-classic/cards). For example, you can run a workflow when a project card has been `created` or `deleted`. ```yaml on: project\_card: types: [created, deleted] ``` ## `project\_column` | Webhook event payload | Activity types | `GITHUB\_SHA` | `GITHUB\_REF` | | --------------------- | -------------- | ------------ | -------------| | [`project\_column`](/webhooks-and-events/webhooks/webhook-events-and-payloads#project\_column) | - `created` - `updated` - `moved` - `deleted` | Last commit on default branch | Default branch | > [!NOTE] > \* {% data reusables.developer-site.multiple\_activity\_types %} For information about each activity type, see [AUTOTITLE](/webhooks-and-events/webhooks/webhook-events-and-payloads#project\_column). {% data reusables.developer-site.limit\_workflow\_to\_activity\_types %} > \* {% data reusables.actions.branch-requirement %} > \* This event only occurs for projects owned by the workflow's repository, not for organization-owned or user-owned projects or for projects owned by another repository. Runs your workflow when a column on a {% data variables.projects.projects\_v1\_board %} is created or modified. For activity related to {% data variables.projects.projects\_v1\_boards %} or cards in a {% data variables.projects.projects\_v1\_board %}, use the [`project`](#project) or [`project\_card`](#project\_card) event instead. For more information about {% data variables.projects.projects\_v1\_boards %}, see [AUTOTITLE](/issues/organizing-your-work-with-project-boards/managing-project-boards/about-project-boards). For information about the project column APIs, see [AUTOTITLE](/graphql/reference/objects#projectcolumn) in the GraphQL API documentation or [AUTOTITLE](/rest/projects-classic#columns). For example, you can run a workflow when a project column has been `created` or `deleted`. ```yaml on: project\_column: types: [created, deleted] ``` {% endif %} ## `public` | Webhook event payload | Activity types | `GITHUB\_SHA` | `GITHUB\_REF` | | --------------------- | -------------- | ------------ | -------------| | [`public`](/webhooks-and-events/webhooks/webhook-events-and-payloads#public) | Not applicable | Last commit on default branch | Default branch | > [!NOTE] > {% data reusables.actions.branch-requirement %} Runs your workflow when your workflow's repository changes from private to public. For information about the REST API, see [AUTOTITLE](/rest/repos#edit). For example, you can run a workflow when the `public` event occurs. ```yaml on: public ``` ## `pull\_request` | Webhook event payload | Activity types | `GITHUB\_SHA` | `GITHUB\_REF` | | --------------------- | -------------- | ------------ | -------------| | [`pull\_request`](/webhooks-and-events/webhooks/webhook-events-and-payloads#pull\_request) | - `assigned` - `unassigned` - `labeled` - `unlabeled` | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/events-that-trigger-workflows.md | main | github-actions | [
-0.017869150266051292,
0.013798496685922146,
-0.026438282802700996,
0.03387830778956413,
-0.03867945075035095,
0.006832072511315346,
0.03959061577916145,
-0.026627138257026672,
0.019305316731333733,
-0.00271587329916656,
-0.04058351367712021,
-0.04915758594870567,
-0.012392217293381691,
0.... | 0.019905 |
[AUTOTITLE](/rest/repos#edit). For example, you can run a workflow when the `public` event occurs. ```yaml on: public ``` ## `pull\_request` | Webhook event payload | Activity types | `GITHUB\_SHA` | `GITHUB\_REF` | | --------------------- | -------------- | ------------ | -------------| | [`pull\_request`](/webhooks-and-events/webhooks/webhook-events-and-payloads#pull\_request) | - `assigned` - `unassigned` - `labeled` - `unlabeled` - `opened` - `edited` - `closed` - `reopened` - `synchronize` - `converted\_to\_draft` - `locked` - `unlocked` {% ifversion fpt or ghec %}- `enqueued` - `dequeued` {% endif %}- `milestoned` - `demilestoned` - `ready\_for\_review` - `review\_requested` - `review\_request\_removed` - `auto\_merge\_enabled` - `auto\_merge\_disabled` | Last merge commit on the `GITHUB\_REF` branch | PR merge branch `refs/pull/PULL\_REQUEST\_NUMBER/merge` | > [!NOTE] > \* {% data reusables.developer-site.multiple\_activity\_types %} For information about each activity type, see [AUTOTITLE](/webhooks-and-events/webhooks/webhook-events-and-payloads#pull\_request). By default, a workflow only runs when a `pull\_request` event's activity type is `opened`, `synchronize`, or `reopened`. To trigger workflows by different activity types, use the `types` keyword. For more information, see [AUTOTITLE](/actions/using-workflows/workflow-syntax-for-github-actions#onevent\_nametypes). > \* Workflows will not run on `pull\_request` activity if the pull request has a merge conflict. The merge conflict must be resolved first. Conversely, workflows with the `pull\_request\_target` event will run even if the pull request has a merge conflict. Before using the `pull\_request\_target` trigger, you should be aware of the security risks. For more information, see [`pull\_request\_target`](#pull\_request\_target). > \* The `pull\_request` webhook event payload is empty for merged pull requests and pull requests that come from forked repositories. > \* The value of `GITHUB\_REF` varies for a closed pull request depending on whether the pull request has been merged or not. If a pull request was closed but not merged, it will be `refs/pull/PULL\_REQUEST\_NUMBER/merge`. If a pull request was closed as a result of being merged, it will be the fully qualified `ref` of the branch it was merged into, for example `/refs/heads/main`. Runs your workflow when activity on a pull request in the workflow's repository occurs. For example, if no activity types are specified, the workflow runs when a pull request is opened or reopened or when the head branch of the pull request is updated. For activity related to pull request reviews, pull request review comments, or pull request comments, use the [`pull\_request\_review`](#pull\_request\_review), [`pull\_request\_review\_comment`](#pull\_request\_review\_comment), or [`issue\_comment`](#issue\_comment) events instead. For information about the pull request APIs, see [AUTOTITLE](/graphql/reference/objects#pullrequest) in the GraphQL API documentation or [AUTOTITLE](/rest/pulls). Note that `GITHUB\_SHA` for this event is the last merge commit of the pull request merge branch. If you want to get the commit ID for the last commit to the head branch of the pull request, use `github.event.pull\_request.head.sha` instead. For example, you can run a workflow when a pull request has been opened or reopened. ```yaml on: pull\_request: types: [opened, reopened] ``` You can use the event context to further control when jobs in your workflow will run. For example, this workflow will run when a review is requested on a pull request, but the `specific\_review\_requested` job will only run when a review by `octo-team` is requested. ```yaml on: pull\_request: types: [review\_requested] jobs: specific\_review\_requested: runs-on: ubuntu-latest if: {% raw %}${{ github.event.requested\_team.name == 'octo-team'}}{% endraw %} steps: - run: echo 'A review from octo-team was requested' ``` ### Running your `pull\_request` workflow based on the head or base branch of a pull request You can use the `branches` or `branches-ignore` filter to configure your workflow to only run on pull requests that target specific branches. For more information, see [AUTOTITLE](/actions/using-workflows/workflow-syntax-for-github-actions#onpull\_requestpull\_request\_targetbranchesbranches-ignore). For example, this workflow will run when someone opens a pull request that targets a branch whose name starts with `releases/`: ```yaml on: pull\_request: types: - opened branches: - 'releases/\*\*' ``` > [!NOTE] > {% data reusables.actions.branch-paths-filter %} | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/events-that-trigger-workflows.md | main | github-actions | [
-0.12211959809064865,
-0.001509833033196628,
-0.04508784040808678,
0.008016077801585197,
0.017381619662046432,
-0.02372625097632408,
-0.011369846761226654,
-0.013622215948998928,
0.08642251044511795,
0.03755670040845871,
-0.03707629442214966,
-0.085621677339077,
0.009374948218464851,
-0.04... | 0.153464 |
on pull requests that target specific branches. For more information, see [AUTOTITLE](/actions/using-workflows/workflow-syntax-for-github-actions#onpull\_requestpull\_request\_targetbranchesbranches-ignore). For example, this workflow will run when someone opens a pull request that targets a branch whose name starts with `releases/`: ```yaml on: pull\_request: types: - opened branches: - 'releases/\*\*' ``` > [!NOTE] > {% data reusables.actions.branch-paths-filter %} For example, the following workflow will only run when a pull request that includes a change to a JavaScript (`.js`) file is opened on a branch whose name starts with `releases/`: > > ```yaml > on: > pull\_request: > types: > - opened > branches: > - 'releases/\*\*' > paths: > - '\*\*.js' > ``` To run a job based on the pull request's head branch name (as opposed to the pull request's base branch name), use the `github.head\_ref` context in a conditional. For example, this workflow will run whenever a pull request is opened, but the `run\_if` job will only execute if the head of the pull request is a branch whose name starts with `releases/`: ```yaml on: pull\_request: types: - opened jobs: run\_if: if: startsWith(github.head\_ref, 'releases/') runs-on: ubuntu-latest steps: - run: echo "The head of this PR starts with 'releases/'" ``` ### Running your `pull\_request` workflow based on files changed in a pull request You can also configure your workflow to run when a pull request changes specific files. For more information, see [AUTOTITLE](/actions/using-workflows/workflow-syntax-for-github-actions#onpushpull\_requestpull\_request\_targetpathspaths-ignore). For example, this workflow will run when a pull request includes a change to a JavaScript file (`.js`): ```yaml on: pull\_request: paths: - '\*\*.js' ``` > [!NOTE] > {% data reusables.actions.branch-paths-filter %} For example, the following workflow will only run when a pull request that includes a change to a JavaScript (`.js`) file is opened on a branch whose name starts with `releases/`: > > ```yaml > on: > pull\_request: > types: > - opened > branches: > - 'releases/\*\*' > paths: > - '\*\*.js' > ``` ### Running your `pull\_request` workflow when a pull request merges When a pull request merges, the pull request is automatically closed. To run a workflow when a pull request merges, use the `pull\_request` `closed` event type along with a conditional that checks the `merged` value of the event. For example, the following workflow will run whenever a pull request closes. The `if\_merged` job will only run if the pull request was also merged. ```yaml on: pull\_request: types: - closed jobs: if\_merged: if: github.event.pull\_request.merged == true runs-on: ubuntu-latest steps: - run: | echo The PR was merged ``` {% data reusables.developer-site.pull\_request\_forked\_repos\_link %} ## `pull\_request\_comment` (use `issue\_comment`) To run your workflow when a comment on a pull request (not on a pull request's diff) is created, edited, or deleted, use the [`issue\_comment`](#issue\_comment) event. For activity related to pull request reviews or pull request review comments, use the [`pull\_request\_review`](#pull\_request\_review) or [`pull\_request\_review\_comment`](#pull\_request\_review\_comment) events. ## `pull\_request\_review` | Webhook event payload | Activity types | `GITHUB\_SHA` | `GITHUB\_REF` | | --------------------- | -------------- | ------------ | -------------| | [`pull\_request\_review`](/webhooks-and-events/webhooks/webhook-events-and-payloads#pull\_request\_review) | - `submitted` - `edited` - `dismissed` | Last merge commit on the `GITHUB\_REF` branch | PR merge branch `refs/pull/PULL\_REQUEST\_NUMBER/merge` | > [!NOTE] > {% data reusables.developer-site.multiple\_activity\_types %} For information about each activity type, see [AUTOTITLE](/webhooks-and-events/webhooks/webhook-events-and-payloads#pull\_request\_review). {% data reusables.developer-site.limit\_workflow\_to\_activity\_types %} Runs your workflow when a pull request review is submitted, edited, or dismissed. A pull request review is a group of pull request review comments in addition to a body comment and a state. For activity related to pull request review comments or pull request comments, use the [`pull\_request\_review\_comment`](#pull\_request\_review\_comment) or [`issue\_comment`](#issue\_comment) events instead. For information about the pull request review APIs, see [AUTOTITLE](/graphql/reference/objects#pullrequest) in the GraphQL API documentation or [AUTOTITLE](/rest/pulls#reviews). For example, you can | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/events-that-trigger-workflows.md | main | github-actions | [
-0.06877361983060837,
-0.035383641719818115,
0.04797752946615219,
0.016777431592345238,
0.04069029912352562,
-0.0444374680519104,
0.02405443601310253,
-0.01891782134771347,
0.08197597414255142,
-0.0318484753370285,
-0.05816476419568062,
0.01775755174458027,
-0.03665006905794144,
-0.0061380... | 0.075741 |
comments in addition to a body comment and a state. For activity related to pull request review comments or pull request comments, use the [`pull\_request\_review\_comment`](#pull\_request\_review\_comment) or [`issue\_comment`](#issue\_comment) events instead. For information about the pull request review APIs, see [AUTOTITLE](/graphql/reference/objects#pullrequest) in the GraphQL API documentation or [AUTOTITLE](/rest/pulls#reviews). For example, you can run a workflow when a pull request review has been `edited` or `dismissed`. ```yaml on: pull\_request\_review: types: [edited, dismissed] ``` ### Running a workflow when a pull request is approved To run your workflow when a pull request has been approved, you can trigger your workflow with the `submitted` type of `pull\_request\_review` event, then check the review state with the `github.event.review.state` property. For example, this workflow will run whenever a pull request review is submitted, but the `approved` job will only run if the submitted review is an approving review: ```yaml on: pull\_request\_review: types: [submitted] jobs: approved: if: github.event.review.state == 'approved' runs-on: ubuntu-latest steps: - run: echo "This PR was approved" ``` {% data reusables.developer-site.pull\_request\_forked\_repos\_link %} ## `pull\_request\_review\_comment` | Webhook event payload | Activity types | `GITHUB\_SHA` | `GITHUB\_REF` | | --------------------- | -------------- | ------------ | -------------| | [`pull\_request\_review\_comment`](/webhooks-and-events/webhooks/webhook-events-and-payloads#pull\_request\_review\_comment) | - `created` - `edited` - `deleted`| Last merge commit on the `GITHUB\_REF` branch | PR merge branch `refs/pull/PULL\_REQUEST\_NUMBER/merge` | > [!NOTE] > {% data reusables.developer-site.multiple\_activity\_types %} For information about each activity type, see [AUTOTITLE](/webhooks-and-events/webhooks/webhook-events-and-payloads#pull\_request\_review\_comment). {% data reusables.developer-site.limit\_workflow\_to\_activity\_types %} Runs your workflow when a pull request review comment is modified. A pull request review comment is a comment on a pull request's diff. For activity related to pull request reviews or pull request comments, use the [`pull\_request\_review`](#pull\_request\_review) or [`issue\_comment`](#issue\_comment) events instead. For information about the pull request review comment APIs, see [AUTOTITLE](/graphql/reference/objects#pullrequestreviewcomment) in the GraphQL API documentation or [AUTOTITLE](/rest/pulls#comments). For example, you can run a workflow when a pull request review comment has been `created` or `deleted`. ```yaml on: pull\_request\_review\_comment: types: [created, deleted] ``` {% data reusables.developer-site.pull\_request\_forked\_repos\_link %} ## `pull\_request\_target` | Webhook event payload | Activity types | `GITHUB\_SHA` | `GITHUB\_REF` | | --------------------- | -------------- | ------------ | -------------| | {% ifversion ghes < 3.20 %} | | [`pull\_request`](/webhooks-and-events/webhooks/webhook-events-and-payloads#pull\_request) | - `assigned` - `unassigned` - `labeled` - `unlabeled` - `opened` - `edited` - `closed` - `reopened` - `synchronize` - `converted\_to\_draft` - `ready\_for\_review` - `locked` - `unlocked` {% ifversion fpt or ghec %}- `enqueued` - `dequeued` {% endif %}- `review\_requested` - `review\_request\_removed` - `auto\_merge\_enabled` - `auto\_merge\_disabled` | Last commit on the PR base branch | PR base branch | | {% else %} | | [`pull\_request`](/webhooks-and-events/webhooks/webhook-events-and-payloads#pull\_request) | - `assigned` - `unassigned` - `labeled` - `unlabeled` - `opened` - `edited` - `closed` - `reopened` - `synchronize` - `converted\_to\_draft` - `ready\_for\_review` - `locked` - `unlocked` {% ifversion fpt or ghec %}- `enqueued` - `dequeued` {% endif %}- `review\_requested` - `review\_request\_removed` - `auto\_merge\_enabled` - `auto\_merge\_disabled` | Last commit on default branch | Default branch | | {% endif %} | > [!NOTE] > {% data reusables.developer-site.multiple\_activity\_types %} For information about each activity type, see [AUTOTITLE](/webhooks-and-events/webhooks/webhook-events-and-payloads#pull\_request). By default, a workflow only runs when a `pull\_request\_target` event's activity type is `opened`, `synchronize`, or `reopened`. To trigger workflows by different activity types, use the `types` keyword. For more information, see [AUTOTITLE](/actions/using-workflows/workflow-syntax-for-github-actions#onevent\_nametypes). Runs your workflow when activity on a pull request in the workflow's repository occurs. For example, if no activity types are specified, the workflow runs when a pull request is opened or reopened or when the head branch of the pull request is updated. This event runs in the context of the {% ifversion ghes < 3.20 %}base of the pull request{% else %}default branch of the base repository{% endif %}, rather than in the | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/events-that-trigger-workflows.md | main | github-actions | [
-0.10836291313171387,
-0.010716103948652744,
0.0009046274935826659,
0.06029617786407471,
-0.02426796406507492,
-0.014154572039842606,
-0.004842371214181185,
-0.010551046580076218,
0.02513866499066353,
0.08538786321878433,
-0.0395142063498497,
-0.027881363406777382,
0.025089992210268974,
0.... | 0.072521 |
when a pull request is opened or reopened or when the head branch of the pull request is updated. This event runs in the context of the {% ifversion ghes < 3.20 %}base of the pull request{% else %}default branch of the base repository{% endif %}, rather than in the context of the merge commit, as the `pull\_request` event does. This prevents execution of unsafe code from the head of the pull request that could alter your repository or steal any secrets you use in your workflow. This event allows your workflow to do things like label or comment on pull requests from forks. Avoid using this event if you need to build or run code from the pull request. To ensure repository security, branches with names that match certain patterns (such as those which look similar to SHAs) may not trigger workflows with the `pull\_request\_target` event. {% data reusables.actions.pull-request-target-permissions-warning %} For example, you can run a workflow when a pull request has been `assigned`, `opened`, `synchronize`, or `reopened`. ```yaml on: pull\_request\_target: types: [assigned, opened, synchronize, reopened] ``` ### Running your `pull\_request\_target` workflow based on the head or base branch of a pull request You can use the `branches` or `branches-ignore` filter to configure your workflow to only run on pull requests that target specific branches. For more information, see [AUTOTITLE](/actions/using-workflows/workflow-syntax-for-github-actions#onpull\_requestpull\_request\_targetbranchesbranches-ignore). For example, this workflow will run when someone opens a pull request that targets a branch whose name starts with `releases/`: ```yaml on: pull\_request\_target: types: - opened branches: - 'releases/\*\*' ``` > [!NOTE] > {% data reusables.actions.branch-paths-filter %} For example, the following workflow will only run when a pull request that includes a change to a JavaScript (`.js`) file is opened on a branch whose name starts with `releases/`: > > ```yaml > on: > pull\_request\_target: > types: > - opened > branches: > - 'releases/\*\*' > paths: > - '\*\*.js' > ``` To run a job based on the pull request's head branch name (as opposed to the pull request's base branch name), use the `github.head\_ref` context in a conditional. For example, this workflow will run whenever a pull request is opened, but the `run\_if` job will only execute if the head of the pull request is a branch whose name starts with `releases/`: ```yaml on: pull\_request\_target: types: - opened jobs: run\_if: if: startsWith(github.head\_ref, 'releases/') runs-on: ubuntu-latest steps: - run: echo "The head of this PR starts with 'releases/'" ``` ### Running your `pull\_request\_target` workflow based on files changed in a pull request You can use the `paths` or `paths-ignore` filter to configure your workflow to run when a pull request changes specific files. For more information, see [AUTOTITLE](/actions/using-workflows/workflow-syntax-for-github-actions#onpushpull\_requestpull\_request\_targetpathspaths-ignore). For example, this workflow will run when a pull request includes a change to a JavaScript file (`.js`): ```yaml on: pull\_request\_target: paths: - '\*\*.js' ``` > [!NOTE] > {% data reusables.actions.branch-paths-filter %} For example, the following workflow will only run when a pull request that includes a change to a JavaScript (`.js`) file is opened on a branch whose name starts with `releases/`: > > ```yaml > on: > pull\_request\_target: > types: > - opened > branches: > - 'releases/\*\*' > paths: > - '\*\*.js' > ``` ### Running your `pull\_request\_target` workflow when a pull request merges When a pull request merges, the pull request is automatically closed. To run a workflow when a pull request merges, use the `pull\_request\_target` `closed` event type along with a conditional that checks the `merged` value of the event. For example, the following workflow will run whenever a pull request closes. The `if\_merged` job will only run if the pull request was also | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/events-that-trigger-workflows.md | main | github-actions | [
-0.052687082439661026,
-0.04801039770245552,
0.014459648169577122,
-0.009076790884137154,
0.020229117944836617,
-0.02732687257230282,
0.012255201116204262,
0.018677817657589912,
0.08793993294239044,
0.0236717090010643,
0.02582809142768383,
0.01646829955279827,
-0.0572674460709095,
-0.04146... | 0.009581 |
run a workflow when a pull request merges, use the `pull\_request\_target` `closed` event type along with a conditional that checks the `merged` value of the event. For example, the following workflow will run whenever a pull request closes. The `if\_merged` job will only run if the pull request was also merged. ```yaml on: pull\_request\_target: types: - closed jobs: if\_merged: if: github.event.pull\_request.merged == true runs-on: ubuntu-latest steps: - run: | echo The PR was merged ``` ## `push` | Webhook event payload | Activity types | `GITHUB\_SHA` | `GITHUB\_REF` | | --------------------- | -------------- | ------------ | -------------| | [`push`](/webhooks-and-events/webhooks/webhook-events-and-payloads#push) | Not applicable | Tip commit pushed to the ref. When you delete a branch, the SHA in the workflow run (and its associated refs) reverts to the default branch of the repository. | Updated ref | > [!NOTE] > \* The webhook payload available to GitHub Actions does not include the `added`, `removed`, and `modified` attributes in the `commit` object. You can retrieve the full commit object using the API. For information, see [AUTOTITLE](/graphql/reference/objects#commit) in the GraphQL API documentation or [AUTOTITLE](/rest/commits#get-a-commit). > \* {% ifversion fpt or ghec or ghes > 3.14 %}Events will not be created if more than 5,000 branches are pushed at once. {% endif %}Events will not be created for tags when more than three tags are pushed at once. Runs your workflow when you push a commit or tag, or when you create a repository from a template. For example, you can run a workflow when the `push` event occurs. ```yaml on: push ``` > [!NOTE] > When a `push` webhook event triggers a workflow run, the Actions UI's "pushed by" field shows the account of the pusher and not the author or committer. However, if the changes are pushed to a repository using SSH authentication with a deploy key, then the "pushed by" field will be the repository admin who verified the deploy key when it was added it to a repository. ### Running your workflow only when a push to specific branches occurs You can use the `branches` or `branches-ignore` filter to configure your workflow to only run when specific branches are pushed. For more information, see [AUTOTITLE](/actions/using-workflows/workflow-syntax-for-github-actions#onpushbranchestagsbranches-ignoretags-ignore). For example, this workflow will run when someone pushes to `main` or to a branch that starts with `releases/`. ```yaml on: push: branches: - 'main' - 'releases/\*\*' ``` > [!NOTE] > {% data reusables.actions.branch-paths-filter %} For example, the following workflow will only run when a push that includes a change to a JavaScript (`.js`) file is made to a branch whose name starts with `releases/`: > > ```yaml > on: > push: > branches: > - 'releases/\*\*' > paths: > - '\*\*.js' > ``` ### Running your workflow only when a push of specific tags occurs You can use the `tags` or `tags-ignore` filter to configure your workflow to only run when specific tags are pushed. For more information, see [AUTOTITLE](/actions/using-workflows/workflow-syntax-for-github-actions#onpushbranchestagsbranches-ignoretags-ignore). For example, this workflow will run when someone pushes a tag that starts with `v1.`. ```yaml on: push: tags: - v1.\*\* ``` ### Running your workflow only when a push affects specific files You can use the `paths` or `paths-ignore` filter to configure your workflow to run when a push to specific files occurs. For more information, see [AUTOTITLE](/actions/using-workflows/workflow-syntax-for-github-actions#onpushpull\_requestpull\_request\_targetpathspaths-ignore). For example, this workflow will run when someone pushes a change to a JavaScript file (`.js`): ```yaml on: push: paths: - '\*\*.js' ``` ## `registry\_package` | Webhook event payload | Activity types | `GITHUB\_SHA` | `GITHUB\_REF` | | --------------------- | -------------- | ------------ | -------------| | [`registry\_package`](/webhooks-and-events/webhooks/webhook-events-and-payloads#package) | - `published` - `updated` | Commit of | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/events-that-trigger-workflows.md | main | github-actions | [
-0.03214090317487717,
-0.04078085720539093,
0.0039000867400318384,
-0.02156643196940422,
0.03976428508758545,
-0.05971362814307213,
0.012978718616068363,
-0.015176321379840374,
0.06895802915096283,
-0.005749025847762823,
0.04828523471951485,
-0.024644095450639725,
-0.04792356491088867,
-0.... | 0.033541 |
run when someone pushes a change to a JavaScript file (`.js`): ```yaml on: push: paths: - '\*\*.js' ``` ## `registry\_package` | Webhook event payload | Activity types | `GITHUB\_SHA` | `GITHUB\_REF` | | --------------------- | -------------- | ------------ | -------------| | [`registry\_package`](/webhooks-and-events/webhooks/webhook-events-and-payloads#package) | - `published` - `updated` | Commit of the published package | Branch or tag of the published package | > [!NOTE] > \* {% data reusables.developer-site.multiple\_activity\_types %} For information about each activity type, see [AUTOTITLE](/webhooks-and-events/webhooks/webhook-events-and-payloads#registry\_package). {% data reusables.developer-site.limit\_workflow\_to\_activity\_types %} > \* {% data reusables.actions.branch-requirement %} > \* When pushing multi-architecture container images, this event occurs once per manifest, so you might observe your workflow triggering multiple times. To mitigate this, and only run your workflow job for the event that contains the actual image tag information, use a conditional: > > ```yaml > jobs: > job\_name: > if: ${{ github.event.registry\_package.package\_version.container\_metadata.tag.name != '' }} > ``` Runs your workflow when activity related to {% data variables.product.prodname\_registry %} occurs in your repository. For more information, see [{% data variables.product.prodname\_registry %} Documentation](/packages). For example, you can run a workflow when a new package version has been `published`. ```yaml on: registry\_package: types: [published] ``` ## `release` | Webhook event payload | Activity types | `GITHUB\_SHA` | `GITHUB\_REF` | | --------------------- | -------------- | ------------ | -------------| | [`release`](/webhooks-and-events/webhooks/webhook-events-and-payloads#release) | - `published` - `unpublished` - `created` - `edited` - `deleted` - `prereleased` - `released` | Last commit in the tagged release | Tag ref of release `refs/tags/` | > [!NOTE] > \* {% data reusables.developer-site.multiple\_activity\_types %} For information about each activity type, see [AUTOTITLE](/webhooks-and-events/webhooks/webhook-events-and-payloads#release). {% data reusables.developer-site.limit\_workflow\_to\_activity\_types %} > \* Workflows are not triggered for the `created`, `edited`, or `deleted` activity types for draft releases. When you create your release through the {% data variables.product.github %} UI, your release may automatically be saved as a draft. > \* The `prereleased` type will not trigger for pre-releases published from draft releases, but the `published` type will trigger. If you want a workflow to run when stable \_and\_ pre-releases publish, subscribe to `published` instead of `released` and `prereleased`. Runs your workflow when release activity in your repository occurs. For information about the release APIs, see [AUTOTITLE](/graphql/reference/objects#release) in the GraphQL API documentation or [AUTOTITLE](/rest/releases) in the REST API documentation. For example, you can run a workflow when a release has been `published`. ```yaml on: release: types: [published] ``` ## `repository\_dispatch` | Webhook event payload | Activity types | `GITHUB\_SHA` | `GITHUB\_REF` | | ------------------ | ------------ | ------------ | ------------------| | [repository\_dispatch](/webhooks-and-events/webhooks/webhook-events-and-payloads#repository\_dispatch) | Custom | Last commit on default branch | Default branch | > [!NOTE] > {% data reusables.actions.branch-requirement %} You can use the {% data variables.product.github %} API to trigger a webhook event called [`repository\_dispatch`](/webhooks-and-events/webhooks/webhook-events-and-payloads#repository\_dispatch) when you want to trigger a workflow for activity that happens outside of {% data variables.product.github %}. For more information, see [AUTOTITLE](/rest/repos/repos#create-a-repository-dispatch-event). When you make a request to create a `repository\_dispatch` event, you must specify an `event\_type` to describe the activity type. By default, all `repository\_dispatch` activity types trigger a workflow to run. You can use the `types` keyword to limit your workflow to run when a specific `event\_type` value is sent in the `repository\_dispatch` webhook payload. ```yaml on: repository\_dispatch: types: [test\_result] ``` > [!NOTE] > The `event\_type` value is limited to 100 characters. Any data that you send through the `client\_payload` parameter will be available in the `github.event` context in your workflow. For example, if you send this request body when you create a repository dispatch event: ```json { "event\_type": "test\_result", "client\_payload": { "passed": false, "message": "Error: timeout" } } ``` then you can access the payload | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/events-that-trigger-workflows.md | main | github-actions | [
-0.04691172018647194,
-0.0074299974367022514,
0.025273041799664497,
0.018839970231056213,
0.0808979719877243,
-0.034984491765499115,
0.020068388432264328,
-0.04514265060424805,
0.04140182584524155,
0.007886356674134731,
0.025945419445633888,
-0.014952484518289566,
-0.05591055005788803,
-0.... | 0.022247 |
send through the `client\_payload` parameter will be available in the `github.event` context in your workflow. For example, if you send this request body when you create a repository dispatch event: ```json { "event\_type": "test\_result", "client\_payload": { "passed": false, "message": "Error: timeout" } } ``` then you can access the payload in a workflow like this: ```yaml on: repository\_dispatch: types: [test\_result] jobs: run\_if\_failure: if: {% raw %}${{ !github.event.client\_payload.passed }}{% endraw %} runs-on: ubuntu-latest steps: - env: MESSAGE: {% raw %}${{ github.event.client\_payload.message }}{% endraw %} run: echo $MESSAGE ``` > [!NOTE] > \* The maximum number of top-level properties in `client\_payload` is 10. > \* The payload can contain a maximum of 65,535 characters. ## `schedule` | Webhook event payload | Activity types | `GITHUB\_SHA` | `GITHUB\_REF` | | --------------------- | -------------- | ------------ | -------------| | Not applicable | Not applicable | Last commit on default branch | Default branch | > [!NOTE] > \* {% data reusables.actions.schedule-delay %} > \* {% data reusables.actions.branch-requirement %} > \* Scheduled workflows will only run on the default branch. > \* In a public repository, scheduled workflows are automatically disabled when no repository activity has occurred in 60 days. For information on re-enabling a disabled workflow, see [AUTOTITLE](/enterprise-server/actions/using-workflows/disabling-and-enabling-a-workflow#enabling-a-workflow). The `schedule` event allows you to trigger a workflow at a scheduled time. \*\*Example:\*\* ```yaml on: schedule: - cron: "15 4,5 \* \* \*" ``` {% data reusables.repositories.actions-scheduled-workflow-example %} > [!NOTE] > {% data variables.product.prodname\_actions %} does not support the non-standard syntax `@yearly`, `@monthly`, `@weekly`, `@daily`, `@hourly`, and `@reboot`. You can use [crontab guru](https://crontab.guru/) to help generate your cron syntax and confirm what time it will run. To help you get started, there is also a list of [crontab guru examples](https://crontab.guru/examples.html). ### `actor` for scheduled workflows Certain repository events change the `actor` associated with the workflow. For example, a user who changes the default branch of the repository, which changes the branch on which scheduled workflows run, becomes `actor` for those scheduled workflows. For a deactivated scheduled workflow, if a user with `write` permissions to the repository makes a commit that changes the `cron` schedule on the workflow, the workflow will be reactivated, and that user will become the `actor` associated with any workflow runs. Notifications for scheduled workflows are sent to the user who last modified the cron syntax in the workflow file. For more information, see [AUTOTITLE](/actions/monitoring-and-troubleshooting-workflows/notifications-for-workflow-runs). > [!NOTE] > For an enterprise with {% data variables.product.prodname\_emus %}, triggering a scheduled workflow requires that the status of the `actor` user account associated with the workflow is currently active (i.e. not suspended or deleted). > \* Scheduled workflows will not run if the last `actor` associated with the scheduled workflow has been deprovisioned by the {% data variables.product.prodname\_emu %} identity provider (IdP). However, if the last `actor` {% data variables.product.prodname\_emu %} has not been deprovisioned by the IdP, and has only been removed as a member from a given organization in the enterprise, scheduled workflows will still run with that user set as the `actor`. > \* Similarly, for an enterprise without {% data variables.product.prodname\_emus %}, removing a user from an organization will not prevent scheduled workflows which had that user as their `actor` from running. > \* Thus, the \_user account's\_ status, in both {% data variables.product.prodname\_emu %} and non-{% data variables.product.prodname\_emu %} scenarios, is what's important, \_not\_ the user's \_membership status\_ in the organization where the scheduled workflow is located. ## `status` | Webhook event payload | Activity types | `GITHUB\_SHA` | `GITHUB\_REF` | | --------------------- | -------------- | ------------ | -------------| | [`status`](/webhooks-and-events/webhooks/webhook-events-and-payloads#status) | Not applicable | Last commit on default branch | https://github.com/github/docs/blob/main//content/actions/reference/workflows-and-actions/events-that-trigger-workflows.md | main | github-actions | [
0.027743864804506302,
0.012636616826057434,
-0.02702769637107849,
0.06371699273586273,
0.020525097846984863,
-0.049961525946855545,
-0.03364502266049385,
0.014979919418692589,
0.08399113267660141,
-0.04337475448846817,
-0.06361743062734604,
-0.021772073581814766,
-0.00993993878364563,
0.00... | 0.096465 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.