Fetch Upstream #995
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# fetch-upstream..yml | |
# | |
# Copyright (c) Microsoft Corporation. All rights reserved. | |
# | |
# Github action to push the latest upstream changes to our repo. | |
# | |
# Every day at midnight, run this. | |
name: Fetch Upstream | |
on: | |
schedule: | |
- cron: "0 0 * * *" | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
Refresh-Upstream: | |
name: update_upstream_branches | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
#ref: master | |
- name: Set repo name | |
run: echo "UPSTREAM_PROJECT_NAME=lustre-release" >> $GITHUB_ENV | |
- name: Set repo URL | |
run: echo "LUSTRE_UPSTREAM_URL=git://git.whamcloud.com/fs/$UPSTREAM_PROJECT_NAME.git" >> $GITHUB_ENV | |
- run: | | |
echo "Fetching branches and tags from $LUSTRE_UPSTREAM_URL" | |
#cd $UPSTREAM_PROJECT_NAME | |
git remote add upstream $LUSTRE_UPSTREAM_URL | |
git fetch upstream | |
git fetch --tags upstream | |
name: "Fetch the latest changes and tags from upstream" | |
- run: | | |
git push origin --tags | |
for b in $(ls .git/refs/remotes/upstream); do | |
echo "Pushing updates to branch $b" | |
git push -f origin upstream/${b}:refs/heads/upstream/${b}; | |
done | |
name: "Push tags and changes from the upstream branches" |