Skip to content
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
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
Labels
Product Feedback Share your thoughts and suggestions on GitHub features and improvements
7 participants