Skip to content

repo sync #15818

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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