name: Rust

on: [push, pull_request]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v1
    - name: Build
      run: cargo build --verbose
    - name: Run tests
      run: cargo test --verbose

name: Rust

on:
  pull_request:
    branches:
      - master
  push:
    branches:
      - master

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v1
    - name: Build
      run: cargo build --verbose
    - name: Run tests
      run: cargo test --verbose

Enable the CI on pull request
Enable the CI on pull request

The other syntax apparently does not work.