53 lines
1.4 KiB
YAML
53 lines
1.4 KiB
YAML
---
|
|
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
|
|
git remote add origin 'https://x-access-token:${{ inputs.PERSONAL_ACCESS_TOKEN }}@git.michaelsasser.org/${{ gitea.repository }}.git'
|
|
|
|
# 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 }}'
|
|
git push --set-upstream origin ${{ inputs.downstream_repo_branch }} --force
|