Added comment with draft field info to reuse #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | ||
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 | ||
- 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 }} |