diff --git a/.gitea/workflows/ansible-lint.yml b/.gitea/workflows/ansible-lint.yml index 649b84f..e1db5e5 100644 --- a/.gitea/workflows/ansible-lint.yml +++ b/.gitea/workflows/ansible-lint.yml @@ -2,7 +2,10 @@ # .gitea/workflows/ansible-lint.yml name: ansible-lint -on: [issues, push] +on: + push: + issues: + types: [opened] jobs: build: diff --git a/.gitea/workflows/markdown-lint.yml b/.gitea/workflows/markdown-lint.yml index cc37469..fde15ce 100644 --- a/.gitea/workflows/markdown-lint.yml +++ b/.gitea/workflows/markdown-lint.yml @@ -2,7 +2,10 @@ # .gitea/workflows/markdown-lint.yml name: Markdown Lint -on: [issues, push] +on: + push: + issues: + types: [opened] jobs: build: diff --git a/.gitea/workflows/pr-check.yaml b/.gitea/workflows/pr-check.yaml index 3e2e308..b559c00 100644 --- a/.gitea/workflows/pr-check.yaml +++ b/.gitea/workflows/pr-check.yaml @@ -104,6 +104,14 @@ jobs: "$API/issues/$PR/comments" fi + # Remove ci-pass +label if exists + LABELS=$(curl -s -H "Authorization: token $TOKEN" "$API/issues/$PR/labels" | jq -r '.[] | .name') + if echo "$LABELS" | grep -q "^ci-pass$"; then + curl -s -X DELETE \ + -H "Authorization: token $TOKEN" \ + "$API/issues/$PR/labels/ci-pass" + fi + # Add label if missing LABELS=$(curl -s -H "Authorization: token $TOKEN" "$API/issues/$PR/labels" | jq -r '.[] | .name') if ! echo "$LABELS" | grep -q "^ci-failed$"; then @@ -147,9 +155,15 @@ jobs: -H "Content-Type: application/json" \ -d "{\"body\":\"\n$COMMENT_BODY\"}" \ "$API/issues/$PR/comments/$EXISTING_COMMENT_ID" + else + curl -s -X POST \ + -H "Authorization: token $TOKEN" \ + -H "Content-Type: application/json" \ + -d "$COMMENT_PAYLOAD" \ + "$API/issues/$PR/comments" fi - # Remove label if exists + # Remove ci-failed +label if exists LABELS=$(curl -s -H "Authorization: token $TOKEN" "$API/issues/$PR/labels" | jq -r '.[] | .name') if echo "$LABELS" | grep -q "^ci-failed$"; then curl -s -X DELETE \ @@ -157,6 +171,16 @@ jobs: "$API/issues/$PR/labels/ci-failed" fi + # Add ci-pass if not present + if ! echo "$LABELS" | grep -q "^ci-pass$"; then + echo "Adding ci-pass label" + curl -s -X POST \ + -H "Authorization: token $TOKEN" \ + -H "Content-Type: application/json" \ + -d '{"labels":["ci-pass"]}' \ + "$API/issues/$PR/labels" + fi + # Reopen PR if closed PR_STATE=$(curl -s -H "Authorization: token $TOKEN" "$API/pulls/$PR" | jq -r '.state') if [ "$PR_STATE" = "closed" ]; then