GitHub Action
Pull Detached Remote
Warning: Deprecated
This action is deprecated and can easily be replaced by a simpler alternative workflow
Creates a branch with updates from a detached (not actively set) upstream of a repo and a corresponding PullRequest
If you don't understand the quick summary read the following:
This action was mainly created for the following use-case:
You have a GitHub repo that is not directly linked via an upstream-remote This can be achieved by
- duplicating a repo or
- forking a repo and removing it's upstream remote
Now you wan't to update this repo from it's "upstream" (which is not actively set / detached).
You can do that manually, but after some time (especially when there are more often commits on the "upstream"), you definetly wan't to do that automated.
An here this action comes into spotlight.
It automatically updates your "detached upstream":
Firstly it checks if there are new commits on the upstream.
When there are new ones, it creates a new branch and a pull request.
The action is based on PullDetachedRemote
A simple worfklow example:
name: Pull detached upstream automatically from https://github.com/<owner>/<repo>
on:
# Possibility to run it manually
workflow_dispatch:
# Automated
schedule:
# Run this every day at 02:22 UTC
- cron: '22 2 * * *'
jobs:
build:
runs-on: ubuntu-latest
steps:
# Checkout the current repo
- uses: actions/checkout@v2
# Fetch the history and unshallow the repo so that it can be used
- name: Fetch all history for all tags and branches
run: git fetch --prune --unshallow
# Pull the detached remote and do the magic
- name: Pull Detached Remote
uses: litetex/pull-detached-remote@<VERSIONTAG>
with:
upstreamrepo: https://github.com/<owner>/<repo>
upstreambranch: <branchname>
env:
GITHUB_PAT: ${{ secrets.GH_PAT }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
→ see also Configuration.cs
→ see action.yml
Variable | State | Description | Notes |
---|---|---|---|
GITHUB_PAT | Required | A personal access token, that is used for git modifications of the targeted repo |
This is the fallback if no GITHUB_TOKEN is set Add it to the secrets GitHub Documentation |
GITHUB_TOKEN | Recommended | A token automatically created by GitHub for workflows on the current repo |
If not set, the owner of the GITHUB_PAT will be the author of the pull request GitHub Documentation |
DETACHED_CREDS_PRINCIPAL | Optional | Principal/Username (if you have a token, use it here and leave password blank) |
Only required if a repository outside of GitHub has to be authenticated Only used if:
|
DETACHED_CREDS_PW | Optional | Password | |
NO_PR_STATUS | Optional | Disables the status message in the pull request | Valid values: 1 or true |
NO_CREDITS | Optional | Disables the credits in the pull request | Valid values: 1 or true |
Here you can find a demo implementations: