Update automerge.yaml

Signed-off-by: Kjeld Schouten <info@kjeldschouten.nl>
This commit is contained in:
Kjeld Schouten
2024-10-18 15:12:09 +02:00
committed by GitHub
parent 9596d4763c
commit be31786ba9
+17 -1
View File
@@ -11,15 +11,31 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Debug Event Payload
run: cat "$GITHUB_EVENT_PATH"
- name: Check for automerge label
id: check-label
run: |
echo "Checking for 'automerge' label..."
if [[ "$(jq -r '.pull_request.labels | map(.name) | join(",")' "$GITHUB_EVENT_PATH")" != *"automerge"* ]]; then
pull_request_labels=$(jq -r '.workflow_run.pull_requests[0].labels // empty' "$GITHUB_EVENT_PATH")
if [ -z "$pull_request_labels" ]; then
echo "No labels found in the pull request. Exiting."
exit 1
fi
if [[ "$(echo "$pull_request_labels" | jq -r 'map(.name) | join(",")')" != *"automerge"* ]]; then
echo "The 'automerge' label is not present. Exiting."
exit 1
fi
commit_message=$(jq -r '.workflow_run.head_commit.message // empty' "$GITHUB_EVENT_PATH")
if [ -z "$commit_message" ]; then
echo "No commit message found. Exiting."
fi
approve:
needs: check-automerge-label
runs-on: ubuntu-latest