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

Automatically sync backport changelog to issue #62973

Merged
merged 7 commits into from
Jul 8, 2024

Conversation

ellatrix
Copy link
Member

@ellatrix ellatrix commented Jun 28, 2024

What?

Creates a new workflow to automatically sync the changelog to the right issue.

Why?

Reduce repetitive manual labor.

How?

When a change is pushed to trunk the workflow will:

  • Find the last created issue with the label "🤖 Sync Backport Changelog".
  • Derive the version number from the title.
  • Generate the backport list from that.
  • Check the existing issue content for delimiters:
    • If there are none, append the list with delimiters at the end.
    • If there are, replace the contents. Only update the issue if the contents are different.

When a new release cycle is started, someone can just create a new issue with the label "🤖 Sync Backport Changelog" and mention 6.7 (for example) in the title. On the next push to trunk the issue will be updated.

The script will only sync the last created issue, previous ones will be ignored and should probably be closed.

Future work

We could add a PR workflow that also adds unmerged backport PRs to the issue in the future. Worth noting that even the old cherry-pick script never took any unmerged PRs into account.

Testing Instructions

You can see it in action here: #62315

Testing Instructions for Keyboard

Screenshots or screencast

@ellatrix ellatrix added the [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. label Jun 28, 2024
Copy link

github-actions bot commented Jun 28, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: ellatrix <ellatrix@git.wordpress.org>
Co-authored-by: vcanales <vcanales@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: ${{ env.PR_COMMIT_COUNT }}
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 don't need commit history for this test, so cleaning up a bit.

@ellatrix ellatrix changed the title Sync backport changelog to issue Jun 28, 2024
Copy link

Flaky tests detected in d1070df.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/9712700675
📝 Reported issues:

console.log(`Latest version: ${version}`);

const { execSync } = require('child_process');
const processedChangelog = execSync(`awk '/./ {print ($0 ~ /^[-*]/ ? " " : "- ") $0}' backport-changelog/${version}/*.md`).toString().trim();
Copy link
Member

Choose a reason for hiding this comment

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

Could we check the last commit for changes in this directory before doing anything else? Seems like it might save us some API requests.
Another alternative could be conditioning this workflow on a check similar to the one check-backport-changelog uses.

Copy link
Member Author

Choose a reason for hiding this comment

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

What API requests would it save? I'm already checking if the content is different.

Copy link
Member

Choose a reason for hiding this comment

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

The very first one

https://github.com/WordPress/gutenberg/pull/62973/files#diff-b61aaec5beeb30ae49637bf34830218b191db2c3fb71db321153b7cf6a93226dR18-R25

What I'm getting at is that I think that not starting the workflow if it's not necessary is a good idea

Copy link
Member Author

Choose a reason for hiding this comment

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

Added an early abort 8bb22a2

Copy link
Member

@vcanales vcanales left a comment

Choose a reason for hiding this comment

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

Looks good!

@ellatrix ellatrix merged commit 8b470e0 into trunk Jul 8, 2024
62 checks passed
@ellatrix ellatrix deleted the try/sync-backport-changelog branch July 8, 2024 18:45
@ellatrix
Copy link
Member Author

ellatrix commented Jul 8, 2024

😔 I forgot to add props, I'm so sorry

@github-actions github-actions bot added this to the Gutenberg 18.8 milestone Jul 8, 2024
huubl pushed a commit to huubl/gutenberg that referenced this pull request Jul 10, 2024
@ellatrix
Copy link
Member Author

@vcanales What I don't like now, after the last change, is that it will only add the changes to a newly created issue after another backport was made.

carstingaxion pushed a commit to carstingaxion/gutenberg that referenced this pull request Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.
2 participants