Create Newsletter #8
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 Newsletter | |
on: | |
schedule: | |
# Run on the 3rd of every month at 9 am | |
- cron: "0 9 3 * *" | |
workflow_dispatch: | |
inputs: {} | |
permissions: | |
contents: write | |
issues: write | |
pull-requests: write | |
jobs: | |
create-newsletter: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: source | |
- name: Set environment variables | |
run: | | |
echo "NEWSLETTER_MONTH=$(date +'%B')" >> $GITHUB_ENV | |
echo "NEWSLETTER_NEXT_MONTH=$(date -d' 1 month ' +'%B')" >> $GITHUB_ENV | |
echo "NEWSLETTER_NEXT_MONTH_NUMBER=$(date -d' 1 month ' +'%m')" >> $GITHUB_ENV | |
echo "NEWSLETTER_YEAR=$(date +'%Y')" >> $GITHUB_ENV | |
# take the amount of months since feb 2024 and add 50 | |
echo "NEWSLETTER_COUNTER=$(( ( ( $(date +'%Y') - 2024 ) * 12 + $(date +'%m') - 4 ) + 50 ))" >> $GITHUB_ENV | |
- name: Create newsletter scaffold | |
run: ./.github/create_newsletter_scaffold.sh | |
- name: Commit and create pull request | |
uses: peter-evans/create-pull-request@v3 | |
with: | |
commit-message: "Create newsletter N${{ env.NEWSLETTER_COUNTER }} for ${{ env.NEWSLETTER_MONTH }} ${{ env.NEWSLETTER_YEAR }}" | |
branch: "start-newsletter-${{ env.NEWSLETTER_COUNTER }}" | |
title: "Newsletter N${{ env.NEWSLETTER_COUNTER }} for ${{ env.NEWSLETTER_MONTH }} ${{ env.NEWSLETTER_YEAR }}" | |
body: "This PR adds the initial newsletter source file for ${{ env.NEWSLETTER_MONTH }} ${{ env.NEWSLETTER_YEAR }}." | |
assignees: | | |
AngelOnFira | |
janhohenheim | |
mamaicode | |
- name: Create tracking issue | |
uses: JasonEtco/create-an-issue@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
filename: .github/newsletter-issue-template.md |