Create a GitHub PR
Table of Contents
Option 1: Create PR with gh CLI
1- name: Commit & Push2 env:3 TZ: 'Asia/Tokyo'4 GITHUB_TOKEN: ${{ secrets.SUPER_SECRET_TOKEN_OF_DOOM }}5 run: |6 DATE="$(date +"%Y%m%d%H%M")"7 BRANCH_NAME="release-$DATE"8 git config user.name "github-actions[bot]"9 git config user.email "noreply@somewhere-magical.com"10 git checkout -b "$BRANCH_NAME"11 git add -A12 git commit -m "$BRANCH_NAME"13 git push origin "$BRANCH_NAME"14 gh pr create \15 -t "Update ${GITHUB_REPO} image to ${BRANCH_NAME}" \16 -F .github/pull_request_template.md \17 -a "${AUTHOR}" \18 -r "${REVIEWER}" \19 -B master \20 -H "$(git branch --show-current)"
Option 2: Create PR with peter-evans/create-pull-request
1- name: Create Pull Request2 uses: peter-evans/create-pull-request@v53 with:4 token: ${{ secrets.MAGICAL_AUTOMATION_TOKEN }}5 commit-message: 'Chore: summon new image from the CI cauldron'6 base: master7 branch: ${{ env.BRANCH_NAME }}8 title: "Update image – nothing's broken, promise"9 body: >10 Just your regular PR, no dragons, no production impact.11 (Probably.)12 labels: |13 automation14 reviewers: |15 'team-rocket'
