Weekly PR #24
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: Weekly PR | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * 0' | |
jobs: | |
create-pr: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Change to repository directory | |
run: cd $GITHUB_WORKSPACE | |
- name: Fetch latest changes | |
run: git fetch | |
- name: Check if dev branch exists | |
run: | | |
if [[ ! $(git show-ref --quiet refs/heads/dev) ]]; then | |
echo "dev branch does not exist" | |
echo "Creating dev branch" | |
git checkout -b dev | |
git push -u origin dev | |
else | |
echo "dev branch already exists" | |
git checkout dev | |
git pull origin dev | |
fi | |
- name: Add dummy commit to dev branch to show changes | |
run: echo "Dummy commit" >> dummy-file.txt && git add dummy-file.txt && git commit -m "Dummy commit" && git push origin dev | |
- name: Render template | |
id: render-template | |
uses: chuhlomin/[email protected] | |
with: | |
template: .github/WEEKLY_PULL_REQUEST_TEMPLATE.md | |
- name: Create PR | |
uses: peter-evans/create-pull-request@v3 | |
with: | |
branch: 'dev' | |
base: 'main' | |
title: "Weekly PR - $(date +'%d %B %Y')" | |
body: ${{ steps.render-template.outputs.result }} | |
delete-branch: true |