1
0
mirror of synced 2026-01-07 00:01:39 -05:00

Merge branch 'main' into ramyaparimi/update-contributing-docs

This commit is contained in:
Ramya Parimi
2021-09-22 09:58:32 -05:00
committed by GitHub
285 changed files with 1913 additions and 1207 deletions

View File

@@ -17,11 +17,11 @@ import { ArticleGridLayout } from './ArticleGridLayout'
// Mapping of a "normal" article to it's interactive counterpart
const interactiveAlternatives: Record<string, { href: string }> = {
'/actions/guides/building-and-testing-nodejs': {
href: '/actions/guides/building-and-testing-nodejs-or-python?langId=nodejs',
'/actions/automating-builds-and-tests/building-and-testing-nodejs': {
href: '/actions/automating-builds-and-tests/building-and-testing-nodejs-or-python?langId=nodejs',
},
'/actions/guides/building-and-testing-python': {
href: '/actions/guides/building-and-testing-nodejs-or-python?langId=python',
'/actions/automating-builds-and-tests/building-and-testing-python': {
href: '/actions/automating-builds-and-tests/building-and-testing-nodejs-or-python?langId=python',
},
}

View File

@@ -2,6 +2,12 @@ import pick from 'lodash/pick'
import { createContext, useContext } from 'react'
import { FeaturedLink, getFeaturedLinksFromReq } from './ProductLandingContext'
export type LearningTrack = {
trackName?: string
prevGuide?: { href: string; title: string }
nextGuide?: { href: string; title: string }
}
export type TocItem = {
fullPath: string
title: string
@@ -16,6 +22,7 @@ export type TocLandingContextT = {
variant?: 'compact' | 'expanded'
featuredLinks: Record<string, Array<FeaturedLink>>
renderedPage: string
currentLearningTrack?: LearningTrack
}
export const TocLandingContext = createContext<TocLandingContextT | null>(null)
@@ -43,5 +50,6 @@ export const getTocLandingContextFromRequest = (req: any): TocLandingContextT =>
featuredLinks: getFeaturedLinksFromReq(req),
renderedPage: isEarlyAccess ? req.context.renderedPage : '',
currentLearningTrack: req.context.currentLearningTrack,
}
}

View File

@@ -9,10 +9,19 @@ import { useTranslation } from 'components/hooks/useTranslation'
import { ArticleGridLayout } from 'components/article/ArticleGridLayout'
import { Callout } from 'components/ui/Callout'
import { Lead } from 'components/ui/Lead'
import { LearningTrackNav } from '../article/LearningTrackNav'
export const TocLanding = () => {
const { title, introPlainText, tocItems, productCallout, variant, featuredLinks, renderedPage } =
useTocLandingContext()
const {
title,
introPlainText,
tocItems,
productCallout,
variant,
featuredLinks,
renderedPage,
currentLearningTrack,
} = useTocLandingContext()
const { t } = useTranslation('toc')
return (
@@ -58,6 +67,12 @@ export const TocLanding = () => {
<TableOfContents items={tocItems} variant={variant} />
</div>
</ArticleGridLayout>
{currentLearningTrack?.trackName ? (
<div className="mt-4">
<LearningTrackNav track={currentLearningTrack} />
</div>
) : null}
</div>
</DefaultLayout>
)

View File

@@ -7,7 +7,7 @@ const article: PlaygroundArticleT = {
topics: ['CI', 'Node', 'JavaScript'],
type: 'tutorial',
slug: 'building-and-testing-nodejs',
originalArticle: '/actions/guides/building-and-testing-nodejs',
originalArticle: '/actions/automating-builds-and-tests/building-and-testing-nodejs',
codeLanguageId: 'nodejs',
intro: dedent`
This guide shows you how to create a continuous integration (CI) workflow that builds and tests Node.js code. If your CI tests pass, you may want to deploy your code or publish a package.

View File

@@ -7,7 +7,7 @@ const article: PlaygroundArticleT = {
topics: ['CI', 'Python'],
type: 'tutorial',
slug: 'building-and-testing-python',
originalArticle: '/actions/guides/building-and-testing-python',
originalArticle: '/actions/automating-builds-and-tests/building-and-testing-python',
codeLanguageId: 'py',
intro: dedent`
This guide shows you how to build, test, and publish a Python package.

View File

@@ -24,6 +24,28 @@
}
}
h1,
h2,
h3,
h4,
h5,
h6 {
&:hover {
[class~="octicon-link"] {
visibility: visible !important;
}
}
& > a[class~="doctocat-link"] {
padding: 8px;
margin-left: -32px;
color: var(--color-text-secondary);
&:active,
&:focus {
outline: none;
}
}
}
[class~="note"],
[class~="tip"],
[class~="warning"],

View File

@@ -100,7 +100,7 @@ When you set your status, you can also let people know that you have limited ava
![Requested reviewer shows "busy" note next to username](/assets/images/help/profile/request-a-review-limited-availability-status.png)
If you select the "Busy" option, when people @mention your username, assign you an issue or pull request, or request a pull request review from you, a note next to your username will show that you're busy.
If you select the "Busy" option, when people @mention your username, assign you an issue or pull request, or request a pull request review from you, a note next to your username will show that you're busy. You will also be excluded from automatic review assignment for pull requests assigned to any teams you belong to. For more information, see "[Managing code review assignment for your team](/organizations/organizing-members-into-teams/managing-code-review-assignment-for-your-team)."
1. In the top right corner of {% data variables.product.product_name %}, click your profile photo, then click **Set your status** or, if you already have a status set, click your current status.
![Button on profile to set your status](/assets/images/help/profile/set-status-on-profile.png)

View File

@@ -7,6 +7,7 @@ redirect_from:
- /github/automating-your-workflow-with-github-actions/caching-dependencies-to-speed-up-workflows
- /actions/automating-your-workflow-with-github-actions/caching-dependencies-to-speed-up-workflows
- /actions/configuring-and-managing-workflows/caching-dependencies-to-speed-up-workflows
- /actions/guides/caching-dependencies-to-speed-up-workflows
versions:
fpt: '*'
type: tutorial
@@ -139,7 +140,7 @@ To cache files in more than one directory, you will need a step that uses the [`
### 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 "[Context and expression syntax for {% data variables.product.prodname_actions %}](/actions/reference/context-and-expression-syntax-for-github-actions)."
A cache key can include any of the contexts, functions, literals, and operators supported by {% data variables.product.prodname_actions %}. For more information, see "[Expressions](/actions/learn-github-actions/expressions)."
Using expressions to create a `key` allows you to automatically create a new cache when dependencies have changed. For example, you can create a `key` using an expression that calculates the hash of an npm `package-lock.json` file.

View File

@@ -0,0 +1,15 @@
---
title: Advanced guides
shortTitle: Advanced guides
intro: 'How to cache dependencies, store output as artifacts, and use the GitHub CLI in workflows.'
versions:
fpt: '*'
ghes: '*'
ghae: '*'
redirect_from:
- /actions/guides/caching-and-storing-workflow-data
children:
- /caching-dependencies-to-speed-up-workflows
- /storing-workflow-data-as-artifacts
- /using-github-cli-in-workflows
---

View File

@@ -8,6 +8,7 @@ redirect_from:
- /github/automating-your-workflow-with-github-actions/persisting-workflow-data-using-artifacts
- /actions/automating-your-workflow-with-github-actions/persisting-workflow-data-using-artifacts
- /actions/configuring-and-managing-workflows/persisting-workflow-data-using-artifacts
- /actions/guides/storing-workflow-data-as-artifacts
versions:
fpt: '*'
ghes: '*'

View File

@@ -2,6 +2,8 @@
title: Using GitHub CLI in workflows
shortTitle: GitHub CLI in workflows
intro: 'You can script with {% data variables.product.prodname_cli %} in {% data variables.product.prodname_actions %} workflows.'
redirect_from:
- /actions/guides/using-github-cli-in-workflows
versions:
fpt: '*'
ghes: '>=2.22'

View File

@@ -7,6 +7,7 @@ redirect_from:
- /github/automating-your-workflow-with-github-actions/about-continuous-integration
- /actions/automating-your-workflow-with-github-actions/about-continuous-integration
- /actions/building-and-testing-code-with-continuous-integration/about-continuous-integration
- /actions/guides/about-continuous-integration
versions:
fpt: '*'
ghes: '*'

View File

@@ -4,6 +4,7 @@ intro: You can create a continuous integration (CI) workflow in GitHub Actions t
product: '{% data reusables.gated-features.actions %}'
redirect_from:
- /actions/language-and-framework-guides/building-and-testing-java-with-ant
- /actions/guides/building-and-testing-java-with-ant
versions:
fpt: '*'
ghes: '*'

View File

@@ -4,6 +4,7 @@ intro: You can create a continuous integration (CI) workflow in GitHub Actions t
product: '{% data reusables.gated-features.actions %}'
redirect_from:
- /actions/language-and-framework-guides/building-and-testing-java-with-gradle
- /actions/guides/building-and-testing-java-with-gradle
versions:
fpt: '*'
ghes: '*'

View File

@@ -4,6 +4,7 @@ intro: You can create a continuous integration (CI) workflow in GitHub Actions t
product: '{% data reusables.gated-features.actions %}'
redirect_from:
- /actions/language-and-framework-guides/building-and-testing-java-with-maven
- /actions/guides/building-and-testing-java-with-maven
versions:
fpt: '*'
ghes: '*'

View File

@@ -2,6 +2,8 @@
title: Building and testing .NET
intro: You can create a continuous integration (CI) workflow to build and test your .NET project.
product: '{% data reusables.gated-features.actions %}'
redirect_from:
- /actions/guides/building-and-testing-net
versions:
fpt: '*'
ghes: '*'

View File

@@ -3,6 +3,8 @@ title: Building and testing Node.js or Python
shortTitle: Build & test Node.js or Python
intro: You can create a continuous integration (CI) workflow to build and test your project. Use the language selector to show examples for your language of choice.
product: '{% data reusables.gated-features.actions %}'
redirect_from:
- /actions/guides/building-and-testing-nodejs-or-python
versions:
fpt: '*'
ghes: '>=2.22'

View File

@@ -5,6 +5,7 @@ product: '{% data reusables.gated-features.actions %}'
redirect_from:
- /actions/automating-your-workflow-with-github-actions/using-nodejs-with-github-actions
- /actions/language-and-framework-guides/using-nodejs-with-github-actions
- /actions/guides/building-and-testing-nodejs
versions:
fpt: '*'
ghes: '*'
@@ -16,6 +17,7 @@ topics:
- Node
- JavaScript
shortTitle: Build & test Node.js
hasExperimentalAlternative: true
---
{% data reusables.actions.enterprise-beta %}
@@ -82,7 +84,7 @@ The `setup-node` action takes a Node.js version as an input and configures that
The template includes a matrix strategy that builds and tests your code with four Node.js versions: 10.x, 12.x, 14.x, and 15.x. The 'x' is a wildcard character that matches the latest minor and patch release available for a version. Each version of Node.js specified in the `node-version` array creates a job that runs the same steps.
Each job can access the value defined in the matrix `node-version` array using the `matrix` context. The `setup-node` action uses the context as the `node-version` input. The `setup-node` action configures each job with a different Node.js version before building and testing code. For more information about matrix strategies and contexts, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix)" and "[Context and expression syntax for {% data variables.product.prodname_actions %}](/actions/reference/context-and-expression-syntax-for-github-actions)."
Each job can access the value defined in the matrix `node-version` array using the `matrix` context. The `setup-node` action uses the context as the `node-version` input. The `setup-node` action configures each job with a different Node.js version before building and testing code. For more information about matrix strategies and contexts, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix)" and "[Contexts](/actions/learn-github-actions/contexts)."
{% raw %}
```yaml{:copy}

View File

@@ -2,6 +2,8 @@
title: Building and testing PowerShell
intro: You can create a continuous integration (CI) workflow to build and test your PowerShell project.
product: '{% data reusables.gated-features.actions %}'
redirect_from:
- /actions/guides/building-and-testing-powershell
versions:
fpt: '*'
ghes: '*'

View File

@@ -5,6 +5,7 @@ product: '{% data reusables.gated-features.actions %}'
redirect_from:
- /actions/automating-your-workflow-with-github-actions/using-python-with-github-actions
- /actions/language-and-framework-guides/using-python-with-github-actions
- /actions/guides/building-and-testing-python
versions:
fpt: '*'
ghes: '*'
@@ -15,6 +16,7 @@ topics:
- CI
- Python
shortTitle: Build & test Python
hasExperimentalAlternative: true
---
{% data reusables.actions.enterprise-beta %}

View File

@@ -2,6 +2,8 @@
title: Building and testing Ruby
intro: You can create a continuous integration (CI) workflow to build and test your Ruby project.
product: '{% data reusables.gated-features.actions %}'
redirect_from:
- /actions/guides/building-and-testing-ruby
versions:
fpt: '*'
ghes: '*'
@@ -96,7 +98,7 @@ strategy:
```
{% endraw %}
Each version of Ruby specified in the `ruby-version` array creates a job that runs the same steps. The {% raw %}`${{ matrix.ruby-version }}`{% endraw %} context is used to access the current job's version. For more information about matrix strategies and contexts, see "Workflow syntax for GitHub Actions" and "Context and expression syntax for GitHub Actions."
Each version of Ruby specified in the `ruby-version` array creates a job that runs the same steps. The {% raw %}`${{ matrix.ruby-version }}`{% endraw %} context is used to access the current job's version. For more information about matrix strategies and contexts, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/actions/learn-github-actions/workflow-syntax-for-github-actions)" and "[Contexts](/actions/learn-github-actions/contexts)."
The full updated workflow with a matrix strategy could look like this:

View File

@@ -2,6 +2,8 @@
title: Building and testing Swift
intro: You can create a continuous integration (CI) workflow to build and test your Swift project.
product: '{% data reusables.gated-features.actions %}'
redirect_from:
- /actions/guides/building-and-testing-swift
versions:
fpt: '*'
ghes: '*'

View File

@@ -2,6 +2,8 @@
title: Building and testing Xamarin applications
intro: You can create a continuous integration (CI) workflow in GitHub Actions to build and test your Xamarin application.
product: '{% data reusables.gated-features.actions %}'
redirect_from:
- /actions/guides/building-and-testing-xamarin-applications
versions:
fpt: '*'
ghes: '*'

View File

@@ -0,0 +1,30 @@
---
title: Automating builds and tests
shortTitle: Build and test
intro: 'You can automatically build and test your projects with {% data variables.product.prodname_actions %}.'
versions:
fpt: '*'
ghes: '*'
ghae: '*'
redirect_from:
- /actions/building-and-testing-code-with-continuous-integration
- /actions/language-and-framework-guides
- /actions/language-and-framework-guides/github-actions-for-docker
- /actions/language-and-framework-guides/github-actions-for-java
- /actions/language-and-framework-guides/github-actions-for-javascript-and-typescript
- /actions/language-and-framework-guides/github-actions-for-python
children:
- /about-continuous-integration
- /building-and-testing-java-with-ant
- /building-and-testing-java-with-gradle
- /building-and-testing-java-with-maven
- /building-and-testing-net
- /building-and-testing-nodejs-or-python
- /building-and-testing-nodejs
- /building-and-testing-powershell
- /building-and-testing-python
- /building-and-testing-ruby
- /building-and-testing-swift
- /building-and-testing-xamarin-applications
---

View File

@@ -1,5 +1,5 @@
---
title: About actions
title: About custom actions
intro: 'Actions are individual tasks that you can combine to create jobs and customize your workflow. You can create your own actions, or use and customize actions shared by the {% data variables.product.prodname_dotcom %} community.'
product: '{% data reusables.gated-features.actions %}'
redirect_from:
@@ -7,6 +7,7 @@ redirect_from:
- /github/automating-your-workflow-with-github-actions/about-actions
- /actions/automating-your-workflow-with-github-actions/about-actions
- /actions/building-actions/about-actions
- /actions/creating-actions/about-actions
versions:
fpt: '*'
ghes: '*'
@@ -21,7 +22,7 @@ topics:
{% data reusables.actions.enterprise-github-hosted-runners %}
{% data reusables.actions.ae-beta %}
## About actions
## About custom actions
You can create actions by writing custom code that interacts with your repository in any way you'd like, including integrating with {% data variables.product.prodname_dotcom %}'s APIs and any publicly available third-party API. For example, an action can publish npm modules, send SMS alerts when urgent issues are created, or deploy production-ready code.

View File

@@ -1,6 +1,6 @@
---
title: Dockerfile support for GitHub Actions
shortTitle: Docker
shortTitle: Dockerfile support
intro: 'When creating a `Dockerfile` for a Docker container action, you should be aware of how some Docker instructions interact with GitHub Actions and an action''s metadata file.'
product: '{% data reusables.gated-features.actions %}'
redirect_from:

View File

@@ -12,7 +12,7 @@ versions:
ghes: '*'
ghae: '*'
children:
- /about-actions
- /about-custom-actions
- /creating-a-docker-container-action
- /creating-a-javascript-action
- /creating-a-composite-action

View File

@@ -131,7 +131,7 @@ runs:
**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 and expression syntax, see "[Context and expression syntax for {% data variables.product.prodname_actions %}](/actions/reference/context-and-expression-syntax-for-github-actions)".
For more information on how to use context syntax, see "[Contexts](/actions/learn-github-actions/contexts)."
## `runs` for JavaScript actions
@@ -265,7 +265,7 @@ For more information, see "[`github context`](/actions/reference/context-and-exp
#### `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 "[Context and expression syntax for {% data variables.product.prodname_actions %}](/actions/reference/context-and-expression-syntax-for-github-actions)".
**Optional** A unique identifier for the step. You can use the `id` to reference the step in contexts. For more information, see "[Contexts](/actions/learn-github-actions/contexts)."
#### `runs.steps[*].env`

View File

@@ -2,6 +2,8 @@
title: Deploying to Amazon Elastic Container Service
intro: You can deploy to Amazon Elastic Container Service (ECS) as part of your continuous deployment (CD) workflows.
product: '{% data reusables.gated-features.actions %}'
redirect_from:
- /actions/guides/deploying-to-amazon-elastic-container-service
versions:
fpt: '*'
ghes: '*'

View File

@@ -2,6 +2,8 @@
title: Deploying to Azure App Service
intro: You can deploy to Azure App Service as part of your continuous deployment (CD) workflows.
product: '{% data reusables.gated-features.actions %}'
redirect_from:
- /actions/guides/deploying-to-azure-app-service
versions:
fpt: '*'
ghes: '*'

View File

@@ -2,6 +2,8 @@
title: Deploying to Google Kubernetes Engine
intro: You can deploy to Google Kubernetes Engine as part of your continuous deployment (CD) workflows.
product: '{% data reusables.gated-features.actions %}'
redirect_from:
- /actions/guides/deploying-to-google-kubernetes-engine
versions:
fpt: '*'
ghes: '*'

View File

@@ -2,6 +2,8 @@
title: Environments
intro: You can configure environments with protection rules and secrets. A workflow job can reference an environment to use the environment's protection rules and secrets.
product: '{% data reusables.gated-features.environments %}'
redirect_from:
- /actions/reference/environments
versions:
fpt: '*'
ghes: '>=3.1'

View File

@@ -0,0 +1,16 @@
---
title: Deployment
shortTitle: Deployment
intro: 'Automatically deploy projects with {% data variables.product.prodname_actions %}.'
versions:
fpt: '*'
ghes: '*'
ghae: '*'
children:
- /deploying-to-amazon-elastic-container-service
- /deploying-to-azure-app-service
- /deploying-to-google-kubernetes-engine
- /installing-an-apple-certificate-on-macos-runners-for-xcode-development
- /environments
---

View File

@@ -2,6 +2,8 @@
title: Installing an Apple certificate on macOS runners for Xcode development
intro: 'You can sign Xcode apps within your continuous integration (CI) workflow by installing an Apple code signing certificate on {% data variables.product.prodname_actions %} runners.'
product: '{% data reusables.gated-features.actions %}'
redirect_from:
- /actions/guides/installing-an-apple-certificate-on-macos-runners-for-xcode-development
versions:
fpt: '*'
ghes: '*'

View File

@@ -1,114 +0,0 @@
---
title: Guides
shortTitle: Guides
intro: 'These guides for {% data variables.product.prodname_actions %} include specific use cases and examples to help you configure workflows.'
redirect_from:
- /actions/guides/caching-and-storing-workflow-data
- /actions/automating-your-workflow-with-github-actions/using-databases-and-services
- /actions/configuring-and-managing-workflows/using-databases-and-service-containers
- /actions/guides/using-databases-and-service-containers
- /actions/language-and-framework-guides
- /actions/language-and-framework-guides/github-actions-for-docker
- /actions/language-and-framework-guides/github-actions-for-java
- /actions/language-and-framework-guides/github-actions-for-javascript-and-typescript
- /actions/language-and-framework-guides/github-actions-for-python
- /actions/publishing-packages-with-github-actions
- /actions/building-and-testing-code-with-continuous-integration
versions:
fpt: '*'
ghes: '*'
ghae: '*'
learningTracks:
- getting_started
- continuous_integration
- continuous_deployment
- deploy_to_the_cloud
- hosting_your_own_runners
- create_actions
layout: product-sublanding
includeGuides:
- /actions/quickstart
- /actions/learn-github-actions/introduction-to-github-actions
- /actions/creating-actions/creating-a-docker-container-action
- /actions/guides/setting-up-continuous-integration-using-workflow-templates
- /actions/guides/building-and-testing-python
- /actions/guides/building-and-testing-nodejs
- /actions/guides/about-packaging-with-github-actions
- /actions/guides/publishing-docker-images
- /actions/guides/caching-dependencies-to-speed-up-workflows
- /actions/guides/about-continuous-integration
- /actions/guides/building-and-testing-powershell
- /actions/guides/building-and-testing-ruby
- /actions/guides/building-and-testing-java-with-maven
- /actions/guides/building-and-testing-java-with-gradle
- /actions/guides/building-and-testing-java-with-ant
- /actions/guide/building-and-testing-swift
- /actions/guides/installing-an-apple-certificate-on-macos-runners-for-xcode-development
- /actions/guides/building-and-testing-xamarin-applications
- /actions/guides/publishing-nodejs-packages
- /actions/guides/publishing-java-packages-with-maven
- /actions/guides/publishing-java-packages-with-gradle
- /actions/guides/storing-workflow-data-as-artifacts
- /actions/guides/about-service-containers
- /actions/guides/creating-redis-service-containers
- /actions/guides/creating-postgresql-service-containers
- /actions/guides/deploying-to-amazon-elastic-container-service
- /actions/guides/deploying-to-azure-app-service
- /actions/guides/deploying-to-google-kubernetes-engine
- /actions/learn-github-actions/essential-features-of-github-actions
- /actions/learn-github-actions/security-hardening-for-github-actions
- /actions/creating-actions/about-actions
- /actions/creating-actions/creating-a-javascript-action
- /actions/creating-actions/creating-a-composite-action
- /actions/learn-github-actions/migrating-from-azure-pipelines-to-github-actions
- /actions/learn-github-actions/migrating-from-circleci-to-github-actions
- /actions/learn-github-actions/migrating-from-gitlab-cicd-to-github-actions
- /actions/learn-github-actions/migrating-from-jenkins-to-github-actions
- /actions/learn-github-actions/migrating-from-travis-ci-to-github-actions
- /actions/guides/using-github-actions-for-project-management
- /actions/guides/closing-inactive-issues
- /actions/guides/scheduling-issue-creation
- /actions/guides/adding-labels-to-issues
- /actions/guides/commenting-on-an-issue-when-a-label-is-added
- /actions/guides/moving-assigned-issues-on-project-boards
- /actions/guides/removing-a-label-when-a-card-is-added-to-a-project-board-column
- /code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/automating-dependabot-with-github-actions
- /code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/keeping-your-actions-up-to-date-with-dependabot
children:
- /about-continuous-integration
- /setting-up-continuous-integration-using-workflow-templates
- /building-and-testing-nodejs-or-python
- /building-and-testing-nodejs
- /building-and-testing-net
- /building-and-testing-powershell
- /building-and-testing-python
- /building-and-testing-ruby
- /building-and-testing-java-with-maven
- /building-and-testing-java-with-gradle
- /building-and-testing-java-with-ant
- /building-and-testing-swift
- /installing-an-apple-certificate-on-macos-runners-for-xcode-development
- /building-and-testing-xamarin-applications
- /about-packaging-with-github-actions
- /publishing-nodejs-packages
- /publishing-java-packages-with-maven
- /publishing-java-packages-with-gradle
- /publishing-docker-images
- /storing-workflow-data-as-artifacts
- /caching-dependencies-to-speed-up-workflows
- /about-service-containers
- /creating-redis-service-containers
- /creating-postgresql-service-containers
- /deploying-to-amazon-elastic-container-service
- /deploying-to-azure-app-service
- /deploying-to-google-kubernetes-engine
- /using-github-actions-for-project-management
- /closing-inactive-issues
- /scheduling-issue-creation
- /adding-labels-to-issues
- /commenting-on-an-issue-when-a-label-is-added
- /moving-assigned-issues-on-project-boards
- /removing-a-label-when-a-card-is-added-to-a-project-board-column
- /using-github-cli-in-workflows
---

View File

@@ -5,7 +5,6 @@ intro: 'Automate, customize, and execute your software development workflows rig
introLinks:
overview: /actions/learn-github-actions/understanding-github-actions
quickstart: /actions/quickstart
reference: /actions/reference
featuredLinks:
guides:
- /actions/learn-github-actions
@@ -17,12 +16,13 @@ featuredLinks:
- /actions/guides/publishing-nodejs-packages
- /actions/guides/building-and-testing-powershell
popular:
- /actions/reference/workflow-syntax-for-github-actions
- /actions/learn-github-actions/workflow-syntax-for-github-actions
- /actions/learn-github-actions
- /actions/reference/events-that-trigger-workflows
- /actions/reference/context-and-expression-syntax-for-github-actions
- /actions/reference/environment-variables
- /actions/reference/encrypted-secrets
- /actions/learn-github-actions/events-that-trigger-workflows
- /actions/learn-github-actions/contexts
- /actions/learn-github-actions/expressions
- /actions/learn-github-actions/environment-variables
- /actions/security-guides/encrypted-secrets
changelog:
label: actions
prefix: 'GitHub Actions: '
@@ -35,6 +35,8 @@ redirect_from:
- /actions/automating-your-workflow-with-github-actions/
- /categories/automating-your-workflow-with-github-actions
- /marketplace/actions
- /actions/guides
- /actions/reference
layout: product-landing
versions:
fpt: '*'
@@ -42,13 +44,18 @@ versions:
ghae: '*'
children:
- /quickstart
- /guides
- /learn-github-actions
- /managing-workflow-runs
- /creating-actions
- /security-guides
- /automating-builds-and-tests
- /deployment
- /managing-issues-and-pull-requests
- /publishing-packages
- /using-containerized-services
- /advanced-guides
- /managing-workflow-runs
- /monitoring-and-troubleshooting-workflows
- /using-github-hosted-runners
- /hosting-your-own-runners
- /reference
- /migrating-to-github-actions
---

View File

@@ -1,13 +1,14 @@
---
title: Context and expression syntax for GitHub Actions
shortTitle: Context and expression syntax
intro: You can access context information and evaluate expressions in workflows and actions.
title: Contexts
shortTitle: Contexts
intro: You can access context information in workflows and actions.
product: '{% data reusables.gated-features.actions %}'
redirect_from:
- /articles/contexts-and-expression-syntax-for-github-actions
- /github/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions
- /actions/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions
- /actions/reference/contexts-and-expression-syntax-for-github-actions
- /actions/reference/context-and-expression-syntax-for-github-actions
versions:
fpt: '*'
ghes: '*'
@@ -19,42 +20,11 @@ miniTocMaxHeadingLevel: 3
{% data reusables.actions.enterprise-github-hosted-runners %}
{% data reusables.actions.ae-beta %}
## About contexts and expressions
You can use expressions to programmatically set variables in workflow files and access contexts. An expression can be any combination of literal values, references to a context, or functions. You can combine literals, context references, and functions using operators.
Expressions are commonly used with the conditional `if` keyword in a workflow file to determine whether a step should run. When an `if` conditional is `true`, the step will run.
You need to use specific syntax to tell {% data variables.product.prodname_dotcom %} to evaluate an expression rather than treat it as a string.
{% raw %}
`${{ <expression> }}`
{% endraw %}
{% data reusables.github-actions.expression-syntax-if %} For more information about `if` conditionals, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/articles/workflow-syntax-for-github-actions/#jobsjob_idif)."
## About contexts
{% data reusables.github-actions.context-injection-warning %}
#### Example expression in an `if` conditional
```yaml
steps:
- uses: actions/hello-world-javascript-action@v1.1
if: {% raw %}${{ <expression> }}{% endraw %}
```
#### Example setting an environment variable
{% raw %}
```yaml
env:
MY_ENV_VAR: ${{ <expression> }}
```
{% endraw %}
## Contexts
Contexts are a way to access information about workflow runs, runner environments, jobs, and steps. Contexts use the expression syntax.
Contexts are a way to access information about workflow runs, runner environments, jobs, and steps. Contexts use the expression syntax. For more information, see "[Expressions](/actions/learn-github-actions/expressions)."
{% raw %}
`${{ <context> }}`
@@ -217,292 +187,6 @@ jobs:
```
{% endraw %}
## Literals
As part of an expression, you can use `boolean`, `null`, `number`, or `string` data types.
| Data type | Literal value |
|-----------|---------------|
| `boolean` | `true` or `false` |
| `null` | `null` |
| `number` | Any number format supported by JSON. |
| `string` | You must use single quotes. Escape literal single-quotes with a single quote. |
#### Example
{% raw %}
```yaml
env:
myNull: ${{ null }}
myBoolean: ${{ false }}
myIntegerNumber: ${{ 711 }}
myFloatNumber: ${{ -9.2 }}
myHexNumber: ${{ 0xff }}
myExponentialNumber: ${{ -2.99-e2 }}
myString: ${{ 'Mona the Octocat' }}
myEscapedString: ${{ 'It''s open source!' }}
```
{% endraw %}
## Operators
| Operator | Description |
| --- | --- |
| `( )` | Logical grouping |
| `[ ]` | Index
| `.` | Property dereference |
| `!` | Not |
| `<` | Less than |
| `<=` | Less than or equal |
| `>` | Greater than |
| `>=` | Greater than or equal |
| `==` | Equal |
| `!=` | Not equal |
| `&&` | And |
| <code>\|\|</code> | Or |
{% data variables.product.prodname_dotcom %} performs loose equality comparisons.
* If the types do not match, {% data variables.product.prodname_dotcom %} coerces the type to a number. {% data variables.product.prodname_dotcom %} casts data types to a number using these conversions:
| Type | Result |
| --- | --- |
| Null | `0` |
| Boolean | `true` returns `1` <br /> `false` returns `0` |
| String | Parsed from any legal JSON number format, otherwise `NaN`. <br /> Note: empty string returns `0`. |
| Array | `NaN` |
| Object | `NaN` |
* A comparison of one `NaN` to another `NaN` does not result in `true`. For more information, see the "[NaN Mozilla docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN)."
* {% data variables.product.prodname_dotcom %} ignores case when comparing strings.
* Objects and arrays are only considered equal when they are the same instance.
## Functions
{% data variables.product.prodname_dotcom %} offers a set of built-in functions that you can use in expressions. Some functions cast values to a string to perform comparisons. {% data variables.product.prodname_dotcom %} casts data types to a string using these conversions:
| Type | Result |
| --- | --- |
| Null | `''` |
| Boolean | `'true'` or `'false'` |
| Number | Decimal format, exponential for large numbers |
| Array | Arrays are not converted to a string |
| Object | Objects are not converted to a string |
### contains
`contains( search, item )`
Returns `true` if `search` contains `item`. If `search` is an array, this function returns `true` if the `item` is an element in the array. If `search` is a string, this function returns `true` if the `item` is a substring of `search`. This function is not case sensitive. Casts values to a string.
#### Example using an array
`contains(github.event.issue.labels.*.name, 'bug')`
#### Example using a string
`contains('Hello world', 'llo')` returns `true`
### startsWith
`startsWith( searchString, searchValue )`
Returns `true` when `searchString` starts with `searchValue`. This function is not case sensitive. Casts values to a string.
#### Example
`startsWith('Hello world', 'He')` returns `true`
### endsWith
`endsWith( searchString, searchValue )`
Returns `true` if `searchString` ends with `searchValue`. This function is not case sensitive. Casts values to a string.
#### Example
`endsWith('Hello world', 'ld')` returns `true`
### format
`format( string, replaceValue0, replaceValue1, ..., replaceValueN)`
Replaces values in the `string`, with the variable `replaceValueN`. Variables in the `string` are specified using the `{N}` syntax, where `N` is an integer. You must specify at least one `replaceValue` and `string`. There is no maximum for the number of variables (`replaceValueN`) you can use. Escape curly braces using double braces.
#### Example
Returns 'Hello Mona the Octocat'
`format('Hello {0} {1} {2}', 'Mona', 'the', 'Octocat')`
#### Example escaping braces
Returns '{Hello Mona the Octocat!}'
{% raw %}
```js
format('{{Hello {0} {1} {2}!}}', 'Mona', 'the', 'Octocat')
```
{% endraw %}
### join
`join( array, optionalSeparator )`
The value for `array` can be an array or a string. All values in `array` are concatenated into a string. If you provide `optionalSeparator`, it is inserted between the concatenated values. Otherwise, the default separator `,` is used. Casts values to a string.
#### Example
`join(github.event.issue.labels.*.name, ', ')` may return 'bug, help wanted'
### toJSON
`toJSON(value)`
Returns a pretty-print JSON representation of `value`. You can use this function to debug the information provided in contexts.
#### Example
`toJSON(job)` might return `{ "status": "Success" }`
### fromJSON
`fromJSON(value)`
Returns a JSON object or JSON data type for `value`. You can use this function to provide a JSON object as an evaluated expression or to convert environment variables from a string.
#### Example returning a JSON object
This workflow sets a JSON matrix in one job, and passes it to the next job using an output and `fromJSON`.
{% raw %}
```yaml
name: build
on: push
jobs:
job1:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: echo "::set-output name=matrix::{\"include\":[{\"project\":\"foo\",\"config\":\"Debug\"},{\"project\":\"bar\",\"config\":\"Release\"}]}"
job2:
needs: job1
runs-on: ubuntu-latest
strategy:
matrix: ${{fromJSON(needs.job1.outputs.matrix)}}
steps:
- run: build
```
{% endraw %}
#### Example returning a JSON data type
This workflow uses `fromJSON` to convert environment variables from a string to a Boolean or integer.
{% raw %}
```yaml
name: print
on: push
env:
continue: true
time: 3
jobs:
job1:
runs-on: ubuntu-latest
steps:
- continue-on-error: ${{ fromJSON(env.continue) }}
timeout-minutes: ${{ fromJSON(env.time) }}
run: echo ...
```
{% endraw %}
### hashFiles
`hashFiles(path)`
Returns a single hash for the set of files that matches the `path` pattern. You can provide a single `path` pattern or multiple `path` patterns separated by commas. The `path` is relative to the `GITHUB_WORKSPACE` directory and can only include files inside of the `GITHUB_WORKSPACE`. This function calculates an individual SHA-256 hash for each matched file, and then uses those hashes to calculate a final SHA-256 hash for the set of files. For more information about SHA-256, see "[SHA-2](https://en.wikipedia.org/wiki/SHA-2)."
You can use pattern matching characters to match file names. Pattern matching is case-insensitive on Windows. For more information about supported pattern matching characters, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions/#filter-pattern-cheat-sheet)."
#### Example with a single pattern
Matches any `package-lock.json` file in the repository.
`hashFiles('**/package-lock.json')`
#### Example with multiple patterns
Creates a hash for any `package-lock.json` and `Gemfile.lock` files in the repository.
`hashFiles('**/package-lock.json', '**/Gemfile.lock')`
## Job status check functions
You can use the following status check functions as expressions in `if` conditionals. A default status check of `success()` is applied unless you include one of these functions. For more information about `if` conditionals, see "[Workflow syntax for GitHub Actions](/articles/workflow-syntax-for-github-actions/#jobsjob_idif)."
### success
Returns `true` when none of the previous steps have failed or been canceled.
#### Example
```yaml
steps:
...
- name: The job has succeeded
if: {% raw %}${{ success() }}{% endraw %}
```
### always
Causes the step to always execute, and returns `true`, even when canceled. A job or step will not run when a critical failure prevents the task from running. For example, if getting sources failed.
#### Example
```yaml
if: {% raw %}${{ always() }}{% endraw %}
```
### cancelled
Returns `true` if the workflow was canceled.
#### Example
```yaml
if: {% raw %}${{ cancelled() }}{% endraw %}
```
### failure
Returns `true` when any previous step of a job fails.
#### Example
```yaml
steps:
...
- name: The job has failed
if: {% raw %}${{ failure() }}{% endraw %}
```
## Object filters
You can use the `*` syntax to apply a filter and select matching items in a collection.
For example, consider an array of objects named `fruits`.
```json
[
{ "name": "apple", "quantity": 1 },
{ "name": "orange", "quantity": 2 },
{ "name": "pear", "quantity": 1 }
]
```
The filter `fruits.*.name` returns the array `[ "apple", "orange", "pear" ]`
## 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.

View File

@@ -6,6 +6,7 @@ redirect_from:
- /github/automating-your-workflow-with-github-actions/using-environment-variables
- /actions/automating-your-workflow-with-github-actions/using-environment-variables
- /actions/configuring-and-managing-workflows/using-environment-variables
- /actions/reference/environment-variables
versions:
fpt: '*'
ghes: '*'

View File

@@ -7,6 +7,7 @@ redirect_from:
- /articles/events-that-trigger-workflows
- /github/automating-your-workflow-with-github-actions/events-that-trigger-workflows
- /actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows
- /actions/reference/events-that-trigger-workflows
versions:
fpt: '*'
ghes: '*'
@@ -97,7 +98,7 @@ You can manually trigger workflow runs. To trigger specific workflows in a repos
| ------------------ | ------------ | ------------ | ------------------|
| [workflow_dispatch](/webhooks/event-payloads/#workflow_dispatch) | n/a | Last commit on the `GITHUB_REF` branch | Branch that received dispatch |
You can configure custom-defined input properties, default input values, and required inputs for the event directly in your workflow. When the workflow runs, you can access the input values in the `github.event.inputs` context. For more information, see "[Context and expression syntax for {% data variables.product.prodname_actions %}](/actions/reference/context-and-expression-syntax-for-github-actions#github-context)."
You can configure custom-defined input properties, default input values, and required inputs for the event directly in your workflow. When the workflow runs, you can access the input values in the `github.event.inputs` context. For more information, see "[Contexts](/actions/learn-github-actions/contexts)."
You can manually trigger a workflow run using the {% data variables.product.product_name %} API and from {% data variables.product.product_name %}. For more information, see "[Manually running a workflow](/actions/managing-workflow-runs/manually-running-a-workflow)."

View File

@@ -0,0 +1,334 @@
---
title: Expressions
shortTitle: Expressions
intro: You can evaluate expressions in workflows and actions.
product: '{% data reusables.gated-features.actions %}'
versions:
fpt: '*'
ghes: '*'
ghae: '*'
miniTocMaxHeadingLevel: 3
---
{% data reusables.actions.enterprise-beta %}
{% data reusables.actions.enterprise-github-hosted-runners %}
{% data reusables.actions.ae-beta %}
## About expressions
You can use expressions to programmatically set variables in workflow files and access contexts. An expression can be any combination of literal values, references to a context, or functions. You can combine literals, context references, and functions using operators. For more information about contexts, see "[Contexts](/actions/learn-github-actions/contexts)."
Expressions are commonly used with the conditional `if` keyword in a workflow file to determine whether a step should run. When an `if` conditional is `true`, the step will run.
You need to use specific syntax to tell {% data variables.product.prodname_dotcom %} to evaluate an expression rather than treat it as a string.
{% raw %}
`${{ <expression> }}`
{% endraw %}
{% data reusables.github-actions.expression-syntax-if %} For more information about `if` conditionals, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/articles/workflow-syntax-for-github-actions/#jobsjob_idif)."
{% data reusables.github-actions.context-injection-warning %}
#### Example expression in an `if` conditional
```yaml
steps:
- uses: actions/hello-world-javascript-action@v1.1
if: {% raw %}${{ <expression> }}{% endraw %}
```
#### Example setting an environment variable
{% raw %}
```yaml
env:
MY_ENV_VAR: ${{ <expression> }}
```
{% endraw %}
## Literals
As part of an expression, you can use `boolean`, `null`, `number`, or `string` data types.
| Data type | Literal value |
|-----------|---------------|
| `boolean` | `true` or `false` |
| `null` | `null` |
| `number` | Any number format supported by JSON. |
| `string` | You must use single quotes. Escape literal single-quotes with a single quote. |
#### Example
{% raw %}
```yaml
env:
myNull: ${{ null }}
myBoolean: ${{ false }}
myIntegerNumber: ${{ 711 }}
myFloatNumber: ${{ -9.2 }}
myHexNumber: ${{ 0xff }}
myExponentialNumber: ${{ -2.99-e2 }}
myString: ${{ 'Mona the Octocat' }}
myEscapedString: ${{ 'It''s open source!' }}
```
{% endraw %}
## Operators
| Operator | Description |
| --- | --- |
| `( )` | Logical grouping |
| `[ ]` | Index
| `.` | Property dereference |
| `!` | Not |
| `<` | Less than |
| `<=` | Less than or equal |
| `>` | Greater than |
| `>=` | Greater than or equal |
| `==` | Equal |
| `!=` | Not equal |
| `&&` | And |
| <code>\|\|</code> | Or |
{% data variables.product.prodname_dotcom %} performs loose equality comparisons.
* If the types do not match, {% data variables.product.prodname_dotcom %} coerces the type to a number. {% data variables.product.prodname_dotcom %} casts data types to a number using these conversions:
| Type | Result |
| --- | --- |
| Null | `0` |
| Boolean | `true` returns `1` <br /> `false` returns `0` |
| String | Parsed from any legal JSON number format, otherwise `NaN`. <br /> Note: empty string returns `0`. |
| Array | `NaN` |
| Object | `NaN` |
* A comparison of one `NaN` to another `NaN` does not result in `true`. For more information, see the "[NaN Mozilla docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN)."
* {% data variables.product.prodname_dotcom %} ignores case when comparing strings.
* Objects and arrays are only considered equal when they are the same instance.
## Functions
{% data variables.product.prodname_dotcom %} offers a set of built-in functions that you can use in expressions. Some functions cast values to a string to perform comparisons. {% data variables.product.prodname_dotcom %} casts data types to a string using these conversions:
| Type | Result |
| --- | --- |
| Null | `''` |
| Boolean | `'true'` or `'false'` |
| Number | Decimal format, exponential for large numbers |
| Array | Arrays are not converted to a string |
| Object | Objects are not converted to a string |
### contains
`contains( search, item )`
Returns `true` if `search` contains `item`. If `search` is an array, this function returns `true` if the `item` is an element in the array. If `search` is a string, this function returns `true` if the `item` is a substring of `search`. This function is not case sensitive. Casts values to a string.
#### Example using an array
`contains(github.event.issue.labels.*.name, 'bug')`
#### Example using a string
`contains('Hello world', 'llo')` returns `true`
### startsWith
`startsWith( searchString, searchValue )`
Returns `true` when `searchString` starts with `searchValue`. This function is not case sensitive. Casts values to a string.
#### Example
`startsWith('Hello world', 'He')` returns `true`
### endsWith
`endsWith( searchString, searchValue )`
Returns `true` if `searchString` ends with `searchValue`. This function is not case sensitive. Casts values to a string.
#### Example
`endsWith('Hello world', 'ld')` returns `true`
### format
`format( string, replaceValue0, replaceValue1, ..., replaceValueN)`
Replaces values in the `string`, with the variable `replaceValueN`. Variables in the `string` are specified using the `{N}` syntax, where `N` is an integer. You must specify at least one `replaceValue` and `string`. There is no maximum for the number of variables (`replaceValueN`) you can use. Escape curly braces using double braces.
#### Example
Returns 'Hello Mona the Octocat'
`format('Hello {0} {1} {2}', 'Mona', 'the', 'Octocat')`
#### Example escaping braces
Returns '{Hello Mona the Octocat!}'
{% raw %}
```js
format('{{Hello {0} {1} {2}!}}', 'Mona', 'the', 'Octocat')
```
{% endraw %}
### join
`join( array, optionalSeparator )`
The value for `array` can be an array or a string. All values in `array` are concatenated into a string. If you provide `optionalSeparator`, it is inserted between the concatenated values. Otherwise, the default separator `,` is used. Casts values to a string.
#### Example
`join(github.event.issue.labels.*.name, ', ')` may return 'bug, help wanted'
### toJSON
`toJSON(value)`
Returns a pretty-print JSON representation of `value`. You can use this function to debug the information provided in contexts.
#### Example
`toJSON(job)` might return `{ "status": "Success" }`
### fromJSON
`fromJSON(value)`
Returns a JSON object or JSON data type for `value`. You can use this function to provide a JSON object as an evaluated expression or to convert environment variables from a string.
#### Example returning a JSON object
This workflow sets a JSON matrix in one job, and passes it to the next job using an output and `fromJSON`.
{% raw %}
```yaml
name: build
on: push
jobs:
job1:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: echo "::set-output name=matrix::{\"include\":[{\"project\":\"foo\",\"config\":\"Debug\"},{\"project\":\"bar\",\"config\":\"Release\"}]}"
job2:
needs: job1
runs-on: ubuntu-latest
strategy:
matrix: ${{fromJSON(needs.job1.outputs.matrix)}}
steps:
- run: build
```
{% endraw %}
#### Example returning a JSON data type
This workflow uses `fromJSON` to convert environment variables from a string to a Boolean or integer.
{% raw %}
```yaml
name: print
on: push
env:
continue: true
time: 3
jobs:
job1:
runs-on: ubuntu-latest
steps:
- continue-on-error: ${{ fromJSON(env.continue) }}
timeout-minutes: ${{ fromJSON(env.time) }}
run: echo ...
```
{% endraw %}
### hashFiles
`hashFiles(path)`
Returns a single hash for the set of files that matches the `path` pattern. You can provide a single `path` pattern or multiple `path` patterns separated by commas. The `path` is relative to the `GITHUB_WORKSPACE` directory and can only include files inside of the `GITHUB_WORKSPACE`. This function calculates an individual SHA-256 hash for each matched file, and then uses those hashes to calculate a final SHA-256 hash for the set of files. For more information about SHA-256, see "[SHA-2](https://en.wikipedia.org/wiki/SHA-2)."
You can use pattern matching characters to match file names. Pattern matching is case-insensitive on Windows. For more information about supported pattern matching characters, see "[Workflow syntax for {% data variables.product.prodname_actions %}](/github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions/#filter-pattern-cheat-sheet)."
#### Example with a single pattern
Matches any `package-lock.json` file in the repository.
`hashFiles('**/package-lock.json')`
#### Example with multiple patterns
Creates a hash for any `package-lock.json` and `Gemfile.lock` files in the repository.
`hashFiles('**/package-lock.json', '**/Gemfile.lock')`
## Job status check functions
You can use the following status check functions as expressions in `if` conditionals. A default status check of `success()` is applied unless you include one of these functions. For more information about `if` conditionals, see "[Workflow syntax for GitHub Actions](/articles/workflow-syntax-for-github-actions/#jobsjob_idif)."
### success
Returns `true` when none of the previous steps have failed or been canceled.
#### Example
```yaml
steps:
...
- name: The job has succeeded
if: {% raw %}${{ success() }}{% endraw %}
```
### always
Causes the step to always execute, and returns `true`, even when canceled. A job or step will not run when a critical failure prevents the task from running. For example, if getting sources failed.
#### Example
```yaml
if: {% raw %}${{ always() }}{% endraw %}
```
### cancelled
Returns `true` if the workflow was canceled.
#### Example
```yaml
if: {% raw %}${{ cancelled() }}{% endraw %}
```
### failure
Returns `true` when any previous step of a job fails.
#### Example
```yaml
steps:
...
- name: The job has failed
if: {% raw %}${{ failure() }}{% endraw %}
```
## Object filters
You can use the `*` syntax to apply a filter and select matching items in a collection.
For example, consider an array of objects named `fruits`.
```json
[
{ "name": "apple", "quantity": 1 },
{ "name": "orange", "quantity": 2 },
{ "name": "pear", "quantity": 1 }
]
```
The filter `fruits.*.name` returns the array `[ "apple", "orange", "pear" ]`

View File

@@ -10,7 +10,6 @@ redirect_from:
- /actions/getting-started-with-github-actions/about-github-actions
- /actions/getting-started-with-github-actions/overview
- /actions/getting-started-with-github-actions/getting-started-with-github-actions
- /articles/migrating-github-actions-from-hcl-syntax-to-yaml-syntax/
- /actions/configuring-and-managing-workflows/configuring-a-workflow
- /articles/creating-a-workflow-with-github-actions/
- /articles/configuring-a-workflow
@@ -24,7 +23,6 @@ redirect_from:
- /actions/automating-your-workflow-with-github-actions/getting-started-with-github-actions
- /actions/configuring-and-managing-workflows
- /articles/getting-started-with-github-actions
- /actions/migrating-to-github-actions
versions:
fpt: '*'
ghes: '*'
@@ -35,11 +33,13 @@ children:
- /essential-features-of-github-actions
- /managing-complex-workflows
- /sharing-workflows-with-your-organization
- /security-hardening-for-github-actions
- /migrating-from-azure-pipelines-to-github-actions
- /migrating-from-circleci-to-github-actions
- /migrating-from-gitlab-cicd-to-github-actions
- /migrating-from-jenkins-to-github-actions
- /migrating-from-travis-ci-to-github-actions
- /using-workflow-templates
- /events-that-trigger-workflows
- /expressions
- /contexts
- /workflow-syntax-for-github-actions
- /workflow-commands-for-github-actions
- /environment-variables
- /usage-limits-billing-and-administration
---

View File

@@ -4,6 +4,7 @@ intro: 'There are usage limits for {% data variables.product.prodname_actions %}
product: '{% data reusables.gated-features.actions %}'
redirect_from:
- /actions/getting-started-with-github-actions/usage-and-billing-information-for-github-actions
- /actions/reference/usage-limits-billing-and-administration
versions:
fpt: '*'
ghes: '*'

View File

@@ -1,13 +1,14 @@
---
title: Setting up continuous integration using workflow templates
shortTitle: Setting up CI using templates
intro: You can set up continuous integration for your project using a workflow template that matches the language and tooling you want to use.
title: Using workflow templates
shortTitle: Using templates
intro: You can set up CI using a workflow template that matches the language and tooling you want to use.
product: '{% data reusables.gated-features.actions %}'
redirect_from:
- /articles/setting-up-continuous-integration-using-github-actions
- /github/automating-your-workflow-with-github-actions/setting-up-continuous-integration-using-github-actions
- /actions/automating-your-workflow-with-github-actions/setting-up-continuous-integration-using-github-actions
- /actions/building-and-testing-code-with-continuous-integration/setting-up-continuous-integration-using-github-actions
- /actions/guides/setting-up-continuous-integration-using-workflow-templates
versions:
fpt: '*'
ghes: '*'

View File

@@ -9,6 +9,7 @@ redirect_from:
- /actions/automating-your-workflow-with-github-actions/development-tools-for-github-actions
- /actions/reference/development-tools-for-github-actions
- /actions/reference/logging-commands-for-github-actions
- /actions/reference/workflow-commands-for-github-actions
versions:
fpt: '*'
ghes: '*'

View File

@@ -7,6 +7,7 @@ redirect_from:
- /articles/workflow-syntax-for-github-actions
- /github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions
- /actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions
- /actions/reference/workflow-syntax-for-github-actions
versions:
fpt: '*'
ghes: '*'
@@ -200,7 +201,7 @@ on:
required: false
```
The triggered workflow receives the inputs in the `github.event.inputs` context. For more information, see "[Context and expression syntax for GitHub Actions](/actions/reference/context-and-expression-syntax-for-github-actions#github-context)."
The triggered workflow receives the inputs in the `github.event.inputs` context. For more information, see "[Contexts](/actions/learn-github-actions/contexts#github-context)."
## `on.schedule`
@@ -273,7 +274,7 @@ defaults:
{% data reusables.actions.concurrency-beta %}
Concurrency ensures that only a single job or workflow using the same concurrency group will run at a time. A concurrency group can be any string or expression. The expression can only use the `github` context. For more information about expressions, see "[Context and expression syntax for {% data variables.product.prodname_actions %}](/actions/reference/context-and-expression-syntax-for-github-actions)."
Concurrency ensures that only a single job or workflow using the same concurrency group will run at a time. A concurrency group can be any string or expression. The expression can only use the [`github` context](/actions/learn-github-actions/contexts#github-context). For more information about expressions, see "[Expressions](/actions/learn-github-actions/expressions)."
You can also specify `concurrency` at the job level. For more information, see [`jobs.<job_id>.concurrency`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#jobsjob_idconcurrency).
@@ -343,7 +344,7 @@ jobs:
needs: [job1, job2]
```
In this example, `job3` uses the `always()` conditional expression so that it always runs after `job1` and `job2` have completed, regardless of whether they were successful. For more information, see "[Context and expression syntax](/actions/reference/context-and-expression-syntax-for-github-actions#job-status-check-functions)."
In this example, `job3` uses the `always()` conditional expression so that it always runs after `job1` and `job2` have completed, regardless of whether they were successful. For more information, see "[Expressions](/actions/learn-github-actions/expressions#job-status-check-functions)."
## `jobs.<job_id>.runs-on`
@@ -446,7 +447,7 @@ environment:
url: https://github.com
```
The URL can be an expression and can use any context except for the `secrets` context. For more information about expressions, see "[Context and expression syntax for {% data variables.product.prodname_actions %}](/actions/reference/context-and-expression-syntax-for-github-actions)."
The URL can be an expression and can use any context except for the [`secrets` context](/actions/learn-github-actions/contexts#contexts). For more information about expressions, see "[Expressions](/actions/learn-github-actions/expressions)."
### Example
{% raw %}
@@ -470,7 +471,7 @@ environment:
{% endnote %}
Concurrency ensures that only a single job or workflow using the same concurrency group will run at a time. A concurrency group can be any string or expression. The expression can use any context except for the `secrets` context. For more information about expressions, see "[Context and expression syntax for {% data variables.product.prodname_actions %}](/actions/reference/context-and-expression-syntax-for-github-actions)."
Concurrency ensures that only a single job or workflow using the same concurrency group will run at a time. A concurrency group can be any string or expression. The expression can use any context except for the `secrets` context. For more information about expressions, see "[Expressions](/actions/learn-github-actions/expressions)."
You can also specify `concurrency` at the workflow level. For more information, see [`concurrency`](/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#concurrency).
@@ -483,7 +484,7 @@ A `map` of outputs for a job. Job outputs are available to all downstream jobs t
Job outputs are strings, and job outputs containing expressions are evaluated on the runner at the end of each job. Outputs containing secrets are redacted on the runner and not sent to {% data variables.product.prodname_actions %}.
To use job outputs in a dependent job, you can use the `needs` context. For more information, see "[Context and expression syntax for {% data variables.product.prodname_actions %}](/actions/reference/context-and-expression-syntax-for-github-actions#needs-context)."
To use job outputs in a dependent job, you can use the `needs` context. For more information, see "[Contexts](/actions/learn-github-actions/contexts#needs-context)."
### Example
@@ -554,7 +555,7 @@ jobs:
You can use the `if` conditional to prevent a job from running unless a condition is met. You can use any supported context and expression to create a conditional.
{% data reusables.github-actions.expression-syntax-if %} For more information, see "[Context and expression syntax for {% data variables.product.prodname_actions %}](/actions/reference/context-and-expression-syntax-for-github-actions)."
{% data reusables.github-actions.expression-syntax-if %} For more information, see "[Expressions](/actions/learn-github-actions/expressions)."
## `jobs.<job_id>.steps`
@@ -588,13 +589,13 @@ jobs:
## `jobs.<job_id>.steps[*].id`
A unique identifier for the step. You can use the `id` to reference the step in contexts. For more information, see "[Context and expression syntax for {% data variables.product.prodname_actions %}](/actions/reference/context-and-expression-syntax-for-github-actions)."
A unique identifier for the step. You can use the `id` to reference the step in contexts. For more information, see "[Contexts](/actions/learn-github-actions/contexts)."
## `jobs.<job_id>.steps[*].if`
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.github-actions.expression-syntax-if %} For more information, see "[Context and expression syntax for {% data variables.product.prodname_actions %}](/actions/reference/context-and-expression-syntax-for-github-actions)."
{% data reusables.github-actions.expression-syntax-if %} For more information, see "[Expressions](/actions/learn-github-actions/expressions)."
### Example: Using contexts
@@ -609,7 +610,7 @@ steps:
### Example: Using status check functions
The `my backup step` only runs when the previous step of a job fails. For more information, see "[Context and expression syntax for {% data variables.product.prodname_actions %}](/actions/reference/context-and-expression-syntax-for-github-actions#job-status-check-functions)."
The `my backup step` only runs when the previous step of a job fails. For more information, see "[Expressions](/actions/learn-github-actions/expressions#job-status-check-functions)."
```yaml
steps:
@@ -963,7 +964,7 @@ Sets environment variables for steps to use in the runner environment. You can a
{% data reusables.repositories.actions-env-var-note %}
Public actions may specify expected environment variables in the README file. If you are setting a secret in an environment variable, you must set secrets using the `secrets` context. For more information, see "[Using environment variables](/actions/automating-your-workflow-with-github-actions/using-environment-variables)" and "[Context and expression syntax for {% data variables.product.prodname_actions %}](/actions/reference/context-and-expression-syntax-for-github-actions)."
Public actions may specify expected environment variables in the README file. If you are setting a secret in an environment variable, you must set secrets using the `secrets` context. For more information, see "[Using environment variables](/actions/automating-your-workflow-with-github-actions/using-environment-variables)" and "[Contexts](/actions/learn-github-actions/contexts)."
### Example
@@ -1002,7 +1003,7 @@ You can define a matrix of different job configurations. A matrix allows you to
{% data reusables.github-actions.usage-matrix-limits %}
Each option you define in the `matrix` has a key and value. The keys you define become properties in the `matrix` context and you can reference the property in other areas of your workflow file. For example, if you define the key `os` that contains an array of operating systems, you can use the `matrix.os` property as the value of the `runs-on` keyword to create a job for each operating system. For more information, see "[Context and expression syntax for {% data variables.product.prodname_actions %}](/actions/reference/context-and-expression-syntax-for-github-actions)."
Each option you define in the `matrix` has a key and value. The keys you define become properties in the `matrix` context and you can reference the property in other areas of your workflow file. For example, if you define the key `os` that contains an array of operating systems, you can use the `matrix.os` property as the value of the `runs-on` keyword to create a job for each operating system. For more information, see "[Contexts](/actions/learn-github-actions/contexts)."
The order that you define a `matrix` matters. The first option you define will be the first job that runs in your workflow.

View File

@@ -2,6 +2,8 @@
title: Adding labels to issues
intro: 'You can use {% data variables.product.prodname_actions %} to automatically label issues.'
product: '{% data reusables.gated-features.actions %}'
redirect_from:
- /actions/guides/adding-labels-to-issues
versions:
fpt: '*'
ghes: '*'

View File

@@ -2,6 +2,8 @@
title: Closing inactive issues
intro: 'You can use {% data variables.product.prodname_actions %} to comment on or close issues that have been inactive for a certain period of time.'
product: '{% data reusables.gated-features.actions %}'
redirect_from:
- /actions/guides/closing-inactive-issues
versions:
fpt: '*'
ghes: '*'

View File

@@ -2,6 +2,8 @@
title: Commenting on an issue when a label is added
intro: 'You can use {% data variables.product.prodname_actions %} to automatically comment on issues when a specific label is applied.'
product: '{% data reusables.gated-features.actions %}'
redirect_from:
- /actions/guides/commenting-on-an-issue-when-a-label-is-added
versions:
fpt: '*'
ghes: '*'

View File

@@ -0,0 +1,17 @@
---
title: Managing issues and pull requests
shortTitle: Managing issues and pull requests
intro: 'You can automatically manage your issues and pull requests using {% data variables.product.prodname_actions %} workflows.'
versions:
fpt: '*'
ghes: '*'
ghae: '*'
children:
- /using-github-actions-for-project-management
- /adding-labels-to-issues
- /closing-inactive-issues
- /commenting-on-an-issue-when-a-label-is-added
- /moving-assigned-issues-on-project-boards
- /removing-a-label-when-a-card-is-added-to-a-project-board-column
- /scheduling-issue-creation
---

View File

@@ -2,6 +2,8 @@
title: Moving assigned issues on project boards
intro: 'You can use {% data variables.product.prodname_actions %} to automatically move an issue to a specific column on a project board when the issue is assigned.'
product: '{% data reusables.gated-features.actions %}'
redirect_from:
- /actions/guides/moving-assigned-issues-on-project-boards
versions:
fpt: '*'
ghes: '*'

View File

@@ -2,6 +2,8 @@
title: Removing a label when a card is added to a project board column
intro: 'You can use {% data variables.product.prodname_actions %} to automatically remove a label when an issue or pull request is added to a specific column on a project board.'
product: '{% data reusables.gated-features.actions %}'
redirect_from:
- /actions/guides/removing-a-label-when-a-card-is-added-to-a-project-board-column
versions:
fpt: '*'
ghes: '*'

View File

@@ -2,6 +2,8 @@
title: Scheduling issue creation
intro: 'You can use {% data variables.product.prodname_actions %} to create an issue on a regular basis for things like daily meetings or quarterly reviews.'
product: '{% data reusables.gated-features.actions %}'
redirect_from:
- /actions/guides/scheduling-issue-creation
versions:
fpt: '*'
ghes: '*'

View File

@@ -2,6 +2,8 @@
title: Using GitHub Actions for project management
intro: 'You can use {% data variables.product.prodname_actions %} to automate many of your project management tasks.'
product: '{% data reusables.gated-features.actions %}'
redirect_from:
- /actions/guides/using-github-actions-for-project-management
versions:
fpt: '*'
ghes: '*'

View File

@@ -0,0 +1,18 @@
---
title: Migrating to GitHub Actions
shortTitle: Migrating to GitHub Actions
intro: 'Learn how to migrate your existing CI/CD workflows to {% data variables.product.prodname_actions %}.'
versions:
fpt: '*'
ghes: '*'
ghae: '*'
redirect_from:
- /actions/migrating-to-github-actions
- /articles/migrating-github-actions-from-hcl-syntax-to-yaml-syntax/
children:
- /migrating-from-azure-pipelines-to-github-actions
- /migrating-from-circleci-to-github-actions
- /migrating-from-gitlab-cicd-to-github-actions
- /migrating-from-jenkins-to-github-actions
- /migrating-from-travis-ci-to-github-actions
---

View File

@@ -3,6 +3,7 @@ title: Migrating from Azure Pipelines to GitHub Actions
intro: '{% data variables.product.prodname_actions %} and Azure Pipelines share several configuration similarities, which makes migrating to {% data variables.product.prodname_actions %} relatively straightforward.'
redirect_from:
- /actions/migrating-to-github-actions/migrating-from-azure-pipelines-to-github-actions
- /actions/learn-github-actions/migrating-from-azure-pipelines-to-github-actions
versions:
fpt: '*'
ghes: '*'
@@ -203,7 +204,7 @@ jobs:
</tr>
</table>
For more information, see "[Context and expression syntax for {% data variables.product.prodname_actions %}](/actions/reference/context-and-expression-syntax-for-github-actions)."
For more information, see "[Expressions](/actions/learn-github-actions/expressions)."
## Dependencies between jobs

View File

@@ -3,6 +3,7 @@ title: Migrating from CircleCI to GitHub Actions
intro: 'GitHub Actions and CircleCI share several similarities in configuration, which makes migration to GitHub Actions relatively straightforward.'
redirect_from:
- /actions/migrating-to-github-actions/migrating-from-circleci-to-github-actions
- /actions/learn-github-actions/migrating-from-circleci-to-github-actions
versions:
fpt: '*'
ghes: '*'

View File

@@ -1,6 +1,8 @@
---
title: Migrating from GitLab CI/CD to GitHub Actions
intro: '{% data variables.product.prodname_actions %} and GitLab CI/CD share several configuration similarities, which makes migrating to {% data variables.product.prodname_actions %} relatively straightforward.'
redirect_from:
- /actions/learn-github-actions/migrating-from-gitlab-cicd-to-github-actions
versions:
fpt: '*'
ghes: '*'
@@ -210,7 +212,7 @@ jobs:
</tr>
</table>
For more information, see "[Context and expression syntax for {% data variables.product.prodname_actions %}](/actions/reference/context-and-expression-syntax-for-github-actions)."
For more information, see "[Expressions](/actions/learn-github-actions/expressions)."
## Dependencies between Jobs

View File

@@ -3,6 +3,7 @@ title: Migrating from Jenkins to GitHub Actions
intro: '{% data variables.product.prodname_actions %} and Jenkins share multiple similarities, which makes migration to {% data variables.product.prodname_actions %} relatively straightforward.'
redirect_from:
- /actions/migrating-to-github-actions/migrating-from-jenkins-to-github-actions
- /actions/learn-github-actions/migrating-from-jenkins-to-github-actions
versions:
fpt: '*'
ghes: '*'

View File

@@ -3,6 +3,7 @@ title: Migrating from Travis CI to GitHub Actions
intro: '{% data variables.product.prodname_actions %} and Travis CI share multiple similarities, which helps make it relatively straightforward to migrate to {% data variables.product.prodname_actions %}.'
redirect_from:
- /actions/migrating-to-github-actions/migrating-from-travis-ci-to-github-actions
- /actions/learn-github-actions/migrating-from-travis-ci-to-github-actions
versions:
fpt: '*'
ghes: '*'
@@ -238,7 +239,7 @@ When migrating to {% data variables.product.prodname_actions %}, there are diffe
## Migrating syntax for conditionals and expressions
To run jobs under conditional expressions, Travis CI and {% data variables.product.prodname_actions %} share a similar `if` condition syntax. {% data variables.product.prodname_actions %} lets you use the `if` conditional to prevent a job or step from running unless a condition is met. For more information, see "[Context and expression syntax for {% data variables.product.prodname_actions %}](/actions/reference/context-and-expression-syntax-for-github-actions)."
To run jobs under conditional expressions, Travis CI and {% data variables.product.prodname_actions %} share a similar `if` condition syntax. {% data variables.product.prodname_actions %} lets you use the `if` conditional to prevent a job or step from running unless a condition is met. For more information, see "[Expressions](/actions/learn-github-actions/expressions)."
This example demonstrates how an `if` conditional can control whether a step is executed:

View File

@@ -5,6 +5,7 @@ product: '{% data reusables.gated-features.actions %}'
redirect_from:
- /actions/automating-your-workflow-with-github-actions/about-packaging-with-github-actions
- /actions/publishing-packages-with-github-actions/about-packaging-with-github-actions
- /actions/guides/about-packaging-with-github-actions
versions:
fpt: '*'
ghes: '*'

View File

@@ -0,0 +1,18 @@
---
title: Publishing packages
shortTitle: Publishing packages
intro: 'You can automatically publish packages using {% data variables.product.prodname_actions %}.'
versions:
fpt: '*'
ghes: '*'
ghae: '*'
redirect_from:
- /actions/publishing-packages-with-github-actions
children:
- /about-packaging-with-github-actions
- /publishing-docker-images
- /publishing-java-packages-with-gradle
- /publishing-java-packages-with-maven
- /publishing-nodejs-packages
---

View File

@@ -4,6 +4,7 @@ intro: 'You can publish Docker images to a registry, such as Docker Hub or {% da
product: '{% data reusables.gated-features.actions %}'
redirect_from:
- /actions/language-and-framework-guides/publishing-docker-images
- /actions/guides/publishing-docker-images
versions:
fpt: '*'
ghes: '*'
@@ -114,7 +115,7 @@ In the example workflow below, we use the Docker `login-action`{% ifversion fpt
The `login-action` options required for {% data variables.product.prodname_registry %} are:
* `registry`: Must be set to {% ifversion fpt %}`ghcr.io`{% else %}`docker.pkg.github.com`{% endif %}.
* `username`: You can use the {% raw %}`${{ github.actor }}`{% endraw %} context to automatically use the username of the user that triggered the workflow run. For more information, see "[Context and expression syntax for GitHub Actions](/actions/reference/context-and-expression-syntax-for-github-actions#github-context)."
* `username`: You can use the {% raw %}`${{ github.actor }}`{% endraw %} context to automatically use the username of the user that triggered the workflow run. For more information, see "[Contexts](/actions/learn-github-actions/contexts#github-context)."
* `password`: You can use the automatically-generated `GITHUB_TOKEN` secret for the password. For more information, see "[Authenticating with the GITHUB_TOKEN](/actions/automating-your-workflow-with-github-actions/authenticating-with-the-github_token)."
{% ifversion fpt %}

View File

@@ -4,6 +4,7 @@ intro: You can use Gradle to publish Java packages to a registry as part of your
product: '{% data reusables.gated-features.actions %}'
redirect_from:
- /actions/language-and-framework-guides/publishing-java-packages-with-gradle
- /actions/guides/publishing-java-packages-with-gradle
versions:
fpt: '*'
ghes: '*'

View File

@@ -4,6 +4,7 @@ intro: You can use Maven to publish Java packages to a registry as part of your
product: '{% data reusables.gated-features.actions %}'
redirect_from:
- /actions/language-and-framework-guides/publishing-java-packages-with-maven
- /actions/guides/publishing-java-packages-with-maven
versions:
fpt: '*'
ghes: '*'

View File

@@ -5,6 +5,7 @@ product: '{% data reusables.gated-features.actions %}'
redirect_from:
- /actions/automating-your-workflow-with-github-actions/publishing-nodejs-packages
- /actions/language-and-framework-guides/publishing-nodejs-packages
- /actions/guides/publishing-nodejs-packages
versions:
fpt: '*'
ghes: '*'

View File

@@ -90,4 +90,3 @@ The example workflow you just added runs each time code is pushed to the branch,
{% data variables.product.prodname_actions %} can help you automate nearly every aspect of your application development processes. Ready to get started? Here are some helpful resources for taking your next steps with {% data variables.product.prodname_actions %}:
- "[Learn {% data variables.product.prodname_actions %}](/actions/learn-github-actions)" for an in-depth tutorial.
- "[Guides](/actions/guides)" for specific uses cases and examples.

View File

@@ -1,43 +0,0 @@
---
title: Reference
intro: 'Reference documentation for creating workflows, using GitHub-hosted runners, and authentication.'
redirect_from:
- /actions/configuring-and-managing-workflows/using-variables-and-secrets-in-a-workflow
versions:
fpt: '*'
ghes: '*'
ghae: '*'
children:
- /workflow-syntax-for-github-actions
- /context-and-expression-syntax-for-github-actions
- /workflow-commands-for-github-actions
- /events-that-trigger-workflows
- /authentication-in-a-workflow
- /encrypted-secrets
- /environments
- /environment-variables
- /usage-limits-billing-and-administration
---
{% data reusables.actions.enterprise-beta %}
{% data reusables.actions.enterprise-github-hosted-runners %}
{% data reusables.actions.ae-beta %}
## Workflow syntax
The workflow file is written in YAML. In the YAML workflow file, you can use expression syntax to evaluate contextual information, literals, operators, and functions. Contextual information includes workflow, environment variables, secrets, and the events that triggered the workflow. When you use [`run`](/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsrun) in a workflow step to run shell commands, you can use specific workflow command syntax to set environment variables, set output parameters for subsequent steps, and set error or debug messages.
## Events
You can configure workflows to run when specific GitHub events occur, at a scheduled time, manually, or when events outside of GitHub occur.
## Authentication and secrets
{% data variables.product.prodname_dotcom %} provides a token that you can use to authenticate on behalf of {% data variables.product.prodname_actions %}. You can also store sensitive information as a secret in your organization{% ifversion fpt or ghes > 3.0 or ghae %}, repository, or environments{% else %} or repository{% endif %}. {% data variables.product.prodname_dotcom %} encrypts all secrets.
{% ifversion fpt or ghes > 3.0 or ghae %}
## Environments
Workflow jobs can reference environments that have protection rules or environment-specific secrets.
{% endif %}
## Environment variables
{% data variables.product.prodname_dotcom %} sets default environment variables for each {% data variables.product.prodname_actions %} workflow run. You can also set custom environment variables in your workflow file.
{% ifversion fpt %}
## Administration
When you run workflows on {% data variables.product.prodname_dotcom %}-hosted runners, there are usage limits and potential usage charges. You can also disable or restrict the usage of {% data variables.product.prodname_actions %} in a repository and organization.
{% endif %}

View File

@@ -1,16 +1,17 @@
---
title: Authentication in a workflow
title: Automatic token authentication
intro: '{% data variables.product.prodname_dotcom %} provides a token that you can use to authenticate on behalf of {% data variables.product.prodname_actions %}.'
product: '{% data reusables.gated-features.actions %}'
redirect_from:
- /github/automating-your-workflow-with-github-actions/authenticating-with-the-github_token
- /actions/automating-your-workflow-with-github-actions/authenticating-with-the-github_token
- /actions/configuring-and-managing-workflows/authenticating-with-the-github_token
- /actions/reference/authentication-in-a-workflow
versions:
fpt: '*'
ghes: '*'
ghae: '*'
shortTitle: Authentication in a workflow
shortTitle: Automatic token authentication
---
{% data reusables.actions.enterprise-beta %}
@@ -25,7 +26,7 @@ When you enable {% data variables.product.prodname_actions %}, {% data variables
Before each job begins, {% data variables.product.prodname_dotcom %} fetches an installation access token for the job. The token expires when the job is finished.
The token is also available in the `github.token` context. For more information, see "[Context and expression syntax for {% data variables.product.prodname_actions %}](/actions/reference/context-and-expression-syntax-for-github-actions#github-context)."
The token is also available in the `github.token` context. For more information, see "[Contexts](/actions/learn-github-actions/contexts#github-context)."
## Using the `GITHUB_TOKEN` in a workflow

View File

@@ -6,6 +6,8 @@ redirect_from:
- /github/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets
- /actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets
- /actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets
- /actions/configuring-and-managing-workflows/using-variables-and-secrets-in-a-workflow
- /actions/reference/encrypted-secrets
versions:
fpt: '*'
ghes: '*'
@@ -221,7 +223,7 @@ You can check which access policies are being applied to a secret in your organi
{% endnote %}
To provide an action with a secret as an input or environment variable, you can use the `secrets` context to access secrets you've created in your repository. For more information, see "[Context and expression syntax for {% data variables.product.prodname_actions %}](/actions/reference/context-and-expression-syntax-for-github-actions)" and "[Workflow syntax for {% data variables.product.prodname_actions %}](/github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions)."
To provide an action with a secret as an input or environment variable, you can use the `secrets` context to access secrets you've created in your repository. For more information, see "[Contexts](/actions/learn-github-actions/contexts)" and "[Workflow syntax for {% data variables.product.prodname_actions %}](/github/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions)."
{% raw %}
```yaml

View File

@@ -0,0 +1,14 @@
---
title: Security guides
shortTitle: Security guides
intro: 'Security hardening and good practices for {% data variables.product.prodname_actions %}.'
versions:
fpt: '*'
ghes: '*'
ghae: '*'
children:
- /security-hardening-for-github-actions
- /encrypted-secrets
- /automatic-token-authentication
---

View File

@@ -5,6 +5,7 @@ intro: 'Good security practices for using {% data variables.product.prodname_act
product: '{% data reusables.gated-features.actions %}'
redirect_from:
- /actions/getting-started-with-github-actions/security-hardening-for-github-actions
- /actions/learn-github-actions/security-hardening-for-github-actions
versions:
fpt: '*'
ghes: '*'
@@ -41,7 +42,7 @@ To help prevent accidental disclosure, {% data variables.product.product_name %}
- 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 youre 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.
- **Use credentials that are minimally scoped**
- Make sure the credentials being used within workflows have the least privileges required, and be mindful that any user with write access to your repository has read access to all secrets configured in your repository. {% ifversion fpt or ghes > 3.1 or ghae-next %}
- Actions can use the `GITHUB_TOKEN` by accessing it from the `github.token` context. For more information, see "[Context and expression syntax for {% data variables.product.prodname_actions %}](/actions/reference/context-and-expression-syntax-for-github-actions#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 "[Authentication in a workflow](/actions/reference/authentication-in-a-workflow#permissions-for-the-github_token)." {% endif %}
- Actions can use the `GITHUB_TOKEN` by accessing it from the `github.token` context. For more information, see "[Contexts](/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 "[Authentication in a workflow](/actions/reference/authentication-in-a-workflow#permissions-for-the-github_token)." {% endif %}
- **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.

View File

@@ -5,6 +5,7 @@ product: '{% data reusables.gated-features.actions %}'
redirect_from:
- /actions/automating-your-workflow-with-github-actions/about-service-containers
- /actions/configuring-and-managing-workflows/about-service-containers
- /actions/guides/about-service-containers
versions:
fpt: '*'
ghes: '*'
@@ -87,7 +88,7 @@ You can map service containers ports to the Docker host using the `ports` keywor
When you map ports using the `ports` keyword, {% data variables.product.prodname_dotcom %} uses the `--publish` command to publish the containers ports to the Docker host. For more information, see "[Docker container networking](https://docs.docker.com/config/containers/container-networking/)" in the Docker documentation.
When you specify the Docker host port but not the container port, the container port is randomly assigned to a free port. {% data variables.product.prodname_dotcom %} sets the assigned container port in the service container context. For example, for a `redis` service container, if you configured the Docker host port 5432, you can access the corresponding container port using the `job.services.redis.ports[5432]` context. For more information, see "[Context and expression syntax for {% data variables.product.prodname_actions %}](/actions/reference/context-and-expression-syntax-for-github-actions#job-context)."
When you specify the Docker host port but not the container port, the container port is randomly assigned to a free port. {% data variables.product.prodname_dotcom %} sets the assigned container port in the service container context. For example, for a `redis` service container, if you configured the Docker host port 5432, you can access the corresponding container port using the `job.services.redis.ports[5432]` context. For more information, see "[Contexts](/actions/learn-github-actions/contexts#job-context)."
### Example mapping Redis ports

View File

@@ -6,6 +6,7 @@ product: '{% data reusables.gated-features.actions %}'
redirect_from:
- /actions/automating-your-workflow-with-github-actions/creating-postgresql-service-containers
- /actions/configuring-and-managing-workflows/creating-postgresql-service-containers
- /actions/guides/creating-postgresql-service-containers
versions:
fpt: '*'
ghes: '*'

View File

@@ -6,6 +6,7 @@ product: '{% data reusables.gated-features.actions %}'
redirect_from:
- /actions/automating-your-workflow-with-github-actions/creating-redis-service-containers
- /actions/configuring-and-managing-workflows/creating-redis-service-containers
- /actions/guides/creating-redis-service-containers
versions:
fpt: '*'
ghes: '*'

View File

@@ -0,0 +1,18 @@
---
title: Using containerized services
shortTitle: Containerized services
intro: 'You can use containerized services in your {% data variables.product.prodname_actions %} workflows.'
versions:
fpt: '*'
ghes: '*'
ghae: '*'
redirect_from:
- /actions/automating-your-workflow-with-github-actions/using-databases-and-services
- /actions/configuring-and-managing-workflows/using-databases-and-service-containers
- /actions/guides/using-databases-and-service-containers
children:
- /about-service-containers
- /creating-postgresql-service-containers
- /creating-redis-service-containers
---

View File

@@ -5,6 +5,7 @@ product: '{% data reusables.gated-features.saml-sso %}'
redirect_from:
- /articles/about-authentication-with-saml-single-sign-on
- /github/authenticating-to-github/about-authentication-with-saml-single-sign-on
- /github/authenticating-to-github/authenticating-with-saml-single-sign-on/about-authentication-with-saml-single-sign-on
versions:
fpt: '*'
ghae: '*'

View File

@@ -5,6 +5,7 @@ redirect_from:
- /articles/authorizing-a-personal-access-token-for-use-with-a-saml-single-sign-on-organization/
- /articles/authorizing-a-personal-access-token-for-use-with-saml-single-sign-on
- /github/authenticating-to-github/authorizing-a-personal-access-token-for-use-with-saml-single-sign-on
- /github/authenticating-to-github/authenticating-with-saml-single-sign-on/authorizing-a-personal-access-token-for-use-with-saml-single-sign-on
versions:
fpt: '*'
topics:

View File

@@ -5,6 +5,7 @@ redirect_from:
- /articles/authorizing-an-ssh-key-for-use-with-a-saml-single-sign-on-organization/
- /articles/authorizing-an-ssh-key-for-use-with-saml-single-sign-on
- /github/authenticating-to-github/authorizing-an-ssh-key-for-use-with-saml-single-sign-on
- /github/authenticating-to-github/authenticating-with-saml-single-sign-on/authorizing-an-ssh-key-for-use-with-saml-single-sign-on
versions:
fpt: '*'
topics:

View File

@@ -5,6 +5,7 @@ product: '{% data reusables.gated-features.saml-sso %}'
redirect_from:
- /articles/authenticating-to-a-github-organization-with-saml-single-sign-on/
- /articles/authenticating-with-saml-single-sign-on
- /github/authenticating-to-github/authenticating-with-saml-single-sign-on/
versions:
fpt: '*'
ghae: '*'

View File

@@ -4,6 +4,7 @@ intro: You can view and revoke your active SAML sessions in your security settin
redirect_from:
- /articles/viewing-and-managing-your-active-saml-sessions
- /github/authenticating-to-github/viewing-and-managing-your-active-saml-sessions
- /github/authenticating-to-github/authenticating-with-saml-single-sign-on/viewing-and-managing-your-active-saml-sessions
versions:
fpt: '*'
topics:

View File

@@ -4,6 +4,7 @@ intro: 'Using the SSH protocol, you can connect and authenticate to remote serve
redirect_from:
- /articles/about-ssh
- /github/authenticating-to-github/about-ssh
- /github/authenticating-to-github/connecting-to-github-with-ssh/about-ssh
versions:
fpt: '*'
ghes: '*'

View File

@@ -4,6 +4,7 @@ intro: 'To configure your {% data variables.product.product_name %} account to u
redirect_from:
- /articles/adding-a-new-ssh-key-to-your-github-account
- /github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account
- /github/authenticating-to-github/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account
versions:
fpt: '*'
ghes: '*'

View File

@@ -4,6 +4,7 @@ intro: 'Before you generate an SSH key, you can check to see if you have any exi
redirect_from:
- /articles/checking-for-existing-ssh-keys
- /github/authenticating-to-github/checking-for-existing-ssh-keys
- /github/authenticating-to-github/connecting-to-github-with-ssh/checking-for-existing-ssh-keys
versions:
fpt: '*'
ghes: '*'

View File

@@ -6,6 +6,7 @@ redirect_from:
- /articles/generating-a-new-ssh-key/
- /articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
- /github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
- /github/authenticating-to-github/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent
versions:
fpt: '*'
ghes: '*'

View File

@@ -10,6 +10,7 @@ redirect_from:
- /articles/generating-ssh-keys/
- /articles/generating-an-ssh-key/
- /articles/connecting-to-github-with-ssh
- /github/authenticating-to-github/connecting-to-github-with-ssh/
versions:
fpt: '*'
ghes: '*'

View File

@@ -4,6 +4,7 @@ intro: 'After you''ve set up your SSH key and added it to your {% data variables
redirect_from:
- /articles/testing-your-ssh-connection
- /github/authenticating-to-github/testing-your-ssh-connection
- /github/authenticating-to-github/connecting-to-github-with-ssh/testing-your-ssh-connection
versions:
fpt: '*'
ghes: '*'

View File

@@ -6,6 +6,7 @@ redirect_from:
- /working-with-key-passphrases/
- /articles/working-with-ssh-key-passphrases
- /github/authenticating-to-github/working-with-ssh-key-passphrases
- /github/authenticating-to-github/connecting-to-github-with-ssh/working-with-ssh-key-passphrases
versions:
fpt: '*'
ghes: '*'

View File

@@ -1,6 +1,5 @@
---
title: Authenticating to GitHub
shortTitle: Authentication
title: Authentication
intro: 'Keep your account and data secure with features like {% ifversion not ghae %}two-factor authentication, {% endif %}SSH{% ifversion not ghae %},{% endif %} and commit signature verification.'
redirect_from:
- /categories/56/articles/
@@ -13,6 +12,7 @@ redirect_from:
- /categories/gpg/
- /categories/security/
- /categories/authenticating-to-github
- /github/authenticating-to-github/
versions:
fpt: '*'
ghes: '*'

View File

@@ -6,6 +6,7 @@ redirect_from:
- /articles/about-anonymized-image-urls
- /authenticating-to-github/about-anonymized-image-urls
- /github/authenticating-to-github/about-anonymized-urls
- /github/authenticating-to-github/keeping-your-account-and-data-secure/about-anonymized-urls
versions:
fpt: '*'
topics:

View File

@@ -10,6 +10,7 @@ topics:
- Access management
redirect_from:
- /github/authenticating-to-github/about-authentication-to-github
- /github/authenticating-to-github/keeping-your-account-and-data-secure/about-authentication-to-github
shortTitle: Authentication to GitHub
---
## About authentication to {% data variables.product.prodname_dotcom %}

View File

@@ -9,6 +9,7 @@ redirect_from:
- /articles/about-github-s-ip-addresses
- /articles/about-githubs-ip-addresses
- /github/authenticating-to-github/about-githubs-ip-addresses
- /github/authenticating-to-github/keeping-your-account-and-data-secure/about-githubs-ip-addresses
versions:
fpt: '*'
topics:

View File

@@ -8,6 +8,8 @@ versions:
topics:
- Identity
- Access management
redirect_from:
- /github/authenticating-to-github/keeping-your-account-and-data-secure/authorizing-github-apps
---
Third-party applications that need to verify your {% data variables.product.prodname_dotcom %} identity, or interact with the data on {% data variables.product.prodname_dotcom %} on your behalf, can ask you to authorize the {% data variables.product.prodname_github_app %} to do so.

View File

@@ -4,6 +4,7 @@ intro: 'You can connect your {% data variables.product.product_name %} identity
redirect_from:
- /articles/authorizing-oauth-apps
- /github/authenticating-to-github/authorizing-oauth-apps
- /github/authenticating-to-github/keeping-your-account-and-data-secure/authorizing-oauth-apps
versions:
fpt: '*'
ghes: '*'

View File

@@ -4,6 +4,7 @@ intro: 'You can connect your {% data variables.product.product_name %} identity
redirect_from:
- /articles/connecting-with-third-party-applications
- /github/authenticating-to-github/connecting-with-third-party-applications
- /github/authenticating-to-github/keeping-your-account-and-data-secure/connecting-with-third-party-applications
versions:
fpt: '*'
ghes: '*'

View File

@@ -7,6 +7,7 @@ redirect_from:
- /articles/creating-a-personal-access-token-for-the-command-line
- /github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line
- /github/authenticating-to-github/creating-a-personal-access-token
- /github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token
versions:
fpt: '*'
ghes: '*'

View File

@@ -5,6 +5,7 @@ redirect_from:
- /articles/what-is-a-strong-password/
- /articles/creating-a-strong-password
- /github/authenticating-to-github/creating-a-strong-password
- /github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-strong-password
versions:
fpt: '*'
ghes: '*'

View File

@@ -6,6 +6,7 @@ redirect_from:
- /articles/github-s-ssh-key-fingerprints
- /articles/githubs-ssh-key-fingerprints
- /github/authenticating-to-github/githubs-ssh-key-fingerprints
- /github/authenticating-to-github/keeping-your-account-and-data-secure/githubs-ssh-key-fingerprints
versions:
fpt: '*'
topics:

View File

@@ -3,6 +3,7 @@ title: Keeping your account and data secure
intro: 'To protect your personal information, you should keep both your {% data variables.product.product_name %} account and any associated data secure.'
redirect_from:
- /articles/keeping-your-account-and-data-secure
- /github/authenticating-to-github/keeping-your-account-and-data-secure/
versions:
fpt: '*'
ghes: '*'

View File

@@ -4,6 +4,7 @@ intro: 'You may be alerted to a security incident in the media, such as the disc
redirect_from:
- /articles/preventing-unauthorized-access
- /github/authenticating-to-github/preventing-unauthorized-access
- /github/authenticating-to-github/keeping-your-account-and-data-secure/preventing-unauthorized-access
versions:
fpt: '*'
ghes: '*'

View File

@@ -7,6 +7,7 @@ redirect_from:
- /articles/remove-sensitive-data/
- /articles/removing-sensitive-data-from-a-repository
- /github/authenticating-to-github/removing-sensitive-data-from-a-repository
- /github/authenticating-to-github/keeping-your-account-and-data-secure/removing-sensitive-data-from-a-repository
versions:
fpt: '*'
ghes: '*'

Some files were not shown because too many files have changed in this diff Show More