Skip to content

Commit 9c3539f

Browse files
authored
Merge pull request #5528 from github/repo-sync
repo sync
2 parents 7464453 + 134e930 commit 9c3539f

File tree

4 files changed

+66
-1
lines changed

4 files changed

+66
-1
lines changed

content/actions/reference/environments.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ For more information on syntax to reference environments in workflows, see "[Wor
7171

7272
When a workflow references an environment, the environment will appear in the repository's deployments. For more information about viewing current and previous deployments, see "[Viewing deployment history](/developers/overview/viewing-deployment-history)."
7373

74+
### Using concurrency to serialize deployments in an environment
75+
You can use concurrency so that an environment has a maximum of one deployment in progress and one deployment pending at a time. For more information, see "[Workflow syntax for GitHub Actions](/actions/reference/workflow-syntax-for-github-actions#concurrency)."
76+
7477
### Deleting an environment
7578

7679
{% data reusables.github-actions.permissions-statement-environment %}

content/actions/reference/workflow-syntax-for-github-actions.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,18 @@ defaults:
221221
working-directory: scripts
222222
```
223223

224+
{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@3.0" or currentVersion == "github-ae@next" %}
225+
### `concurrency`
226+
227+
{% data reusables.actions.concurrency-beta %}
228+
229+
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)."
230+
231+
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).
232+
233+
{% data reusables.actions.actions-group-concurrency %}
234+
235+
{% endif %}
224236
### `jobs`
225237

226238
A workflow run is made up of one or more jobs. Jobs run in parallel by default. To run jobs sequentially, you can define dependencies on other jobs using the `jobs.<job_id>.needs` keyword.
@@ -347,10 +359,11 @@ The environment that the job references. All environment protection rules must p
347359
You can provide the environment as only the environment `name`, or as an environment object with the `name` and `url`. The URL maps to `environment_url` in the deployments API. For more information about the deployments API, see "[Deployments](/rest/reference/repos#deployments)."
348360

349361
##### Example using a single environment name
350-
362+
{% raw %}
351363
```yaml
352364
environment: staging_environment
353365
```
366+
{% endraw %}
354367

355368
##### Example using environment name and URL
356369

@@ -372,6 +385,25 @@ environment:
372385
{% endraw %}
373386
{% endif %}
374387

388+
389+
{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@3.0" or currentVersion == "github-ae@next" %}
390+
### `jobs.<job_id>.concurrency`
391+
392+
{% data reusables.actions.concurrency-beta %}
393+
394+
{% note %}
395+
396+
**Note:** When concurrency is specified at the job level, order is not guaranteed for jobs or runs that queue within 5 minutes of each other.
397+
398+
{% endnote %}
399+
400+
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)."
401+
402+
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).
403+
404+
{% data reusables.actions.actions-group-concurrency %}
405+
406+
{% endif %}
375407
### `jobs.<job_id>.outputs`
376408

377409
A `map` of outputs for a job. Job outputs are available to all downstream jobs that depend on this job. For more information on defining job dependencies, see [`jobs.<job_id>.needs`](#jobsjob_idneeds).
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
When a concurrent job or workflow is queued, if another job or workflow using the same concurrency group in the repository is in progress, the queued job or workflow will be `pending`. Any previously pending job or workflow in the concurrency group will be canceled. To also cancel any currently running job or workflow in the same concurrency group, specify `cancel-in-progress: true`.
2+
3+
##### Examples using concurrency and the default behavior
4+
5+
{% raw %}
6+
```yaml
7+
concurrency: staging_environment
8+
```
9+
{% endraw %}
10+
11+
{% raw %}
12+
```yaml
13+
concurrency: ci-${{ github.ref }}
14+
```
15+
{% endraw %}
16+
17+
##### Example using concurrency to cancel any in-progress job or run
18+
19+
{% raw %}
20+
```yaml
21+
concurrency:
22+
group: ${{ github.head_ref }}
23+
cancel-in-progress: true
24+
```
25+
{% endraw %}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{% note %}
2+
3+
**Note:** Concurrency is currently in beta and subject to change.
4+
5+
{% endnote %}

0 commit comments

Comments
 (0)