Auto Generator #196
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: Auto Generator | |
on: | |
push: | |
branches: | |
- AutoGenerator | |
schedule: | |
- cron: "0 0 * * 0" | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
Auto_Generator: | |
runs-on: ubuntu-latest | |
outputs: | |
changes_detected: ${{ steps.git_auto_commit.outputs.changes_detected }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: master | |
- name: Auto Generator | |
run: "chmod -R a+w AutoGenerator && docker run -v .:/output -v $PWD/AutoGenerator/AutoGenerator/appsettings.json:/app/appsettings.json ghcr.io/youtubeclipplaylist/playlistautogenerator" | |
- name: Git Auto Commit | |
id: git_auto_commit | |
uses: stefanzweifel/[email protected] | |
with: | |
branch: AutoGenerator | |
file_pattern: AutoGenerator | |
commit_message: "Github Action: Auto Generator" | |
commit_user_name: Github Action Bot # defaults to "GitHub Actions" | |
commit_author: Github Action Bot <[email protected]> # defaults to author of the commit that triggered the run | |
Auto_PR: | |
needs: Auto_Generator | |
if: needs.Auto_Generator.outputs.changes_detected == 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: AutoGenerator | |
- name: Create or Update Pull Request | |
env: | |
# Use CR_PAT to trigger another workflow | |
GH_TOKEN: ${{ secrets.CR_PAT }} | |
run: | | |
gh_pr_up() { | |
gh pr create "$@" || gh pr edit "$@" | |
} | |
gh_pr_up --title "AutoGenerator to master auto PR" \ | |
--body ":robot: Automated PR from **AutoGenerator** to **master**" \ | |
--label automerge \ | |
--base master \ | |
--head AutoGenerator | |
shell: bash |