Skip to content

Parameterize Merge Strategy in gh\pr-merge action #41

@iumangg

Description

@iumangg

Description

The current gh/pr-merge action has a hardcoded --merge flag. This limits the utility of the action for teams that enforce squash or rebase commit histories. We need to update the script to accept the merge method as a parameter.

Tasks

  • Add the following input parameter:
    • Merge method
  • Implement logic to:
    • Input validation to accept squash and rebase as merge method, for any other input log the input and default to merge
    • Map the input to the corresponding GitHub CLI flag.
    • Default to --merge for backward compatibility.

Expected Outcome

  • Parameter Support: The script must accept a new input variable for merge method
  • Dynamic Flag Mapping:
    • If squash is provided, the command must use the --squash flag.
    • If rebase is provided, the command must use the --rebase flag.
    • If merge is provided or anything else, the command must use the --merge flag.
  • Default Behavior: If the parameter is empty or not provided, the script must default to --merge to avoid breaking existing workflows.
  • Input Normalization: The script should handle case-insensitivity (e.g., SQUASH or squash should both work).
  • Successful Execution: The PR must be successfully merged using the selected strategy without manual intervention.
  • Test: Update the test workflow to test the merge method changes

Metadata

Metadata

Assignees

Labels

c.EnhancementImprovement or upgrade to existing features

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions