From 778096ccbb96df231e516da8e692380a487ea9fc Mon Sep 17 00:00:00 2001 From: UmairJibran Date: Tue, 23 May 2023 17:45:41 +0500 Subject: [PATCH 1/3] FIX: rolling back to from makshift --- action.yml | 32 ++++++++++---------------------- 1 file changed, 10 insertions(+), 22 deletions(-) diff --git a/action.yml b/action.yml index cb124a2..0af66d7 100644 --- a/action.yml +++ b/action.yml @@ -36,29 +36,17 @@ runs: run: | echo "DECLARING DEFAULT BRANCH" BRANCH=${{ github.event.repository.default_branch }} - # THIS IS DESPERATE MAKESHIFT SOLUTION, NEEDS TO BE FIXED! - # if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then - # echo "INITIALIZING GIT REPO" - # git init - # echo "SETTING DEFAULT BRANCH" - # git branch -m $BRANCH - # else - # echo "REMOVING REMOTE ORIGIN FOR PRE EXISTING REPO" - # git remote remove origin - # fi - - if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then - echo "REMOVING ACTIVE REPO" - echo "SORRY, FOR DOING THIS THE HARD WAY" - echo "IF YOU CAN SOLVE THIS FOR EVERYONE, PLEASE DO" - rm -r ./* .[!.]* + if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then + echo "INITIALIZING GIT REPO" + git init + echo "SETTING DEFAULT BRANCH" + git branch -m $BRANCH + echo "SETTING UP GIT REMOTE ORIGIN" + git remote add origin https://${{ github.repository_owner }}:${{ env.GITHUB_PAT }}@github.com/${{ github.repository }}.git + else + echo "UPDATING REMOTE ORIGIN FOR PRE EXISTING REPO" + git remote set-url origin https://${{ github.repository_owner }}:${{ env.GITHUB_PAT }}@github.com/${{ github.repository }}.git fi - echo "INITIALIZING GIT REPO" - git init - echo "SETTING DEFAULT BRANCH" - git branch -m $BRANCH - echo "SETTING UP GIT REMOTE ORIGIN" - git remote add origin https://${{ github.repository_owner }}:${{ env.GITHUB_PAT }}@github.com/${{ github.repository }}.git git fetch if ! git ls-remote --exit-code --heads origin ${{ env.TARGET_BRANCH }} >/dev/null 2>&1; then echo "CHECKING OUT \`$BRANCH\`" From e0beafddd3db0fda055a8197703cc05bcb2259d8 Mon Sep 17 00:00:00 2001 From: UmairJibran Date: Tue, 23 May 2023 18:22:48 +0500 Subject: [PATCH 2/3] DOCS: add instructions for when using `checkout` --- README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 250edad..74d67be 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,6 @@ jobs: with: target-branch: 'staging' # replace this name with your testing branch token: ${{ secrets.GITHUB_TOKEN }} # Read below on how to get this - ``` This action requires a personal access token (PAT) with appropriate permissions to perform the merge operation. Make sure you provide the token input with a valid GitHub Personal Access Token. Create a PAT with the REPO permission using the following steps: @@ -56,6 +55,16 @@ This action requires a personal access token (PAT) with appropriate permissions - Click on the "Add secret" button to save the secret. **Note that, PAT grants significant access to your GitHub account, so treat them like passwords and keep them secure.** +### Using actions/checkout + +If your pre-existing yml file (that your including this action to) is already using checkout, please use it with `persist-credentials` and set the value to `false` + +```YML +- name: checkout code + uses: actions/checkout@v3 + with: + persist-credentials: false +``` ## Inputs `target-branch` (optional): The branch in which you want to merge the pull request. Defaults to 'alpha'. From de2a3fae9f4fbd7f212d6de119833074037ccc04 Mon Sep 17 00:00:00 2001 From: Umair Jibran Date: Wed, 24 May 2023 21:19:03 +0500 Subject: [PATCH 3/3] CONFIG: removing the .extraheader header --- action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/action.yml b/action.yml index 0af66d7..58ed600 100644 --- a/action.yml +++ b/action.yml @@ -45,6 +45,7 @@ runs: git remote add origin https://${{ github.repository_owner }}:${{ env.GITHUB_PAT }}@github.com/${{ github.repository }}.git else echo "UPDATING REMOTE ORIGIN FOR PRE EXISTING REPO" + git config --unset http.https://github.com/.extraheader git remote set-url origin https://${{ github.repository_owner }}:${{ env.GITHUB_PAT }}@github.com/${{ github.repository }}.git fi git fetch