Skip to content

Commit

Permalink
Merge pull request #73 from lsst-dm/u/womullan/trigger
Browse files Browse the repository at this point in the history
U/womullan/trigger
  • Loading branch information
womullan committed Jun 22, 2022
2 parents c8d5a73 + 8e47e4b commit fa5ded7
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions .github/workflows/trigger-updates.yaml
@@ -1,7 +1,7 @@
name: Trigger document updates

on:
push:
pull_request:
branches:
- main

Expand All @@ -22,22 +22,50 @@ jobs:
- 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"
git push
- 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
uses: peter-evans/create-pull-request@v3
id: cpr
if: env.CHANGED == 'true'
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.ROBO_JDS_PAT }}
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.


- 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

0 comments on commit fa5ded7

Please sign in to comment.