Pull Request Version Comment Action

Github action that can comment on pull requests to indicate the diff of an OpenTAP package and the package from the branch from which it is derived. This uses the OpenTAP package Package Diff and relies on semantic git versioning using tap sdk gitversion (see OpenTAP docs)

Prerequisites

  • A GitHub repository that follows a branching model compatible with the gitversion system of OpenTAP (see OpenTAP docs).
  • A .gitversion file in the root of the git repository
  • A .TapPackage Artifact
  • The packages from which they are derived to be available from a package repository

Usage

To use get comments on merged PRs in your GitHub repository, create a workflow (eg: .github/workflows/package-diff-comment.yaml see Creating a Workflow file) with content like below:

on: [push]

# This grants access to the GITHUB_TOKEN so the action can make calls to GitHub's rest API
permissions:
  contents: read
  pull-requests: write
  issues: write

jobs:
  package-diff-comment:
    runs-on: ubuntu-latest
    name: package-diff-comment
    needs:
      - BuildMyPackage
    steps:
      - name: Download package
        uses: actions/download-artifact@v2
        with:
          name: MyTapPackage
          path: .
      - name: Run diff action
        uses: alnlarsen/package-diff-comment@main
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          package: MyPackage.TapPackage