Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run sync when issue is labeled with Sync Backport Changelog #63793

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions .github/workflows/sync-backport-changelog.yml
Original file line number Diff line number Diff line change
@@ -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: |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can skip checking out the repo to check for changes if it's triggered by the label

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to check out the repo because of the awk in the script below. We can skip the git diff though. I've done that.

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: |