Automatic Update from OpenAstronomy/packging-guide #43
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: Automatic Update from OpenAstronomy/packging-guide | |
permissions: | |
contents: write | |
pull-requests: write | |
on: | |
# Allow manual runs through the web UI | |
workflow_dispatch: | |
schedule: | |
# ┌───────── minute (0 - 59) | |
# │ ┌───────── hour (0 - 23) | |
# │ │ ┌───────── day of the month (1 - 31) | |
# │ │ │ ┌───────── month (1 - 12 or JAN-DEC) | |
# │ │ │ │ ┌───────── day of the week (0 - 6 or SUN-SAT) | |
- cron: '0 7 * * 1' # Every Monday at 7am UTC | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Add OpenAstronomy/packaging-guide remote | |
run: | | |
git remote add openastronomy https://github.com/OpenAstronomy/packaging-guide.git | |
git remote update | |
- name: Check if there are new commits in OpenAstronomy/packaging-guide | |
continue-on-error: false | |
id: check | |
run: | | |
CHANGES=0 | |
if [ "$(git rev-list HEAD..openastronomy/main --count)" -gt 0 ]; then | |
CHANGES=1 | |
fi | |
echo "has_changes=$CHANGES" >> "$GITHUB_OUTPUT" | |
- name: Merge in OpenAstronomy/packaging-guide | |
if: steps.check.outputs.has_changes == '1' | |
id: merge | |
continue-on-error: false | |
run: | | |
git config --global user.email "${{ github.actor }}@users.noreply.github.com" | |
git config --global user.name "${{ github.actor }}" | |
git merge --no-edit --no-commit openastronomy/main || true | |
if [[ -n $(git ls-files --unmerged) ]]; then | |
CONFLICTS=1 | |
# Commit the unresolved conflicts | |
git add . | |
git commit -m "Merge branch 'OpenAstronomy/main' into main (with unresolved conflicts)" | |
else | |
CONFLICTS=0 | |
# No conflicts, commit the merge | |
git commit -m "Merge branch 'OpenAstronomy/main' into main" | |
fi | |
echo "has_conflicts=$CONFLICTS" >> "$GITHUB_OUTPUT" | |
- name: Create pull request | |
if: steps.check.outputs.has_changes == '1' | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
draft: ${{ steps.merge.outputs.has_conflicts == '1' }} | |
delete-branch: true | |
branch-suffix: timestamp | |
title: "Updates from OpenAstronomy/packaging-guide" | |
body: | | |
This is an autogenerated PR, which merges commits from OpenAstronomy/packaging-guide. | |
${{ steps.merge.outputs.has_conflicts == '1' && '**These changes have conflicts that need to be manually resolved.**' || '' }} | |
*Do not squash merge this PR! All commits from upstream should be present in the repos history.* |