diff --git a/.github/workflows/hotfix.yml b/.github/workflows/hotfix.yml index 88405dd..7331a52 100644 --- a/.github/workflows/hotfix.yml +++ b/.github/workflows/hotfix.yml @@ -15,21 +15,22 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Get hotfix pull request body shell: bash - run: | - echo '${{ github.event.pull_request.body }}' > hotfix_pr_body.txt + env: + PR_BODY: ${{ github.event.pull_request.body }} + run: echo $PR_BODY > hotfix_pr_body.txt - name: Get a list of all original PR numbers shell: bash run: | - # Extract a list of lines with the format 'juspay/hyperswitch-cloud/pull/1200' or '#1200' using 'sed'. + # Extract a list of lines with the format 'juspay/hyperswitch/pull/1200' or '#1200' using 'sed'. # If empty, then error out and exit. - # else, use 'grep' to extract out 'juspay/hyperswitch-cloud/pull/1200' or '#1200' patterns from each line. - # Use 'sed' to remove the part of the matched strings that precedes the last "/" character (in cases like, juspay/hyperswitch-cloud/pull/1200 - 1200) + # else, use 'grep' to extract out 'juspay/hyperswitch/pull/1200' or '#1200' patterns from each line. + # Use 'sed' to remove the part of the matched strings that precedes the last "/" character (in cases like, juspay/hyperswitch/pull/1200 - 1200) # and sed again to remove any "#" characters from the extracted numeric part (in cases like #1200 - 1200), ultimately getting PR/issue number. # Finally, remove (if any) duplicates from the list @@ -58,7 +59,7 @@ jobs: PR_STATES=() for pr_number in ${PR_NUMBERS}; do - is_pull_request="$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" "/repos/juspay/hyperswitch-cloud/issues/${pr_number}" | jq '.pull_request')" + is_pull_request="abc" if [[ "$is_pull_request" == null ]]; then continue @@ -70,7 +71,7 @@ jobs: pr_state=$(echo "${pr_info}" | jq -r '.state') if [[ "${pr_author}" == "${{ github.event.pull_request.user.login }}" && \ - "${pr_title}" == "${{ github.event.pull_request.title }}" && \ + "${pr_title}" == '${{ github.event.pull_request.title }}' && \ "${pr_base_ref}" == "master" && \ "${pr_state}" == "MERGED" ]]; then @@ -108,7 +109,7 @@ jobs: title_match_found=0 for ((i = 0; i < ${#PR_TITLES[@]}; i++)); do - if [[ "${{github.event.pull_request.title}}" == "${PR_TITLES[i]}" ]]; then + if [[ '${{github.event.pull_request.title}}' == "${PR_TITLES[i]}" ]]; then # If a match is found, set the flag to 1 and break out of the loop title_match_found=1 break @@ -116,7 +117,7 @@ jobs: done if [[ $title_match_found -eq 0 ]]; then - echo "::error::Hotfix PR title does not match any of the Original PR titles. Hotfix PR title: '${{ github.event.pull_request.title }}'" + echo ::error::Hotfix PR title does not match any of the Original PR titles. Hotfix PR title: '${{ github.event.pull_request.title }}' fi @@ -132,7 +133,7 @@ jobs: done if [[ $original_pr_points_to_main -eq 0 ]]; then - echo "::error::None of the Original PR's baseRef is 'main'" + echo "::error::None of the Original PR's baseRef is 'master'" fi