-
-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
86 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: github_app_token | ||
description: Create a token for making Pull Requests | ||
|
||
# Note: this just calls tibdex/github-app-token, but it allows us to keep it in one place. | ||
|
||
inputs: | ||
app_id: | ||
description: Application ID used to make the PR | ||
required: true | ||
app_private_key: | ||
description: Application Private Key used to sign the PR | ||
required: true | ||
outputs: | ||
token: | ||
description: A token for making Pull Requests | ||
value: ${{ steps.generate-token.outputs.token }} | ||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: tibdex/github-app-token@021a2405c7f990db57f5eae5397423dcc554159c # v1.5 # cspell:ignore tibdex | ||
id: generate-token | ||
with: | ||
app_id: ${{ inputs.app_id }} | ||
private_key: ${{ inputs.app_private_key }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: create_pr | ||
description: Create A Pull Request That will Trigger Workflows | ||
inputs: | ||
base: | ||
description: The Base Ref to apply the diff | ||
required: false | ||
body: | ||
description: Optional body of the PR | ||
required: false | ||
commit-message: | ||
description: Commit Message for the PR | ||
required: true | ||
branch: | ||
description: The Branch to create for the PR | ||
required: true | ||
title: | ||
description: PR title - defaults to commit-message | ||
required: false | ||
app_id: | ||
description: Application ID used to make the PR | ||
required: true | ||
app_private_key: | ||
description: Application Private Key used to sign the PR | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Has changes | ||
shell: bash | ||
run: | | ||
git --no-pager diff --compact-summary --exit-code && echo "git_status=clean" >> $GITHUB_ENV || echo "git_status=dirty" >> $GITHUB_ENV | ||
git --no-pager diff --compact-summary | ||
- name: Echo git_status | ||
shell: bash | ||
run: echo "${{ env.git_status }}" | ||
|
||
- name: Body | ||
shell: bash | ||
env: | ||
git_body: ${{ inputs.body }} | ||
run: | | ||
echo "$git_body" | ||
- uses: ./.github/actions/github-app-token | ||
if: env.git_status == 'dirty' | ||
id: generate-token | ||
with: | ||
app_id: ${{ inputs.app_id }} | ||
app_private_key: ${{ inputs.app_private_key }} | ||
|
||
- name: Create Pull Request | ||
if: env.git_status == 'dirty' | ||
uses: peter-evans/create-pull-request@2b011faafdcbc9ceb11414d64d0573f37c774b04 # v4 | ||
with: | ||
commit-message: ${{ inputs.commit-message }} | ||
branch: ${{ inputs.branch }} | ||
base: ${{ inputs.base }} | ||
title: ${{ inputs.title || inputs.commit-message }} | ||
token: ${{ steps.generate-token.outputs.token }} | ||
body: ${{ inputs.body }} | ||
delete-branch: true |