Skip to content

Add Daily Article Manual #11

Add Daily Article Manual

Add Daily Article Manual #11

name: Add Daily Article Manual
on:
workflow_dispatch:
jobs:
add-article:
name: Create pull request to add today's article
permissions:
pull-requests: write # for repo-sync/pull-request to create a PR
contents: write # for repo-sync/pull-request to create a PR
runs-on: ubuntu-latest
steps:
- name: Get current date
id: date
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
- uses: actions/checkout@v3
with:
ref: website
submodules: true
- uses: coursier/cache-action@v6
- uses: VirtusLab/[email protected]
with:
jvm: "temurin:17"
- name: Generate todays article
run: scala-cli run .github/workflows/scripts/addDay.scala
- name: Push article to new branch
run: |
git config user.name gh-actions
git config user.email [email protected]
git checkout -b "add-article-${{ steps.date.outputs.date }}"
git add .
if ! git diff-index --quiet HEAD; then
git commit -m "Add article of ${{ steps.date.outputs.date }}"
git push --set-upstream origin add-article-${{ steps.date.outputs.date }}
fi
- name: Create PR to merge article
uses: repo-sync/pull-request@v2
with:
source_branch: add-article-${{ steps.date.outputs.date }}
destination_branch: website
pr_title: Add advent of code article for ${{ steps.date.outputs.date }}
pr_body: |
This PR was automatically generated to add the article of today.
pr_assignee: ${{ github.event.head_commit.author.username }}