Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add title and body options (create-scaffold-pr) #1550

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions create-scaffold-pr/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ inputs:
If skip_create_pr is false
pull-requests:write - Create pull requests
required: true
pull-request-title:
description: The title of the pull request. This should be a single-line string for gh command.
required: false
default: Scaffold a working directory
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$TFACTION_TARGET is missed.
It's good to support any template notation.

pull-request-body:
description: The body of the pull request. This should be a single-line string for gh command.
required: false
default: This pull request was created by [GitHub Actions](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
runs:
using: composite
steps:
Expand Down Expand Up @@ -50,19 +58,21 @@ runs:
$CODE_BLOCK
gh pr create -R "$GITHUB_REPOSITORY" $draft_pr\\
-H "${{steps.branch.outputs.branch}}" \\
-t "Scaffold a working directory (${TFACTION_TARGET})" \\
-b "This pull request was created by [GitHub Actions]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID)"
-t '$PULL_REQUEST_TITLE' \\
-b '$PULL_REQUEST_BODY'
$CODE_BLOCK

[Reference](https://suzuki-shunsuke.github.io/tfaction/docs/feature/skip-creating-pr)
EOS
if: "fromJSON(steps.global-config.outputs.skip_create_pr)"
shell: bash
env:
PULL_REQUEST_TITLE: ${{ inputs.pull-request-title }} (${{ env.TFACTION_TARGET }})
PULL_REQUEST_BODY: ${{ inputs.pull-request-body }}
CODE_BLOCK: "```"

- run: |
opts=(-H "${{steps.branch.outputs.branch}}" -a "$GITHUB_ACTOR" -t "Scaffold a working directory (${TFACTION_TARGET})" -b "@$GITHUB_ACTOR This pull request was created by GitHub Actions workflow_dispatch event $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID")
opts=(-H "${{steps.branch.outputs.branch}}" -a "$GITHUB_ACTOR" -t "$PULL_REQUEST_TITLE" -b "@$GITHUB_ACTOR $PULL_REQUEST_BODY")
if [ "${{steps.global-config.outputs.draft_pr}}" = "true" ]; then
opts+=( -d )
fi
Expand All @@ -71,3 +81,5 @@ runs:
if: "!fromJSON(steps.global-config.outputs.skip_create_pr)"
env:
GITHUB_TOKEN: ${{ inputs.github_token }}
PULL_REQUEST_TITLE: ${{ inputs.pull-request-title }} (${{ env.TFACTION_TARGET }})
PULL_REQUEST_BODY: ${{ inputs.pull-request-body }}