# This is a basic workflow to help you get started with Actions

name: New Weeknotes Post

# Controls when the workflow will run
on:
  # Run every Sunday at midnight UTC
  schedule:
    - cron: "0 0 * * SUN"

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v2

      # Runs a single command using the runners shell
      - name: Create a new weeknotes file
        run: ./scripts/next_weeknotes_post.sh
      
      # Set up Git for committing
      - name: Set up git config
        run: |
          git config user.name "Adam Lukens"
          git config user.email "<adam.lukens@mcpolemic.com>"
      
      # Commit the new weeknotes and open a pull request
      - name: Commit the new weeknotes
        run: |
          git add .
          git commit -m "Add weeknotes post for $(date --iso-8601)"
          git push -u origin $(date --iso-8601)-weeknotes
          gh pr create -f --assignee @me

# This is a basic workflow to help you get started with Actions

name: New Weeknotes Post

# Controls when the workflow will run
on:
  # Run every Sunday at midnight UTC
  schedule:
    - cron: "0 0 * * SUN"

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v2

      # Set up Git for committing
      - name: Set up git config
        run: |
          git config user.name "Adam Lukens"
          git config user.email "<adam.lukens@mcpolemic.com>"

      - name: Create and commit the new weeknotes
        run: |
          git checkout -b $(date --iso-8601)-weeknotes
          ./scripts/next_weeknotes_post.sh      
          git add .
          git commit -m "Add weeknotes post for $(date --iso-8601)"
          git push -u origin HEAD
          gh pr create -f --assignee @me

Set up branch for new weeknotes
Set up branch for new weeknotes