Skip to content

Added comment with draft field info to reuse #1

Added comment with draft field info to reuse

Added comment with draft field info to reuse #1

---
name: Check mergeability
on:
workflow_call:
secrets:
token:
required: true
outputs:
pr_branch_ref:
value: ${{ jobs.check_mergeability.outputs.pr_branch_ref }}
jobs:
check_mergeability:
runs-on: ubuntu-latest
outputs:
pr_branch_ref: ${{ steps.check_pr.outputs.pr_branch_ref }}
steps:
- name: Check out the code
uses: actions/checkout@v4

Check failure on line 19 in .github/workflows/check-mergeability.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/check-mergeability.yaml

Invalid workflow file

You have an error in your yaml syntax on line 19
- name: Check PR
id: check_pr
run: |
pr_info=$(gh pr list --head ${{ github.event.workflow_run.head_branch }} --json number,mergeable,headRefName)
# env GITHUB_RUN_NUMBER can be used
pr_number=$(echo $pr_info | jq -r '.[0].number')
mergeable=$(echo $pr_info | jq -r '.[0].mergeable')
pr_branch_ref=$(echo $pr_info | jq -r '.[0].headRefName')
if [ "$pr_number" == "null" ]; then
echo "No opened PR was found for branch ${{ github.event.workflow_run.head_branch }}"
exit 1
fi
echo "pr_branch_ref=$pr_branch_ref" >> $GITHUB_OUTPUT
if [ "$mergeable" != "MERGEABLE" ]; then
echo "PR $pr_number has conflicts"
exit 1
fi
env:
GH_TOKEN: ${{ secrets.token }}