diff --git a/.github/workflows/sync-backport-changelog.yml b/.github/workflows/sync-backport-changelog.yml index 76a87f89ba7030..bbc5663cf715be 100644 --- a/.github/workflows/sync-backport-changelog.yml +++ b/.github/workflows/sync-backport-changelog.yml @@ -4,21 +4,33 @@ on: push: branches: - trunk + issues: + types: [labeled] jobs: sync-backport-changelog: name: Sync Core Backport Issue runs-on: ubuntu-latest + if: > + github.event_name == 'push' || + ( + github.event_name == 'issues' && + github.event.action == 'labeled' && + github.event.label.name == '🤖 Sync Backport Changelog' + ) steps: - - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + - name: Checkout + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 with: fetch-depth: 2 # Fetch the last two commits to compare changes - name: Check for changes in backport-changelog - id: check-for-changes + if: github.event_name == 'push' run: | - git diff --quiet HEAD^ HEAD -- backport-changelog || echo "HAS_CHANGES=1" >> "$GITHUB_OUTPUT" + if git diff --quiet HEAD^ HEAD -- backport-changelog; then + echo "skip_sync=true" >> "$GITHUB_ENV" + fi - name: Sync Issue - if: steps.check-for-changes.outputs.HAS_CHANGES + if: ${{ ! env.skip_sync }} uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 with: script: |