Skip to content

Create Pull Request with Markdown #18

Create Pull Request with Markdown

Create Pull Request with Markdown #18

name: Create Pull Request with Markdown
on:
workflow_dispatch:
workflow_run:
workflows: ["Generate Markdown"]
types:
- completed
jobs:
create-pr:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Download Artifact from First Repository
uses: dawidd6/action-download-artifact@v2
with:
workflow: generate_markdown.yml
name: markdown-artifact
repo: thutuva/personal-tuva-test
- name: Configure Git
run: |
git config user.name "thutuva"
git config user.email "thuxuan@tuvahealth.com"
- name: Commit and Push
run: |
UNIQUE_BRANCH="update-$(date +'%Y%m%d%H%M%S')"
echo "UNIQUE_BRANCH=$UNIQUE_BRANCH" >> $GITHUB_ENV
git checkout -b $UNIQUE_BRANCH
git add output.md
git commit -m "Add updated markdown file"
git push --set-upstream origin $UNIQUE_BRANCH
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "Add updated markdown file"
title: "Update Markdown File"
body: "This PR updates the markdown file."
branch: $UNIQUE_BRANCH