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

CI: Create workflow to rebase this fork to the latest upstream tag #57

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/upstream-rebase.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: "Rebase fork from upstream"
on:
schedule:
- cron: '0 8 * * *' # Every day on 8:00 UTC
pull_request:
paths:
- '.github/workflows/upstream-rebase.yml'
push:
paths:
- '.github/workflows/upstream-rebase.yml'
workflow_dispatch:

jobs:
upstream-rebase:
# Only run if either on the scipy/HiGHS repo or if the event is not scheduled
# This prevents running scheduled jobs on forks
if: github.repository == 'scipy/HiGHS' || github.event_name != 'schedule'
runs-on: ubuntu-latest
steps:
# Checkout this repo
- uses: actions/checkout@v3
# Get the latest version tag from the upstream
- run: git remote add upstream https://github.com/ERGO-Code/HiGHS.git
- run: git fetch upstream
- run: |
echo "latestTag=$(git tag -l --sort -version:refname | head -n 1)" >> $GITHUB_ENV
echo "$latestTag"
# Rebase from the main branch to the latest tag
- run: git fetch origin
- run: git checkout main
- run: git rebase upstream/$latestTag
- run: git push -f origin main
# Create a Pull request to pull the new tag into the main branch
- uses: peter-evans/create-pull-request@v4
with:
title: "Rebase fork from upstream to $latestTag"
base: main
branch: upstream-rebase
commit-message: "[Bot] Rebase fork from upstream to $latestTag"