2024-11-23 21:59:43 +01:00
|
|
|
---
|
|
|
|
name: update-upstream
|
|
|
|
description: Update an upstram branch.
|
|
|
|
author: Michael Sasser <info@michaelsasser.org>
|
|
|
|
|
|
|
|
branding:
|
|
|
|
icon: shield
|
|
|
|
color: blue
|
|
|
|
|
|
|
|
inputs:
|
|
|
|
# Upstream
|
|
|
|
upstream_repo_url:
|
|
|
|
description: The upstram repo to pull the new changes from.
|
|
|
|
required: true
|
|
|
|
|
|
|
|
upstream_repo_branch:
|
|
|
|
description: The upstram branch to pull the new changes from.
|
|
|
|
required: false
|
|
|
|
default: "main"
|
|
|
|
|
|
|
|
# Downstream
|
|
|
|
downstream_repo_branch:
|
|
|
|
description: The downstream branch to push the new changes to.
|
|
|
|
required: false
|
|
|
|
default: "upstream"
|
|
|
|
|
|
|
|
#
|
|
|
|
# Secrets
|
|
|
|
#
|
|
|
|
PERSONAL_ACCESS_TOKEN:
|
|
|
|
description: The PAT for the local repository.
|
|
|
|
required: true
|
|
|
|
|
|
|
|
runs:
|
|
|
|
using: composite
|
|
|
|
steps:
|
|
|
|
- name: Update upstream branch
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
git --version
|
|
|
|
|
|
|
|
git config --global user.name '${{ gitea.actor }}'
|
|
|
|
git config --global user.email '${{ gitea.actor }}@michaelsasser.org'
|
|
|
|
git init -b '${{ inputs.downstream_repo_branch }}'
|
|
|
|
|
|
|
|
# Local
|
2024-11-23 22:08:12 +01:00
|
|
|
git remote add origin 'https://x-access-token:${{ inputs.PERSONAL_ACCESS_TOKEN }}@git.michaelsasser.org/${{ gitea.repository }}.git'
|
2024-11-23 21:59:43 +01:00
|
|
|
|
|
|
|
# Upstream
|
|
|
|
git remote add upstream ${{ inputs.upstream_repo_url }}
|
|
|
|
git fetch --no-tags upstream 'refs/heads/${{ inputs.upstream_repo_branch }}'
|
|
|
|
git reset --hard 'upstream/${{ inputs.upstream_repo_branch }}'
|
2024-11-24 10:56:16 +01:00
|
|
|
git push --set-upstream origin ${{ inputs.downstream_repo_branch }} --force
|