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

gh-actions/github/pr: Updates/cleanups #881

Merged
merged 1 commit into from
Oct 23, 2023
Merged
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
54 changes: 41 additions & 13 deletions gh-actions/github/pr/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,27 @@ inputs:
required: true
body:
type: string
required: true
branch:
type: string
required: true
committer-name:
type: string
required: true
committer-email:
type: string
required: true
commit:
type: boolean
default: true
title:
type: string
required: true
GITHUB_TOKEN:
type: string
required: true

committer-message:
append-commit-message:
type: boolean
default: false
committer-name:
type: string
committer-email:
type: string
commit-message:
type: string
working-directory:
type: string
Expand All @@ -32,23 +35,48 @@ runs:
using: composite
steps:
- run: |
git checkout -b "$BRANCH_NAME"
name: Checkout branch (${{ inputs.branch }})
working-directory: ${{ inputs.working-directory }}
shell: bash
env:
BRANCH_NAME: ${{ inputs.branch }}
- run: |
echo "COMMIT: ${{ inputs.commit }}"
git config --global user.name "$COMMITTER_NAME"
git config --global user.email "$COMMITTER_EMAIL"
git checkout -b "$BRANCH_NAME"
git commit . -m "$COMMIT_MESSAGE"
if: ${{ inputs.commit && inputs.commit != 'false' }}
env:
COMMITTER_NAME: ${{ inputs.committer-name }}
COMMITTER_EMAIL: ${{ inputs.committer-email }}
COMMIT_MESSAGE: ${{ inputs.commit-message || inputs.title }}
name: Commit changes
working-directory: ${{ inputs.working-directory }}
shell: bash
- run: |
LAST_COMMIT=$(git log -1 --pretty=%B | tail -n +2)
echo "text<<nEOFn" >> $GITHUB_OUTPUT
echo "${LAST_COMMIT}" >> $GITHUB_OUTPUT
echo "nEOFn" >> $GITHUB_OUTPUT
id: body
if: ${{ inputs.append-commit-message }} != 'false'
env:
PR_BODY: ${{ inputs.body }}
shell: bash
- run: |
git push --no-verify --set-upstream origin "$BRANCH_NAME"
gh pr create \
-B "$BASE_BRANCH" \
-H "$BRANCH_NAME" \
--title "$PR_TITLE" \
--body "$PR_BODY"
env:
COMMITTER_NAME: ${{ inputs.committer-name }}
COMMITTER_EMAIL: ${{ inputs.committer-email }}
GH_TOKEN: ${{ inputs.GITHUB_TOKEN }}
PR_TITLE: ${{ inputs.title }}
PR_BODY: ${{ inputs.body }}
COMMIT_MESSAGE: ${{ inputs.commit-message || inputs.title }}
PR_BODY: |
${{ inputs.body }}
${{ steps.body.outputs.text }}
BRANCH_NAME: ${{ inputs.branch }}
BASE_BRANCH: ${{ inputs.base }}
name: Create a PR
Expand Down