diff --git a/.github/workflows/push-branch-to-gitlab.yaml b/.github/workflows/push-pr-to-gitlab.yaml similarity index 80% rename from .github/workflows/push-branch-to-gitlab.yaml rename to .github/workflows/push-pr-to-gitlab.yaml index 95e1d43a15e48346da4a713734a4069775092ae1..7a2f7e074159b33d51b7c9cff024f2e92d2e8226 100644 --- a/.github/workflows/push-branch-to-gitlab.yaml +++ b/.github/workflows/push-pr-to-gitlab.yaml @@ -1,22 +1,23 @@ -name: Push the branch to the home Project at MPCDF's gitlab +name: Push the PR to the home Project at MPCDF's gitlab on: - pull_request_review: - types: [submitted] + pull_request_target: + paths-ignore: + - '.gitlab-ci.*' + - '.github/**' jobs: push-to-gitlab: - if: github.event.review.state == 'approved' runs-on: ubuntu-latest env: gitlab_ref: "github-${{ github.event.pull_request.number }}-${{ github.event.pull_request.user.login }}-${{ github.event.pull_request.head.ref }}" steps: - name: Git checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: fetch-depth: '0' - ref: ${{ github.event.pull_request.head.ref }} + ref: ${{ github.event.pull_request.head.sha }} - name: Git push run: | - git push "https://username:${{ secrets.GITLAB_ACCESS_TOKEN }}@gitlab.mpcdf.mpg.de/nomad-lab/nomad-FAIR.git" ${{ github.event.pull_request.head.ref }}:$gitlab_ref -f + git push "https://username:${{ secrets.GITLAB_ACCESS_TOKEN }}@gitlab.mpcdf.mpg.de/nomad-lab/nomad-FAIR.git" HEAD:refs/heads/$gitlab_ref -f - name: Create MR run: | curl -X POST -L -G \