Skip to content
plus

GitHub Action

Add to PR Descriptions

v1.2.0 Latest version

Add to PR Descriptions

plus

Add to PR Descriptions

Add to pull request descriptions using markdown

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Add to PR Descriptions

uses: bcgov-nr/action-pr-description-add@v1.2.0

Learn more about this action in bcgov-nr/action-pr-description-add

Choose a version

Merge CodeQL Contributors Forks Stargazers Issues MIT License Lifecycle

Add to Pull Request Descriptions

This action adds to Pull Request descriptions using markdown. It checks if the message is already present before adding.

Input

Required

add_markdown: The message to add to pull requests, in markdown.

Optional

github_token: ${{ secrets.GITHUB_TOKEN }} or a Personal Access Token (PAT). Default is to inherit a token from the calling workflow.

limit_to_pr_opened: Only take action when PR status is opened or reopened. Default = false.

Permissions

Explicit rights

Repositories can have different permissions for their tokens. It can't hurt to explicitly provide rights. Read more here.

    permissions:
      pull-requests: write

Forks

Forks receive purposefully limited rights, preventing this action from running successfully. It is recommended to avoid that with a condition.

    if: "!github.event.pull_request.head.repo.fork"

Example #1, minimal

Create or modify a GitHub workflow, like below. E.g. ./github/workflows/pr-append.yml

name: "Add to Pull Request Description"
on:
  pull_request:

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: bcgov-nr/action-pr-description-add@main
        with:
          add_markdown: |
            ---

            # Things!
            ## Excitement!
            [Links!](https://google.ca)
            `Code!`

Example #2, advanced

name: "Add to Pull Request Description"
on:
  pull_request:

jobs:
  test:
    name: PR Greeting
    permissions:
      pull-requests: write
    runs-on: ubuntu-latest
    steps:
      - uses: bcgov-nr/action-pr-description-add@main
        with:
          github_token: "${{ secrets.GITHUB_TOKEN }}"
          limit_to_pr_opened: "true"
          add_markdown: |
            ---

            # Things!
            ## Excitement!
            [Links!](https://google.ca)
            `Code!`
            _Italics_
            *Bold*
            * Bullets!
            * and [more reading!](https://github.github.com/gfm/)

Issues and Discussions

Please submit issues (bugs, feature requests) and take part in discussions at the links below.

BC Government QuickStart for OpenShift - Issues

BC Government QuickStart for OpenShift - Discussions

Contributing

Contributions are always welcome! Please send us pull requests or get in touch at the links above.

Acknowledgements

This Action is provided courtesty of NRIDS Architecture and Forestry Digital Services, parts of the Government of British Columbia.