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 次
沒有答案

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南