Skip to content

Commit

Permalink
Add inputs/outputs to upgrade action (#241)
Browse files Browse the repository at this point in the history
Per a user request, adds the following:
- Input for assignees
- Input to override the default created branch name
- Output the PR number and other PR info for consumption from other
actions

Verified
[run](https://github.com/trunk-io/trunk-action/actions/runs/9038985803/job/24841100064)
  • Loading branch information
TylerJang27 committed May 14, 2024
1 parent 4a49915 commit d5b1b61
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/weekly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
private_key: ${{ secrets.TRUNK_OPEN_PR_APP_PRIVATE_KEY }}

- name: Trunk Upgrade
id: upgrade
uses: ./upgrade # external users: use trunk-io/trunk-action/upgrade@v1
with:
github-token: ${{ steps.generate-token.outputs.token }}
Expand Down
30 changes: 29 additions & 1 deletion upgrade/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ inputs:
required: false
default: "false"

branch-name:
description: The branch name to generate the PR from
default: trunk-io/update-trunk
required: false

assignees:
description: A comma or newline separated list of GitHub assignee usernames
required: false

reviewers:
description: A comma or newline separated list of GitHub reviewer usernames
required: false
Expand All @@ -61,6 +70,23 @@ inputs:
description: A boolean to add a Signed-off-by line to the commit message
required: false
default: false
outputs:
pull-request-number:
description: The pull request number
value: ${{ steps.cpr.outputs.pull-request-number }}

pull-request-url:
description: The URL of the pull request.
value: ${{ steps.cpr.outputs.pull-request-url }}

pull-request-operation:
description:
The pull request operation performed by the action, `created`, `updated` or `closed`.
value: ${{ steps.cpr.outputs.pull-request-operation }}

pull-request-head-sha:
description: The commit SHA of the pull request branch.
value: ${{ steps.cpr.outputs.pull-request-head-sha }}

runs:
using: composite
Expand Down Expand Up @@ -115,16 +141,18 @@ runs:
${{ github.action_path }}/../cleanup.sh
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v6
with:
title: ${{ inputs.prefix }}${{ env.PR_TITLE }}
body: ${{ env.PR_DESCRIPTION }}
base: ${{ inputs.base }}
branch: trunk-io/update-trunk
branch: ${{ inputs.branch-name }}
labels: trunk
add-paths: ${{ inputs.add-paths }}
commit-message: ${{ inputs.prefix }}${{ env.PR_TITLE }}
delete-branch: true
assignees: ${{ inputs.assignees }}
reviewers: ${{ inputs.reviewers }}
token: ${{ inputs.github-token }}
signoff: ${{ inputs.signoff }}

0 comments on commit d5b1b61

Please sign in to comment.