如何为推送构建所有内容并为 pull_requests 构建特定路径?

How to build all for push and certain path for pull_requests?

我想在整个代码库上触发构建以进行推送,但只为拉取请求触发特定路径。我怎样才能在 github 行动中做到这一点。我尝试了以下但它似乎没有为推送构建:

name: Build Backend

on:
  push:
    paths: ./**
  pull_request:
    paths: 
      - components/backend/**
      - .github/workflows/**

默认会触发所有路径,所以你可以不为push指定任何路径。

name: Build Backend

on:
  push:
  pull_request:
    paths: 
      - components/backend/**
      - .github/workflows/**