diff --git a/.github/workflows/pr-label.yml b/.github/workflows/pr-label.yml new file mode 100644 index 000000000..a3fc40d5c --- /dev/null +++ b/.github/workflows/pr-label.yml @@ -0,0 +1,46 @@ +name: Update PR Label to Closed + +on: + pull_request: + types: + - closed + +jobs: + pr-label: + runs-on: ubuntu-latest + + steps: + - name: Check out code + uses: actions/checkout@v2 + + - name: Get existing labels + run: | + PR_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH") + TOKEN=$GITHUB_TOKEN + + # Add your repository name if it's not the default branch + REPO_NAME=$(basename $GITHUB_REPOSITORY) + + # Get existing labels on the PR + EXISTING_LABELS=$(curl -s -H "Authorization: Bearer ${{ secrets.AUTO_RELEASE_PAT }}" \ + -H "Accept: application/vnd.github.v3+json" \ + "https://api.github.com/repos/$GITHUB_REPOSITORY/issues/$PR_NUMBER" \ + | jq -r '.labels | map(.name) | join(" ")') + + echo $EXISTING_LABELS + + # Remove existing labels + for LABEL in $EXISTING_LABELS; do + curl -X DELETE \ + -H 'Accept: application/vnd.github.v3+json' \ + -H 'Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \ + "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/labels/${LABEL}" + done + + - name: Add new label + run: | + export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} + gh pr edit ${{ github.event.pull_request.number }} --add-label "closed" + + + diff --git a/CHANGELOG.md b/CHANGELOG.md index 3555b2371..254c9419c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,25 @@ All notable changes to this project will be documented in this file. See [conven - - - +## 1.27.0 (2024-01-21) + +### Features + +- Update pr label on merge to closed ([#207](https://github.com/juspay/hyperswitch-control-center/pull/207)) ([`f8994ff`](https://github.com/juspay/hyperswitch-control-center/commit/f8994ff8faadc73bf89c67048d2c798024701963)) + +### Bug Fixes + +- Make basic details form to accept form input without Save button ([#271](https://github.com/juspay/hyperswitch-control-center/pull/271)) ([`3784090`](https://github.com/juspay/hyperswitch-control-center/commit/3784090a99cf67c4dee69b914b66fe7979a39620)) + +### Miscellaneous Tasks + +- Option Core changes ([#268](https://github.com/juspay/hyperswitch-control-center/pull/268)) ([`94e70d3`](https://github.com/juspay/hyperswitch-control-center/commit/94e70d37fb3fc36104ea3ad412f03afc7d115369)) + +**Full Changelog:** [`v1.26.0...v1.27.0`](https://github.com/juspay/hyperswitch-control-center/compare/v1.26.0...v1.27.0) + +- - - + + ## 1.26.0 (2024-01-18) ### Features diff --git a/src/screens/HyperSwitch/Routing/RoutingUtils.res b/src/screens/HyperSwitch/Routing/RoutingUtils.res index c907c95f6..5bce5de18 100644 --- a/src/screens/HyperSwitch/Routing/RoutingUtils.res +++ b/src/screens/HyperSwitch/Routing/RoutingUtils.res @@ -170,6 +170,70 @@ let constructNameDescription = routingType => { let currentTabNameRecoilAtom = Recoil.atom(. "currentTabName", "ActiveTab") +module SaveAndActivateButton = { + @react.component + let make = ( + ~onSubmit: (Js.Json.t, 'a) => promise>, + ~handleActivateConfiguration, + ) => { + let formState: ReactFinalForm.formState = ReactFinalForm.useFormState( + ReactFinalForm.useFormSubscription(["values"])->Js.Nullable.return, + ) + + let handleSaveAndActivate = async _ev => { + try { + let onSubmitResponse = await onSubmit(formState.values, false) + let currentActivatedFromJson = + onSubmitResponse->Js.Nullable.toOption->Belt.Option.getWithDefault(Js.Json.null) + let currentActivatedId = + currentActivatedFromJson->LogicUtils.getDictFromJsonObject->LogicUtils.getString("id", "") + let _ = await handleActivateConfiguration(Some(currentActivatedId)) + } catch { + | Js.Exn.Error(e) => + let _err = + Js.Exn.message(e)->Belt.Option.getWithDefault( + "Failed to save and activate configuration!", + ) + } + } +