Automated Pull Request From main to feature/test Branch #1291
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: Test 2 | |
on: | |
workflow_dispatch: | |
inputs: | |
body: | |
description: "" | |
default: "" | |
required: false | |
test: | |
description: "" | |
default: "false" | |
required: false | |
pull_request_target: | |
jobs: | |
job1: | |
runs-on: ubuntu-latest | |
steps: | |
- name: replacement | |
run: | | |
VARIABLE=my-repo-test | |
echo "${VARIABLE//-/_}" | |
DB_NAME=$GITHUB_REPOSITORY | |
TEST="${DB_NAME//-/_}" | |
echo $TEST | |
check-body-length: | |
runs-on: ubuntu-latest | |
steps: | |
- name: check | |
env: | |
PRNUM: ${{ github.event.pull_request.number }} | |
PRBODY: ${{ github.event.pull_request.body }} | |
TESTBODY: ${{ github.event.inputs.body }} | |
TEST: ${{ github.event.inputs.test }} | |
run: | | |
if [ "$TEST" = "true" ] | |
then | |
PRBODY=$TESTBODY | |
fi | |
commentPR () { | |
if [ "$TEST" = "true" ] | |
then | |
echo "would comment: '${1}'" | |
else | |
gh pr comment $PRNUM -b "${1}" | |
fi | |
} | |
if [ "$PRBODY" = "" ] | |
then | |
commentPR "Thanks! Please add a body so we can better review your contribution." | |
fi |