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

feat: misc fixes for FC-0012 scripting #2129

Merged
merged 3 commits into from
Nov 15, 2023

Conversation

OmarIthawi
Copy link
Member

  • fix: avoid failing the automerge-transifex-app-prs.yml
  • fix: add default failure message if nothing is printed on stdout
  • chore: use argparse on validate_translation_files.py

This contribution is part of the FC-0012 project which is sparked by the Translation Infrastructure update OEP-58.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Nov 4, 2023
@openedx-webhooks
Copy link

openedx-webhooks commented Nov 4, 2023

Thanks for the pull request, @OmarIthawi! Please note that it may take us up to several weeks or months to complete a review and merge your PR.

Feel free to add as much of the following information to the ticket as you can:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here.

Please let us know once your PR is ready for our review and all tests are green.

@OmarIthawi
Copy link
Member Author

cc: @shadinaif for review.

@OmarIthawi OmarIthawi marked this pull request as ready for review November 4, 2023 16:34
@brian-smith-tcril
Copy link
Contributor

Did you figure out the issue with merge queue CLA checks? #199 (comment)

@OmarIthawi
Copy link
Member Author

Did you figure out the issue with merge queue CLA checks? #199 (comment)

That was an intermittent error that fixed itself after a while. I remember it was a GitHub Actions outage (or Jenkins, I can't remember well). I only force pushed and it got merged.

This PR has only minor fixes that I've found while working on the fuzzy proposal that's not being rejected.

@brian-smith-tcril
Copy link
Contributor

That was an intermittent error that fixed itself after a while

Are we thinking about the same thing? I remember trying to figure out merge queue issues with Ned for a while https://openedx.slack.com/archives/C0497NQCLBT/p1681501743788269 and landing on not using them.

Copy link
Member Author

@OmarIthawi OmarIthawi left a comment

Choose a reason for hiding this comment

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

That was an intermittent error that fixed itself after a while

Are we thinking about the same thing? I remember trying to figure out merge queue issues with Ned for a while https://openedx.slack.com/archives/C0497NQCLBT/p1681501743788269 and landing on not using them.

@brian-smith-tcril not really. There's no changes on the merging strategy in this pull request. The change is to remove the always-broken gh pr view "$PR_NUMBER" as well as the redundant retry.

Apart from that, translation pull requests are already being added into a merge queue with the --auto --rebase options.

gh pr merge
gh pr merge [<number> | <url> | <branch>] [flags]
Merge a pull request on GitHub.

Without an argument, the pull request that belongs to the current branch is selected.

When targeting a branch that requires a merge queue, no merge strategy is required. If required checks have not yet passed, AutoMerge will be enabled. If required checks have passed, the pull request will be added to the merge queue. To bypass a merge queue and merge directly, pass the '--admin' flag.

Options
...
--auto
Automatically merge only after necessary requirements are met
-r, --rebase
Rebase the commits onto the base branch
...

This is the equivalent of clicking the "Rebase and merge" option in the "Enable auto-merge" menu in the UI:

image

Source: https://cli.github.com/manual/gh_pr_merge

Comment on lines -37 to -40

# The `fromdate | todate` are used merge to validate that `mergedAt` isn't null
# therefore verifying that the pull request was merged successfully.
gh pr view "$PR_NUMBER" --json mergedAt --jq '.mergedAt | fromdate | todate'
Copy link
Member Author

@OmarIthawi OmarIthawi Nov 9, 2023

Choose a reason for hiding this comment

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

These lines were removed because fail sometimes time because merge --rebase --auto is an async merge as opposed to the gh merge --rebase which waits until the command is merged.

--auto here means --auto-merge which adds the PR to the merge queue.

This is the default strategy that has been implemented in the repository since #185.

This pull request merely removes the nick-fields/retry which is redundant.

gh pr view "$PR_NUMBER" --json mergedAt --jq '.mergedAt | fromdate | todate'
run: |
# Add the pull request to the merge queue with --rebase commit strategy
gh pr merge ${{ github.head_ref }} --rebase --auto
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the same original merge --rebase --auto but now within a GitHub Actions native run instead of retry.

Copy link
Contributor

@shadinaif shadinaif left a comment

Choose a reason for hiding this comment

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

Thank you @OmarIthawi

scripts/validate_translation_files.py Outdated Show resolved Hide resolved
Add the pull request to the merge queue with --rebase commit strategy.

The gh pr merge BRANCH_NAME --rebase --auto either succeeds to queue the
pull request or fails permanently. Retry doesn't help.
allow passing arguments in a pythonic manner
@OmarIthawi
Copy link
Member Author

That was an intermittent error that fixed itself after a while

Are we thinking about the same thing? I remember trying to figure out merge queue issues with Ned for a while https://openedx.slack.com/archives/C0497NQCLBT/p1681501743788269 and landing on not using them.

@brian-smith-tcril not really. There's no changes on the merging strategy in this pull request. The change is to remove the always-broken gh pr view "$PR_NUMBER" as well as the redundant retry.

Apart from that, translation pull requests are already being added into a merge queue with the --auto --rebase options.

gh pr merge
gh pr merge [<number> | <url> | <branch>] [flags]
Merge a pull request on GitHub.

Without an argument, the pull request that belongs to the current branch is selected.

When targeting a branch that requires a merge queue, no merge strategy is required. If required checks have not yet passed, AutoMerge will be enabled. If required checks have passed, the pull request will be added to the merge queue. To bypass a merge queue and merge directly, pass the '--admin' flag.

Options
...
--auto
Automatically merge only after necessary requirements are met
-r, --rebase
Rebase the commits onto the base branch
...

This is the equivalent of clicking the "Rebase and merge" option in the "Enable auto-merge" menu in the UI:
...
Source: https://cli.github.com/manual/gh_pr_merge

@brian-smith-tcril I'm merging tomorrow unless there's an objection.

@brian-smith-tcril brian-smith-tcril merged commit 84fc819 into openedx:main Nov 15, 2023
5 checks passed
@openedx-webhooks
Copy link

@OmarIthawi 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open-source-contribution PR author is not from Axim or 2U
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants