ubie-oss / comment-to-merged-pr-action

A composite GitHub Action to comment to the merged pull request
https://github.com/marketplace/actions/comment-to-the-merged-pull-request
Apache License 2.0
0 stars 1 forks source link

comment-to-merged-pr-action

A composite GitHub Action to comment to the merged pull request.

Inputs

Please look into action.yml to see the inputs.

Outputs

Use cases

Comment to the merged pull request if all jobs are passed

The examples show how to comment to the merged pull request if all jobs are passed. We assume that the job1 and job2 are the jobs that are executed when the pull request is merged into the default branch. Those can be something like to deploy a product.

name: "Create a comment to the merged pull request"
on:
  push:
    branches:
      - main
jobs:
  comment:
    permissions:
      contents: read
      pull-requests: write
    runs-on: ubuntu-latest
    steps:
      # We have to check out the default branch before using the action.
      - uses: actions/checkout@v4
      # The step is failed.
      - name: "Dummy failed step"
        id: dummy-failed-step
        run: |
          echo "The dummy task was failed."
          exit 1
      # The step is triggered only when dummy-failed-step is failed.
      - uses: ubie-oss/comment-to-merged-pr-action@v0.3.3
        if: ${{ failure() }}
        id: comment-to-merged-pr
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          message: |-
            The dummy task was failed.
            \`We have to escape back quotes\`.
            Please take a look at ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} .