You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by vy...@apache.org on 2023/10/27 12:22:20 UTC

(logging-site) branch asf-staging updated: Fix `pom.xml` parsing

This is an automated email from the ASF dual-hosted git repository.

vy pushed a commit to branch asf-staging
in repository https://gitbox.apache.org/repos/asf/logging-site.git


The following commit(s) were added to refs/heads/asf-staging by this push:
     new 6d7944af Fix `pom.xml` parsing
6d7944af is described below

commit 6d7944af525d3c0daf6e1df89e02e92a8edc4a8a
Author: Volkan Yazıcı <vo...@yazi.ci>
AuthorDate: Fri Oct 27 14:22:11 2023 +0200

    Fix `pom.xml` parsing
---
 .github/workflows/update-stats.yaml | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/.github/workflows/update-stats.yaml b/.github/workflows/update-stats.yaml
index b04ab4e0..d20b526b 100644
--- a/.github/workflows/update-stats.yaml
+++ b/.github/workflows/update-stats.yaml
@@ -81,16 +81,17 @@ jobs:
           find . -regextype posix-extended -name "pom.xml" -and -not -regex "(.*/)?target/.*" | while read pomXmlFilepath; do
 
             # Ignore the artifact, if it is skipped at deployment
-            grep -q "<maven.deploy.skip>true" "$pomXmlFilepath" && continue
+            skipMatchCount=$(python -c "import xml.etree.ElementTree as ET; print(len(ET.parse('$pomXmlFilepath').findall('./{*}properties/{*}maven.deploy.skip')))")
+            [ "$skipMatchCount" -gt 0 ] && continue
 
             # Extract the module name (i.e., `artifactId`)
-            module=$(awk 'match($0, /^[ \t]+<artifactId>(.+)<\/artifactId>$/, m) {print m[1]}' "$pomXmlFilepath")
+            module=$(python -c "import xml.etree.ElementTree as ET; print(ET.parse('$pomXmlFilepath').findall('./{*}artifactId')[0].text)")
 
             # Dump statistics of the module folder
             moduleDir=$(dirname "$pomXmlFilepath")
             git log --pretty=tformat:"%as %ae" -- "$moduleDir" | while read instant author; do
               echo "$PROJ_ID,$module,$instant,$author"
-            done >"$DATA_FILEPATH"
+            done >>"$DATA_FILEPATH"
 
           done