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

OSOE-726: Migrate auto-resolve-done-jira-issue and create-jira-issues-for-community-activities to use API Key Manager for Jira #301

Closed
wants to merge 15 commits into from

Conversation

Piedone
Copy link
Member

@Piedone Piedone commented Dec 16, 2023

OSOE-726
Fixes #130
Fixes #277

Summary by CodeRabbit

  • New Features

    • Integrated GitHub with Jira to automatically update Jira issues based on pull request status.
    • Streamlined the creation of Jira issues for community activities directly from GitHub.
  • Improvements

    • Simplified Jira issue creation workflow by consolidating steps and refining parameter handling.
    • Updated workflow files to use new environment variable names for Jira integration.
  • Documentation

    • Revised setup instructions for creating Jira issues and automated post-pull request checks.
    • Highlighted the use of pull_request_target trigger for improved workflow functionality.
  • Refactor

    • Reorganized GitHub action scripts for Jira issue updates, enhancing maintainability and performance.
  • Chores

    • Renamed variables for clarity and consistency across scripts and workflows.

@github-actions github-actions bot changed the title Migrate auto-resolve-done-jira-issue and create-jira-issues-for-community-activities to use API Key Manager for Jira OSOE-726: Migrate auto-resolve-done-jira-issue and create-jira-issues-for-community-activities to use API Key Manager for Jira Dec 16, 2023
@Piedone
Copy link
Member Author

Piedone commented Dec 29, 2023

@coderabbitai review

Copy link
Contributor

coderabbitai bot commented Dec 29, 2023

Walkthrough

The recent updates involve migrating GitHub actions from deprecated gajira actions to using the API Key Manager for Jira extension, enhancing Jira issue handling, and removing redundant steps. The changes streamline the process of updating Jira issues based on pull request statuses and creating new issues for community activities, utilizing PowerShell scripts for direct API interactions.

Changes

File(s) Change Summary
.github/actions/auto-resolve-done-jira-issue/... Updated scripts for Jira issue updates, removed initialization logic, and direct transition using Update-JiraIssue function.
.github/actions/create-jira-issues-for-community-activities/... Introduced scripts to create Jira issues and links, renamed variables, and streamlined issue creation steps.
.github/workflows/... Updated workflows to reference specific branches/tags, reorganized secrets for Jira integration, and updated environment variable names.
Docs/Workflows/Productivity/... Documentation updated to include API Key Manager setup, emphasized the pull_request_target trigger, and reorganized Jira secrets setup.

Assessment against linked issues

Objective Addressed Explanation
Don't fail Jira resolve/Done transition if already done (OSOE-489)
Migrate actions to use API Key Manager for Jira (OSOE-726)
Eliminate "Login to Jira" steps (OSOE-726)
Replace gajira actions with PS HTTP requests (OSOE-726)
Document necessary setup for workflows (OSOE-726)

Poem

A hop, a skip, in the code we weave,
Pull requests and Jira, now hand in glove.
🎉 With each commit, we believe,
Bugs resolve, as we code with love. 🐇

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat with CodeRabbit Bot (@coderabbitai)

  • You can directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • You can tag CodeRabbit on specific lines of code or entire files in the PR by tagging @coderabbitai in a comment. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • You can tag @coderabbitai in a PR comment and ask questions about the PR and the codebase. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid.
    • @coderabbitai read the files in the src/scheduler package and generate README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@Piedone
Copy link
Member Author

Piedone commented Dec 29, 2023

@coderabbitai review

2 similar comments
@Piedone
Copy link
Member Author

Piedone commented Dec 29, 2023

@coderabbitai review

@Piedone
Copy link
Member Author

Piedone commented Dec 29, 2023

@coderabbitai review

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between e97046f and b3ec0ba.
Files selected for processing (13)
  • .github/actions/auto-resolve-done-jira-issue/Update-JiraIssue.ps1 (1 hunks)
  • .github/actions/auto-resolve-done-jira-issue/action.yml (2 hunks)
  • .github/actions/create-jira-issues-for-community-activities/Add-JiraIssue.ps1 (1 hunks)
  • .github/actions/create-jira-issues-for-community-activities/Initialize-IssueDetails.ps1 (3 hunks)
  • .github/actions/create-jira-issues-for-community-activities/action.yml (3 hunks)
  • .github/workflows/create-jira-issues-for-community-activities-in-this-repo.yml (1 hunks)
  • .github/workflows/create-jira-issues-for-community-activities.yml (2 hunks)
  • .github/workflows/post-pull-request-checks-automation.yml (2 hunks)
  • .github/workflows/validate-pull-request.yml (1 hunks)
  • .github/workflows/validate-submodule-pull-request.yml (1 hunks)
  • .github/workflows/validate-this-pull-request.yml (1 hunks)
  • Docs/Workflows/Productivity/CreateJiraIssuesForCommunityActivities.md (3 hunks)
  • Docs/Workflows/Productivity/PostPullRequestChecksAutomation.md (2 hunks)
Files skipped from review due to trivial changes (2)
  • .github/workflows/validate-submodule-pull-request.yml
  • .github/workflows/validate-this-pull-request.yml
Additional comments: 24
.github/workflows/create-jira-issues-for-community-activities-in-this-repo.yml (1)
  • 14-17: The update to reference the issue/OSOE-726 branch is specific and should be verified to ensure that the branch exists and is intended for long-term use. The new secrets JIRA_ENDPOINT_URL and JIRA_API_KEY replace the previous ones, which is in line with the PR objectives to use the API Key Manager for Jira.
.github/workflows/validate-pull-request.yml (1)
  • 5-11: The updated description for the JIRA_BASE_URL secret provides clearer instructions for its configuration, which is beneficial for maintainability and clarity for future users setting up the workflow.
.github/actions/auto-resolve-done-jira-issue/action.yml (1)
  • 28-34: > Note: This review was outside the patches, so it was mapped to the patch with the greatest overlap. Original lines [31-41]

The removal of the login logic and the direct use of the Update-JiraIssue function simplifies the action and aligns with the PR's goal to improve Jira integration. Ensure that the Update-JiraIssue function is thoroughly tested to handle the transition correctly.

.github/actions/create-jira-issues-for-community-activities/Initialize-IssueDetails.ps1 (2)
  • 8-8: The variable $PullReqestJiraIssueDescription has been corrected to $PullRequestJiraIssueDescription. This is a good catch as it fixes a potential bug due to a typo.

  • 70-76: The output format has been changed to a PSCustomObject. This change should be verified to ensure that it matches the expected input format for any downstream processes that consume this output.

.github/actions/auto-resolve-done-jira-issue/Update-JiraIssue.ps1 (2)
  • 1-22: The script now includes parameters for the repository, pull request number, and flags for determining the transition state. It's important to ensure that these parameters are properly sanitized and validated before use.

  • 3-6: Using the GitHub CLI to fetch the latest PR title is a good approach to ensure the script operates on up-to-date information. However, it's important to handle potential errors from the CLI command gracefully.

Docs/Workflows/Productivity/PostPullRequestChecksAutomation.md (2)
  • 8-16: The documentation now includes prerequisites for setting up JIRA secrets with the API Key Manager for Jira. This is a helpful addition for users who need to configure the workflow.

  • 19-19: The setup section now directs users to the workflow's inline documentation for details on MERGE_TOKEN. This change helps to keep the documentation DRY by not repeating information.

.github/workflows/create-jira-issues-for-community-activities.yml (1)
  • 7-16: The environment variable names have been updated to use the new JIRA secrets, which is in line with the PR objectives to use the API Key Manager for Jira. Ensure that these new secrets are properly set in the GitHub repository settings.
.github/actions/create-jira-issues-for-community-activities/Add-JiraIssue.ps1 (2)
  • 1-16: The script now uses the JIRA_API_KEY environment variable and has a function to create Jira issues. It's important to ensure that the API key is handled securely and that the function correctly interfaces with the Jira API.

  • 71-92: The AddLink and GetIssueUrl functions are important for integrating GitHub activities with Jira. Verify that these functions are implemented correctly and that they handle errors appropriately.

Docs/Workflows/Productivity/CreateJiraIssuesForCommunityActivities.md (2)
  • 5-16: The documentation now includes information on using the API Key Manager for Jira and detailed prerequisites for setting up JIRA secrets. This is a valuable update for users who need to configure the workflow.

  • 34-34: The documentation correctly emphasizes the use of the pull_request_target trigger instead of pull_request. This is important for the workflow to function correctly with pull requests from forks.

.github/actions/create-jira-issues-for-community-activities/action.yml (7)
  • 43-48: The step "Create Jira Issue" has been introduced, replacing multiple previous steps. Ensure that the logic encapsulated in the removed steps is now correctly handled within this single step.

  • 46-48: The step id change from "issue-details" to "create-issue" is noted. Verify that this change is reflected wherever the step id is referenced.

  • 50-50: Ensure that the environment variable GITHUB_JSON is used securely and that there is no risk of script injection, as the comment in the code suggests.

  • 58-67: The conversion of the GitHub context to a JSON object and then to a PowerShell object is a typical pattern. Confirm that the input is sanitized upstream to prevent injection attacks.

  • 61-78: The hashtable setup for Jira issue creation parameters appears to be correct. Ensure that all necessary fields for creating a Jira issue are included and that the data types are appropriate, especially the conversion to boolean for SuffixIssueTitles.

  • 81-81: The Add-JiraIssue function is being used to create a Jira issue. Verify that this function exists and is implemented correctly to handle the parameters passed to it.

  • 91-92: The update to the GitHub issue uses output variables from the Jira issue creation step. Confirm that these outputs are correctly set by the Add-JiraIssue function and that the issue title and body are updated as intended.

.github/workflows/post-pull-request-checks-automation.yml (3)
  • 20-29: The environment variables JIRA_ENDPOINT_URL and JIRA_API_KEY have been introduced, replacing the previous Jira integration secrets. Ensure that these new variables are correctly used throughout the workflow and that the documentation has been updated accordingly.

  • 82-82: The GitHub action for JIRA issue resolution now references a specific issue branch (issue/OSOE-726). Confirm that this reference is intentional and aligns with the PR objectives to use more stable and issue-specific code references.

  • 85-86: The new JIRA environment variables JIRA_ENDPOINT_URL and JIRA_API_KEY are being used. Verify that these are set up correctly in the repository secrets and that their usage here aligns with the intended security improvements.

@Piedone
Copy link
Member Author

Piedone commented Feb 12, 2024

We can't continue with this, see #277 (comment).

@Piedone Piedone closed this Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant