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ビュー
回答なし

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ