Update nightly from develop #61
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
name: Update nightly from develop | |
on: | |
schedule: | |
- cron: '7 1 * * *' | |
workflow_dispatch: | |
inputs: | |
force: | |
type: boolean | |
description: Forcibly reset Nightly to Develop? | |
default: false | |
jobs: | |
make_nightly: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: develop | |
fetch-depth: 0 | |
- name: Fetch all branches | |
run: git fetch --all | |
- name: Determine if develop is ahead of nightly | |
if: inputs.force != 'true' | |
id: compare_branches | |
run: | | |
if git rev-list --left-right --count origin/develop...origin/nightly | grep -q "0$"; then | |
if git rev-list --left-right --count origin/develop...origin/nightly | grep -qv "^0"; then | |
echo "behind=true" >> $GITHUB_OUTPUT | |
else | |
echo "behind=false" >> $GITHUB_OUTPUT | |
fi | |
else | |
echo "There are changes to Nightly that are not in develop, we can't automatically update" | |
echo "To forcibly reset Nightly please have an admin run this action with 'force' enabled" | |
exit 1 | |
fi | |
- name: Fast-forward nightly branch if behind develop | |
if: steps.compare_branches.outputs.behind == 'true' | |
run: | | |
git checkout nightly | |
git merge develop --ff-only | |
git push origin nightly | |
env: | |
GITHUB_TOKEN: ${{ secrets.OPENMS_GITHUB_APP_PRIVATE_KEY }} | |
- name: Forcibly reset nightly | |
if: inputs.force | |
run: | | |
git checkout nightly | |
git reset --hard develop | |
git push origin nightly -f | |
env: | |
GITHUB_TOKEN: ${{ secrets.OPENMS_GITHUB_APP_PRIVATE_KEY }} |