From a11ffe07f4abb169dfd62d986143bee5e11d31f6 Mon Sep 17 00:00:00 2001 From: Luiz Filipe Date: Wed, 2 Jul 2025 16:47:48 -0300 Subject: [PATCH 1/3] feat: add workflow to label pull requests with changed release version --- .github/workflows/add_release_label.yml | 58 +++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/add_release_label.yml diff --git a/.github/workflows/add_release_label.yml b/.github/workflows/add_release_label.yml new file mode 100644 index 0000000..9da598d --- /dev/null +++ b/.github/workflows/add_release_label.yml @@ -0,0 +1,58 @@ +name: Adicionar label de release quando versão for alterada + +on: + pull_request: + types: [opened, synchronize] + +jobs: + verificar-versao: + runs-on: ubuntu-latest + + permissions: + contents: read + pull-requests: write + + steps: + - name: Fazer checkout do código do PR + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Instalar xmllint + run: sudo apt-get update && sudo apt-get install -y libxml2-utils + + - name: Obter versão base (branch de destino) + run: | + git fetch origin ${{ github.event.pull_request.base.ref }} + git checkout origin/${{ github.event.pull_request.base.ref }} + VERSION_BASE=$(xmllint --xpath "/*[local-name()='project']/*[local-name()='version']/text()" pom.xml) + echo "VERSION_BASE=$VERSION_BASE" >> $GITHUB_ENV + + - name: Obter versão do head (branch do PR) + run: | + git checkout ${{ github.event.pull_request.head.ref }} + VERSION_HEAD=$(xmllint --xpath "/*[local-name()='project']/*[local-name()='version']/text()" pom.xml) + echo "VERSION_HEAD=$VERSION_HEAD" >> $GITHUB_ENV + + - name: Comparar versões + id: compare + run: | + echo "Versão base: $VERSION_BASE" + echo "Versão do PR: $VERSION_HEAD" + if [ "$VERSION_BASE" != "$VERSION_HEAD" ]; then + echo "changed=true" >> $GITHUB_OUTPUT + else + echo "changed=false" >> $GITHUB_OUTPUT + fi + + - name: Adicionar label 'release' se versão mudou + if: steps.compare.outputs.changed == 'true' + uses: actions/github-script@v7 + with: + script: | + github.rest.issues.addLabels({ + issue_number: context.payload.pull_request.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['release'] + }) From 68e67363b69c67268e2228b0abb8da9ca239219a Mon Sep 17 00:00:00 2001 From: Luiz Filipe Date: Wed, 2 Jul 2025 16:52:17 -0300 Subject: [PATCH 2/3] change pom version to test workflow --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4033e3c..ee354e4 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ com.asaas api-sdk - 1.0.2 + 1.0.3 ${project.groupId}:${project.artifactId} From 71f9f3f0a51afac15585de3e25dc5369d2e0ff1a Mon Sep 17 00:00:00 2001 From: Luiz Filipe Date: Wed, 2 Jul 2025 16:54:12 -0300 Subject: [PATCH 3/3] Revert "change pom version to test workflow" This reverts commit 68e67363b69c67268e2228b0abb8da9ca239219a. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ee354e4..4033e3c 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ com.asaas api-sdk - 1.0.3 + 1.0.2 ${project.groupId}:${project.artifactId}