Bump pascalgn/automerge-action from 0.13.1 to 0.16.4 #13
Workflow file for this run
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: PR Generator CI | |
on: | |
push: | |
branches-ignore: | |
- main | |
- production | |
jobs: | |
auto-pull-request: | |
name: PullRequestAction | |
runs-on: ubuntu-latest | |
steps: | |
- name: Generate branch name | |
uses: actions/github-script@v3 | |
id: set-branch-name | |
with: | |
script: | | |
const capitalize = (name) => name.charAt(0).toUpperCase() + name.slice(1); | |
const emoji = context.payload.ref.startsWith("refs/heads/feature") | |
? "✨ " | |
: context.payload.ref.startsWith("refs/heads/hotfix") | |
? "🚑 " | |
: context.payload.ref.startsWith("refs/heads/bug") | |
? "🐛 " | |
: ""; | |
return `${emoji}${capitalize( | |
context.payload.ref | |
.replace("refs/heads/", "") | |
.replace(/-/g, " ") | |
.replace("feature ", "") | |
.replace("bug ", "") | |
.replace("hotfix ", "") | |
)}`; | |
result-encoding: string | |
- name: Set branch name | |
run: | |
echo "PULL_REQUEST_TITLE=${{steps.set-branch-name.outputs.result}}" >> | |
$GITHUB_ENV | |
- name: Generate PR body | |
uses: actions/github-script@v3 | |
id: set-pr-body | |
with: | |
script: | | |
return `I'm opening this pull request for this branch, pushed by @${ | |
context.payload.head_commit.author.username | |
} with ${context.payload.commits.length} commit${ | |
context.payload.commits.length === 1 ? "" : "s" | |
}.`; | |
result-encoding: string | |
- name: Set PR body | |
run: | |
echo "PULL_REQUEST_BODY=${{steps.set-pr-body.outputs.result}}" >> | |
$GITHUB_ENV | |
- name: Generate PR draft | |
uses: actions/github-script@v3 | |
id: set-pr-draft | |
with: | |
script: | | |
return !context.payload.ref.startsWith("refs/heads/hotfix"); | |
- name: Set PR draft | |
run: | |
echo "PULL_REQUEST_DRAFT=${{steps.set-pr-draft.outputs.result}}" >> | |
$GITHUB_ENV | |
- name: Determine whether to merge | |
uses: actions/github-script@v3 | |
id: should-pr | |
with: | |
github-token: ${{ secrets.GH_TOKEN }} | |
script: | | |
return | |
context.payload.ref.startsWith("refs/heads/feature") || | |
context.payload.ref.startsWith("refs/heads/hotfix") || | |
context.payload.ref.startsWith("refs/heads/bug"); | |
- name: pull-request-action | |
uses: vsoch/[email protected] | |
if: always() && steps.should-pr.outputs.result | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
PULL_REQUEST_BRANCH: 'main' | |
PULL_REQUEST_REVIEWERS: 'vixshan' | |