Skip to content

Commit 40d6221

Browse files
authored
Merge branch 'main' into repo-sync
2 parents 8b74b69 + 045d909 commit 40d6221

6 files changed

Lines changed: 73 additions & 7 deletions

File tree

content/actions/creating-actions/metadata-syntax-for-github-actions.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ runs:
175175

176176
### `pre-if`
177177

178-
**Optional** Allows you to define conditions for the `pre:` action execution. The `pre:` action will only run if the conditions in `pre-if` are met. If not set, then `pre-if` defaults to `always()`.
178+
**Optional** Allows you to define conditions for the `pre:` action execution. The `pre:` action will only run if the conditions in `pre-if` are met. If not set, then `pre-if` defaults to `always()`. In `pre-if`, status check functions evaluate against the job's status, not the action's own status.
179+
179180
Note that the `step` context is unavailable, as no steps have run yet.
180181

181182
In this example, `cleanup.js` only runs on Linux-based runners:
@@ -202,7 +203,7 @@ The `post:` action always runs by default but you can override this using `post-
202203

203204
### `post-if`
204205

205-
**Optional** Allows you to define conditions for the `post:` action execution. The `post:` action will only run if the conditions in `post-if` are met. If not set, then `post-if` defaults to `always()`.
206+
**Optional** Allows you to define conditions for the `post:` action execution. The `post:` action will only run if the conditions in `post-if` are met. If not set, then `post-if` defaults to `always()`. In `post-if`, status check functions evaluate against the job's status, not the action's own status.
206207

207208
For example, this `cleanup.js` will only run on Linux-based runners:
208209

@@ -265,6 +266,35 @@ For more information, see "[`github context`](/actions/reference/context-and-exp
265266
**Required** The shell where you want to run the command. You can use any of the shells listed [here](/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepsshell). Required if `run` is set.
266267
{% endif %}
267268

269+
#### `runs.steps[*].if`
270+
271+
**Optional** You can use the `if` conditional to prevent a step from running unless a condition is met. You can use any supported context and expression to create a conditional.
272+
273+
{% data reusables.github-actions.expression-syntax-if %} For more information, see "[Expressions](/actions/learn-github-actions/expressions)."
274+
275+
**Example: Using contexts**
276+
277+
This step only runs when the event type is a `pull_request` and the event action is `unassigned`.
278+
279+
```yaml
280+
steps:
281+
- run: echo This event is a pull request that had an assignee removed.
282+
if: {% raw %}${{ github.event_name == 'pull_request' && github.event.action == 'unassigned' }}{% endraw %}
283+
```
284+
285+
**Example: Using status check functions**
286+
287+
The `my backup step` only runs when the previous step of a composite action fails. For more information, see "[Expressions](/actions/learn-github-actions/expressions#job-status-check-functions)."
288+
289+
```yaml
290+
steps:
291+
- name: My first step
292+
uses: octo-org/action-name@main
293+
- name: My backup step
294+
if: {% raw %}${{ failure() }}{% endraw %}
295+
uses: actions/heroku@1.0.0
296+
```
297+
268298
#### `runs.steps[*].name`
269299

270300
**Optional** The name of the composite step.

content/actions/learn-github-actions/expressions.md

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,9 @@ Creates a hash for any `package-lock.json` and `Gemfile.lock` files in the repos
266266

267267
`hashFiles('**/package-lock.json', '**/Gemfile.lock')`
268268

269-
## Job status check functions
269+
## Status check functions
270270

271-
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)."
271+
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)" and "[Metadata syntax for GitHub Composite Actions](/actions/creating-actions/metadata-syntax-for-github-actions/#runsstepsif)".
272272

273273
### success
274274

@@ -316,6 +316,32 @@ steps:
316316
if: {% raw %}${{ failure() }}{% endraw %}
317317
```
318318

319+
### Evaluate Status Explicitly
320+
321+
Instead of using one of the methods above, you can evaluate the status of the job or composite action that is executing the step directly:
322+
323+
#### Example for workflow step
324+
325+
```yaml
326+
steps:
327+
...
328+
- name: The job has failed
329+
if: {% raw %}${{ job.status == 'failure' }}{% endraw %}
330+
```
331+
332+
This is the same as using `if: failure()` in a job step.
333+
334+
#### Example for composite action step
335+
336+
```yaml
337+
steps:
338+
...
339+
- name: The composite action has failed
340+
if: {% raw %}${{ github.action_status == 'failure' }}{% endraw %}
341+
```
342+
343+
This is the same as using `if: failure()` in a composite action step.
344+
319345
## Object filters
320346

321347
You can use the `*` syntax to apply a filter and select matching items in a collection.

content/get-started/quickstart/set-up-git.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@ If you don't need to work with files locally, {% data variables.product.product_
4040
## Setting up Git
4141

4242
1. [Download and install the latest version of Git](https://git-scm.com/downloads).
43+
44+
{% note %}
45+
46+
**Note**: If you are using a Chrome OS device, additional set up is required:
47+
48+
1. Install a terminal emulator such as Termux from the Google Play Store on your Chrome OS device.
49+
2. From the terminal emulator that you installed, install Git. For example, in Termux, enter `apt install git` and then type `y` when prompted.
50+
51+
{% endnote %}
52+
4353
2. [Set your username in Git](/github/getting-started-with-github/setting-your-username-in-git).
4454
3. [Set your commit email address in Git](/articles/setting-your-commit-email-address).
4555

data/reusables/actions/actions-group-concurrency.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ concurrency: ci-${{ github.ref }}
1919
{% raw %}
2020
```yaml
2121
concurrency:
22-
group: ${{ github.head_ref }}
22+
group: ${{ github.ref }}
2323
cancel-in-progress: true
2424
```
2525
{% endraw %}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
Key | Type | Description
22
----|------|-------------
3-
`action`|`string` | The action that was performed. Can be one of `opened`, `closed`, `reopened`, `assigned`, `unassigned`, `labeled`, or `unlabeled`.
3+
`action`|`string` | The action that was performed. Can be one of `opened`, `edited`, `closed`, `reopened`, `assigned`, `unassigned`, `labeled`, or `unlabeled`.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
Key | Type | Description
22
----|------|-------------
3-
`action`|`string` | The action that was performed. Can be one of `opened`, `closed`, `reopened`, `assigned`, `unassigned`, `review_requested`, `review_request_removed`, `labeled`, `unlabeled`, and `synchronize`.
3+
`action`|`string` | The action that was performed. Can be one of `opened`, `edited`, `closed`, `reopened`, `assigned`, `unassigned`, `review_requested`, `review_request_removed`, `labeled`, `unlabeled`, and `synchronize`.

0 commit comments

Comments
 (0)