Create PR from Staging to Master #15
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: Create PR from Staging to Master | |
on: | |
schedule: | |
- cron: '0 18 * * SUN' | |
pull_request: | |
types: | |
- synchronize | |
jobs: | |
create-pr: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Check for pending commits | |
id: check-commits | |
run: | | |
COMMIT_DIFF=$(git log --pretty=format:'' staging..master) | |
if [[ -z "$COMMIT_DIFF" ]]; then | |
echo "No pending commits. Skipping workflow." | |
exit 78 | |
fi | |
- name: Create PR | |
if: steps.check-commits.outcome != 'failure' | |
uses: peter-evans/create-pull-request@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
title: Staging -> Master | |
body: | | |
${{ steps.get-commit-messages.outputs.commit-messages }} | |
branch: staging | |
base: master | |
- name: Get commit messages | |
id: get-commit-messages | |
run: | | |
COMMIT_MESSAGES=$(git log --pretty=format:'%s' staging..master) | |
echo "::set-output name=commit-messages::$COMMIT_MESSAGES" |