Skip to content

Commit

Permalink
Merge pull request github#15818 from github/repo-sync
Browse files Browse the repository at this point in the history
repo sync
  • Loading branch information
Octomerger authored Feb 24, 2022
2 parents 521da8d + 1b22582 commit 82cafa0
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions content/actions/using-workflows/events-that-trigger-workflows.md
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,25 @@ on:

{% endnote %}

#### Running your workflow when a pull request merges

When a pull request merges, the pull request is automatically closed. To run a workflow when a pull request merges, use the `pull_request` `closed` event type along with a conditional that checks the `merged` value of the event. For example, the following workflow will run whenever a pull request closes. The `if_merged` job will only run if the pull request was also merged.

```yaml
on:
pull_request:
types:
- closed
jobs:
if_merged:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- run: |
echo The PR was merged
```

{% data reusables.developer-site.pull_request_forked_repos_link %}

### `pull_request_comment` (use `issue_comment`)
Expand Down Expand Up @@ -869,6 +888,25 @@ on:

{% endnote %}

#### Running your workflow when a pull request merges

When a pull request merges, the pull request is automatically closed. To run a workflow when a pull request merges, use the `pull_request_target` `closed` event type along with a conditional that checks the `merged` value of the event. For example, the following workflow will run whenever a pull request closes. The `if_merged` job will only run if the pull request was also merged.

```yaml
on:
pull_request_target:
types:
- closed
jobs:
if_merged:
if: github.event.pull_request_target.merged == true
runs-on: ubuntu-latest
steps:
- run: |
echo The PR was merged
```

### `push`

| Webhook event payload | Activity types | `GITHUB_SHA` | `GITHUB_REF` |
Expand Down

0 comments on commit 82cafa0

Please sign in to comment.