diff --git a/.github/workflows/DINAR-PORT.yml b/.github/workflows/DINAR-PORT.yml index 7d3a507..2bbd3e7 100644 --- a/.github/workflows/DINAR-PORT.yml +++ b/.github/workflows/DINAR-PORT.yml @@ -24,7 +24,7 @@ jobs: runs-on: ubuntu-latest if: "startsWith(github.event.issue.title, 'DINAR-PORT ')" steps: - - name: Post a message + - name: Post link uses: KeisukeYamashita/create-comment@v1 with: comment: @@ -87,12 +87,26 @@ jobs: pip install -e ./odoo-module-migrator - name: apply OCA/odoo-module-migrator run: | + LOG_FILE=../odoo-module-migrator.logs cd REPO odoo-module-migrate \ --modules ${{ env.PORT_MODULE }} \ --init-version-name ${{ env.PORT_FROM_BRANCH }} \ --target-version-name ${{ env.PORT_TO_BRANCH }} \ - --no-commit + --no-commit \ + 2> $LOG_FILE || true + cat $LOG_FILE + + # remove colors + sed -r -i "s/\x1B\[([0-9]{1,3}(;[0-9]{1,2})?)?[mGK]//g" $LOG_FILE + # escape character + # TODO: update KeisukeYamashita/create-comment to support reading comment's body from file + body=$(cat $LOG_FILE) + body="${body//'%'/'%25'}" + body="${body//$'\n'/'%0A'}" + body="${body//$'\r'/'%0D'}" + echo "MIGRATOR_LOGS=$body" >> $GITHUB_ENV + git add -A git commit -m ":arrow_up:${{ env.PORT_TO_BRANCH_TAGS }} OCA/odoo-module-migrator @@ -108,6 +122,7 @@ jobs: > Made via .github/workflows/DINAR-PORT.yml" || echo "pre-commit: no changes" - name: PR uses: peter-evans/create-pull-request@v3 + id: cpr with: path: REPO # GITHUB_TOKEN would not trigger PR checks @@ -116,3 +131,13 @@ jobs: title: "[${{ env.PORT_TO_BRANCH }}] ${{ env.PORT_MODULE }}" body: | Made by [DINAR](https://github.com/itpp-labs/DINAR#readme) by request in #${{ github.event.issue.number }} + - name: Post logs + uses: KeisukeYamashita/create-comment@v1 + with: + number: ${{ steps.cpr.outputs.pull-request-number }} + comment: | + [Migrator](https://github.com/OCA/odoo-module-migrator/)'s logs: + + ``` + ${{ env.MIGRATOR_LOGS }} + ```