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

allow to merge from non-github and not fast-forward #11

Open
RekGRpth opened this issue Aug 1, 2021 · 0 comments
Open

allow to merge from non-github and not fast-forward #11

RekGRpth opened this issue Aug 1, 2021 · 0 comments

Comments

@RekGRpth
Copy link

RekGRpth commented Aug 1, 2021

solve

diff --git a/action.yml b/action.yml
index 24c1643..331f43e 100644
--- a/action.yml
+++ b/action.yml
@@ -9,12 +9,21 @@ inputs:
   upstream:
     description: 'Upstream repository owner/name. For example, exions/merge-upstream'
     required: true
+  email:
+    description: 'User email for git commits'
+    default: '[email protected]'
+  name:
+    description: 'User name for git commits'
+    default: 'Merge Upstream Action'
   upstream-branch:
     description: 'Upstream branch to merge from. For example, master'
     default: 'master'
   branch:
     description: 'Branch to merge to. For example, master'
     default: 'master'
+  repository:
+    description: 'Repository to merge from. For example, https://github.com/'
+    default: 'https://github.com/'
   token:
     description: >
       Personal access token (PAT) used to fetch the repository. The PAT is configured
@@ -27,13 +36,13 @@ inputs:
 
 runs:
   using: "composite"
-  steps: 
-    - run: | 
-        git remote add -f upstream "https://github.com/${{ inputs.upstream }}.git"
-        git remote -v
-        git branch --all
-        git config --list
-        git checkout ${{ inputs.branch }}
-        git merge --ff-only upstream/${{ inputs.upstream-branch }}
-        git push 
-      shell: bash
+  steps:
+    - run: |
+        set -eux
+        git checkout "${{ inputs.branch }}"
+        git remote add --fetch --track "${{ inputs.upstream-branch }}" upstream "${{ inputs.repository }}${{ inputs.upstream }}.git"
+        git config user.email "${{ inputs.email }}"
+        git config user.name "${{ inputs.name }}"
+        git merge "upstream/${{ inputs.upstream-branch }}"
+        git push
+      shell: sh
discdiver added a commit to discdiver/merge-from-upstream-repo that referenced this issue Jan 31, 2022
adapted from [this issue](exions#11)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant