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

Add a shortcut integration #32

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

vanilevsky
Copy link
Collaborator

@vanilevsky vanilevsky commented Jul 9, 2023

Summary

The development work done was primarily focused on integrating a new shortcut feature into the existing codebase. This involved creating new functions, updating existing ones, and writing tests to ensure the functionality works as expected. The changes were made across six files, including the addition of a new file.

Changes

  • .github/pull_request_template.md
    • Introduced a new file 'gpt-updater' for updating the GPT (Guid Partition Table).
  • README.md
    • Expanded the description of the description command to include a new --shortcut-url option.
    • Added a new section on Templates, explaining how to customize the default pull request description.
  • cmd/description/main.go
    • Introduced a new import for a 'shortcut' package.
    • Added a new option for a 'ShortcutBaseURL'.
    • Introduced a new 'descriptionInfo' variable.
    • Modified the 'run' function to check if a pull request already has a generated description.
    • Modified the way the completion and Jira ticket information are generated and stored.
    • Introduced a new function to build shortcut content if a 'ShortcutBaseURL' is provided.
    • Modified the pull request update process to use the new 'descriptionInfo' structure.
  • description/description.go
    • Added a new constant string placeholders.
    • Introduced a new struct type Info.
    • Added several new functions.
    • Modified the BuildUpdatedPullRequest function to construct a new pull request description based on the provided Info struct.
    • Introduced the IsDescriptionFinished and needToUpdateByPlaceholder functions to check if a pull request description contains certain placeholders.
    • Imported the strings package.
  • shortcut/shortcut.go
    • Introduced two new functions: 'ExtractShortcutStoryID' and 'GenerateShortcutStoryURL'.
  • shortcut/shortcut_test.go
    • Included two test functions: 'TestExtractShortcutStoryID' and 'TestGenerateShortcutStoryURL'.
    • Used the 'assert' package from 'testify' for assertions in the tests.

Impact

These changes will allow users to generate Shortcut links more efficiently and customize their pull request descriptions. The new tests ensure that the new functions work as expected, increasing the reliability of the code. The changes also improve the readability and maintainability of the code by introducing a new structure and modifying the way information is generated and stored.

@vanilevsky vanilevsky requested a review from ravilushqa July 9, 2023 05:31
@vanilevsky vanilevsky force-pushed the feature/sc-25996/use-gpt-0 branch from 4594511 to d64de60 Compare July 10, 2023 05:16
@@ -0,0 +1 @@
gpt-updater:description
Copy link
Owner

Choose a reason for hiding this comment

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

I don't think this related to shortcut, do you mind to create a new PR for that?

const placeholder = "gpt-updater:description"
const placeholderFinished = "<!-- gpt-updater:description -->"

type Info struct {
Copy link
Owner

Choose a reason for hiding this comment

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

The structure doesn't look flexible and, in my opinion, needs improvement. What do you think about keeping the old flat logic without an extra structure and simply validating that only JIRA or shortcut are allowed? If both are passed, then return an error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants