Merge pull request #149 from lsst-dm/u/womullan/2024Apr #161
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: Trigger document updates | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
update-docs: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
repo: [lsst-sitcom/sitcomtn-052, lsst-dm/dmtn-158, lsst/ldm-564, lsst/ldm-503] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.WOM_MILESTONES_PAT }} | |
repository: ${{ matrix.repo }} | |
fetch-depth: 0 | |
submodules: true | |
- name: Update milestones submodule | |
run: git submodule update --remote --force milestones | |
- name: Check diff | |
run: | # set an environment variable | |
if git diff --exit-code; then | |
echo "CHANGED=false" >> ${GITHUB_ENV} | |
echo "No changes - no PR" | |
else | |
echo "CHANGED=true" >> ${GITHUB_ENV} | |
echo "Git changes - should make PR" | |
fi | |
- name: Create commit | |
if: env.CHANGED == 'true' | |
run: | | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git add milestones | |
git commit -m "Update milestones submodule" | |
- name: Get date | |
id: get-date | |
run: echo "::set-output name=date::$(/bin/date -u "+%Y-%m-%d %H:%M:%S")" | |
shell: bash | |
- name: Create Pull Request | |
id: cpr | |
if: env.CHANGED == 'true' | |
uses: peter-evans/create-pull-request@v4 | |
with: | |
token: ${{ secrets.WOM_MILESTONES_PAT }} | |
#IF i leave someone needs to make a new PAT | |
branch: update-milestones | |
branch-suffix: short-commit-hash | |
title: Automatic milestone submodule update, ${{ steps.get-date.outputs.date }} | |
commit-message: Auto Milestones submodule update | |
body: Update milestones submodule so doc is regenerated. | |
# auto merge for dmtn-232 is a too public so will manually check and merge it | |
- name: Enable Pull Request Automerge | |
if: steps.cpr.outputs.pull-request-operation == 'created' | |
uses: peter-evans/enable-pull-request-automerge@v1 | |
# requires branch protection | |
with: | |
token: ${{ secrets.WOM_MILESTONES_PAT }} | |
repository: ${{ matrix.repo }} | |
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }} | |
merge-method: merge |