Skip to content

Fix the script to get the merged pull request #25

Fix the script to get the merged pull request

Fix the script to get the merged pull request #25

name: Create a comment to the merged pull request
on:
push:
branches:
- main
# The workflow is tested in a pull request too, as the 'github.sha' context enables us
# to get the commit hash of a pull request.
pull_request: {}
permissions: read-all
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: ./
if: ${{ failure() }}
id: merged-pr-info
with:
# The 'is_merged' input is used to search for merged pull requests.
# Otherwise, the action searches for a working pull request that contain the commit hash.
is_merged: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
github-token: ${{ secrets.GITHUB_TOKEN }}
message: |-
The dummy task was failed.
We can put a \`buck-quoted message\`.
Please take a look at ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} .