Run the GHA command only when there is a change in specific folder

0

I want to update the AWS cloudformation stack only when there is a change in the deploy folder.

In my GHA I am trying to do this but its not working

jobs:
  aws_service_and_Infra_creation_updation:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
      - name: Check for changes in deploy folder
        id: check_changes
        run: |
          changed_files=$(git diff HEAD main -- deploy || echo changed)
          if [ -n "$changed_files" ]; then
            echo "Changes detected in deploy folder."
            echo "changes=true" >> $GITHUB_ENV
          else
            echo "No changes in deploy folder."
            echo "changes=false" >> $GITHUB_ENV
          fi
      - name: update the stack
        if: steps.check_changes.outputs.changes == 'true'
        run: make update-stack

Please help what should i change or any other way of doing this through GHA

질문됨 6달 전124회 조회
답변 없음

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠