Skip to content

GitHub Action to change Pull Request descriptions.

License

Notifications You must be signed in to change notification settings

bcgov-nr/action-pr-description-add

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Build-Test Check dist/ 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.