Skip to content

Do not run tests on PR merge to master #26841

Answered by BrightRan
dschinkel asked this question in Actions
Discussion options

You must be logged in to vote

@dschinkel ,

Once a PR is merged, it will be closed automatically. The activity type ‘closed’ of the pull_request event should work.

In your case, you can reference to the example workflow below to configure yours:

on:
  pull_request:
    types: [opened, synchronize, closed]
    branches:
      - master

jobs:
build:

Some jobs do not have any if statement.

They will always be executed in the workflow. For example, 'build' job.

test:
if: ${{github.event_name == 'pull_request' && github.event.action != 'closed'}}

With this if statement, the 'test' job will only run

when the activity type of the PR is not closed.

Of course, you also can remove ‘closed’ from the list of the activity types, so…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants