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

feat: support 'null' body #157

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<p>
<a href="https://github.com/actions/typescript-action/actions"><img alt="typescript-action status" src="https://github.com/lucasmotta/pull-request-sticky-header/workflows/build/badge.svg"></a>
<a href="https://github.com/actions/typescript-action/actions"><img alt="typescript-action status" src="https://github.com/kyranjamie/pull-request-fixed-header/workflows/build/badge.svg"></a>
<a href="http://www.wtfpl.net/about/"><img alt="License WTFPL" src="https://img.shields.io/badge/License-WTFPL-brightgreen.svg"></a>
</p>

# Pull Request Sticky Header
# Pull Request fixed Header

> Keep a custom message on the top of your PR description

This Action is heavily inspired by [sticky-pull-request-comment](https://github.com/marocchino/sticky-pull-request-comment), but instead of having a separated comment, I wanted to update the PR's description instead.
This Action is heavily inspired by [fixed-pull-request-comment](https://github.com/marocchino/fixed-pull-request-comment), but instead of having a separated comment, I wanted to update the PR's description instead.

```yml
name: PRSH example
Expand All @@ -20,7 +20,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: lucasmotta/pull-request-sticky[email protected]
- uses: kyranjamie/pull-request-fixed[email protected]
with:
header: '> 🚀 This message is automated and the run number is: **${{ github.run_number }}**'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
8 changes: 3 additions & 5 deletions __tests__/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@ import { addHeader, MARKER } from '../src/utils'

test('add a header to body without an existing marker', async () => {
const currentBody = 'Hello world, this is a description'
const header = '> This is a sticky header'
const header = '> This is a fixed header'

const newBody = addHeader(header, currentBody)

expect(newBody).toEqual(
`> This is a sticky header${MARKER}\n\n${currentBody}`
)
expect(newBody).toEqual(`> This is a fixed header${MARKER}\n\n${currentBody}`)
})

test('add a header to body with an existing marker', async () => {
const currentBody = `> This is the old header${MARKER}\n\nHello world, this is a description`
const header = '> This is a new sticky header'
const header = '> This is a new fixed header'

const newBody = addHeader(header, currentBody)

Expand Down
4 changes: 2 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: 'Pull Request Sticky Header'
name: 'Pull Request Fixed Header'
description: 'Keep a custom message on the top of your PR description'
author: 'lucasmotta'
author: 'kyranjamie'
inputs:
header:
description: 'Markdown message you want to stick at the top of your PR'
Expand Down
Loading