Skip to content

Commit 727f14f

Browse files
committed
ignore automated GitHub merge commits
1 parent da353fb commit 727f14f

1 file changed

Lines changed: 28 additions & 19 deletions

File tree

.github/workflows/project_issue_status.yml

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -39,30 +39,39 @@ jobs:
3939
TARGET="Needs Review"
4040
;;
4141
synchronize)
42-
CURRENT=$(gh api graphql -f query='
43-
query($owner:String!, $repo:String!, $pr:Int!) {
44-
repository(owner:$owner, name:$repo) {
45-
pullRequest(number:$pr) {
46-
closingIssuesReferences(first:5) {
47-
nodes {
48-
projectItems(first:5) {
49-
nodes {
50-
fieldValueByName(name:"Status") {
51-
... on ProjectV2ItemFieldSingleSelectValue { name }
42+
# Ignore automated GitHub merge commits (e.g. "Update branch" button)
43+
COMMITTER=$(gh api "repos/$REPO/pulls/$PR_NUMBER/commits" \
44+
--jq '.[-1].committer.login')
45+
echo "Last committer: $COMMITTER"
46+
47+
if [[ "$COMMITTER" == "web-flow" ]]; then
48+
echo "Automated branch sync — skipping status change."
49+
else
50+
CURRENT=$(gh api graphql -f query='
51+
query($owner:String!, $repo:String!, $pr:Int!) {
52+
repository(owner:$owner, name:$repo) {
53+
pullRequest(number:$pr) {
54+
closingIssuesReferences(first:5) {
55+
nodes {
56+
projectItems(first:5) {
57+
nodes {
58+
fieldValueByName(name:"Status") {
59+
... on ProjectV2ItemFieldSingleSelectValue { name }
60+
}
5261
}
5362
}
5463
}
5564
}
5665
}
5766
}
58-
}
59-
}' \
60-
-f owner="${REPO%%/*}" \
61-
-f repo="${REPO##*/}" \
62-
-F pr="$PR_NUMBER" \
63-
--jq '.data.repository.pullRequest.closingIssuesReferences.nodes[0].projectItems.nodes[0].fieldValueByName.name // empty')
64-
echo "Current issue status: $CURRENT"
65-
[[ "$CURRENT" == "Changes Requested" ]] && TARGET="Needs Review"
67+
}' \
68+
-f owner="${REPO%%/*}" \
69+
-f repo="${REPO##*/}" \
70+
-F pr="$PR_NUMBER" \
71+
--jq '.data.repository.pullRequest.closingIssuesReferences.nodes[0].projectItems.nodes[0].fieldValueByName.name // empty')
72+
echo "Current issue status: $CURRENT"
73+
[[ "$CURRENT" == "Changes Requested" ]] && TARGET="Needs Review"
74+
fi
6675
;;
6776
closed)
6877
[[ "$MERGED" == "true" ]] && TARGET="Done"
@@ -193,4 +202,4 @@ jobs:
193202
--silent
194203
done <<< "$ITEM_IDS"
195204
196-
echo "Done — all linked issues set to '$TARGET'."
205+
echo "Done — all linked issues set to '$TARGET'."

0 commit comments

Comments
 (0)