Skip to content

Commit

Permalink
fix: add title and body tests (#11)
Browse files Browse the repository at this point in the history
* fix: add title and body tests

Signed-off-by: Steffen Tautenhahn <stevie-@users.noreply.github.com>

* fix: fail on error

Signed-off-by: Steffen Tautenhahn <stevie-@users.noreply.github.com>

* fix: run all tests on errors

Signed-off-by: Steffen Tautenhahn <stevie-@users.noreply.github.com>

* fix: if one of title or body is not set, add fill

Signed-off-by: Steffen Tautenhahn <stevie-@users.noreply.github.com>

---------

Signed-off-by: Steffen Tautenhahn <stevie-@users.noreply.github.com>
  • Loading branch information
stevie- authored Feb 16, 2024
1 parent 18dbd9e commit 180cf60
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 132 deletions.
40 changes: 0 additions & 40 deletions .github/workflows/macos_action_test.yml

This file was deleted.

47 changes: 47 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Action test
on:
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
pull-requests: write

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
test:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: ./
name: test-min
if: failure() || success()
- uses: ./
name: test-title-only
if: failure() || success()
with:
pr_title: "Pulling ${{ github.ref_name }} into main"
- uses: ./
name: test-body-only
if: failure() || success()
with:
pr_body: "Pulling ${{ github.ref_name }} into main"
- uses: ./
name: test-max
if: failure() || success()
with:
pr_title: "Pulling ${{ github.ref }} into main"
pr_body: "An automated PR"
pr_reviewer: "GuillaumeFalourd"
pr_assignee: "GuillaumeFalourd"
pr_label: "test"
pr_milestone: "Milestone 1"
pr_draft: true
pr_allow_empty: true
44 changes: 0 additions & 44 deletions .github/workflows/ubuntu_action_test.yml

This file was deleted.

40 changes: 0 additions & 40 deletions .github/workflows/windows_action_test.yml

This file was deleted.

13 changes: 5 additions & 8 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -183,14 +183,11 @@ runs:
declare -a COMMAND
COMMAND+=(gh pr create --base $DESTINATION_BRANCH --head $SOURCE_BRANCH --no-maintainer-edit)
if [[ ! -z "${INPUT_PR_TITLE}" ]]; then
COMMAND+=(--title "${INPUT_PR_TITLE}")
else
if [[ -z "${INPUT_PR_TITLE}" ]] && [[ -z "${INPUT_PR_BODY}" ]]; then
COMMAND+=(--fill)
fi
if [[ ! -z "${INPUT_PR_BODY}" ]]; then
COMMAND+=(--body "${INPUT_PR_BODY}")
else
[[ -n "${INPUT_PR_TITLE}" ]] && COMMAND+=(--title "${INPUT_PR_TITLE}") || COMMAND+=(--fill)
[[ -n "${INPUT_PR_BODY}" ]] && COMMAND+=(--body "${INPUT_PR_BODY}") || COMMAND+=(--fill)
fi
if [[ ! -z "${INPUT_PR_REVIEWER}" ]]; then
Expand Down Expand Up @@ -239,6 +236,7 @@ runs:
if [[ "$pr_command_exit_code" != "0" && "$pr_already_exists" -eq 0 ]]; then
echo_error "Failed to create pull request. Exit code: $pr_command_exit_code. Error: $pr_command_error"
exit $pr_command_exit_code
else
# assume that if we got here, a PR was created or exists
echo_success "Pull request created or exists: $pr_url"
Expand All @@ -257,7 +255,6 @@ runs:
echo "::endgroup::"
branding:
icon: 'git-pull-request'
color: 'blue'

0 comments on commit 180cf60

Please sign in to comment.