Skip to content

Path filtering on required pull request checks #26857

Discussion options

You must be logged in to vote

Thanks @weide-zhou 

I solved it using the github actions script:

on: [pull_request]

jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Check if service has changed
uses: actions/github-script@0.9.0
id: service-changed
with:
result-encoding: string
script: |
const result = await github.pulls.listFiles({
owner: context.payload.repository.owner.login,
repo: context.payload.repository.name,
pull_number: context.payload.number,
per_page: 100
})
const serviceChanged = result.data.filter(f => f.filename.startsWith("serviceA/")).length > 0
console.log(serviceChanged)
return serviceChanged

  - uses: actions/checkout@v2
    if: ${{ steps.service-changed.outputs.result == 'true' }}

Replies: 7 comments

Comment options

You must be logged in to vote
0 replies
Comment options

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

You must be logged in to vote
0 replies
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
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