Skip to content

About

Action to add an issue tracker reference to the body of a commit message

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

🎟️ Add issue tracker to commit message body

Action to add an issue tracker reference to the body of a commit message.

inject-issue-id-action

Usage Example

Pass a JSON key/value lookup table to the action, either directly as a string, or by passing in the contents of a variable (set either at the repository or organisation level). The table is an array of objects, each with a key (the GitHub actor) and a value (the issue ID to inject for that actor):

[
  { "key": "octocat", "value": "PROJ-123" },
  { "key": "dependabot[bot]", "value": "PROJ-456" }
]

This is the format json-key-value-lookup-action reads. When inject is true, the action validates the table before anything else runs, and fails on invalid JSON or any other shape.

- name: "Check/Add commit message issue tracker reference"
  uses: lfreleng-actions/inject-issue-id-action@689ff3a7fd1ddf8f462b1ef695d4851aaf9758b3 # v0.1.1
  with:
    issue_id_lookup_json: ${{ vars.ISSUE_ID_LOOKUP_JSON }}

In the example above, the repository passes in the JSON data contained in a variable configured called ISSUE_ID_LOOKUP_JSON.

Set/define this for the repository under:

GitHub Repository -> Settings -> Secrets and variables -> Actions -> Variables

Inputs

issue_id_lookup_json is mandatory; issue_string and inject are optional with default values.

Variable Name Required Default Description
issue_id_lookup_json True N/A JSON array of {"key": ..., "value": ...} objects
issue_string False "Issue-ID:" Fixed preamble/string to embed/inject
inject False True When set false, checks for presence

Outputs

Variable Name Description
present Set true when ticket string found or injected
error invalid-json or invalid-format when validation rejects the table

Limitations

This action uses ${{ github.actor }} as the key to lookup, but also reports the ${{ github.actor_id }}, which is a GitHub facsimile to the UNIX concept of a UID value.

Future Enhancements

It may be desirable to use other GitHub parameters as keys in the JSON value/lookup.

About

Action to add an issue tracker reference to the body of a commit message

Resources

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors