Github Actions 4 years ago
parent
commit
103e85930f
  1. 29
      .github/workflows/DINAR-PORT.yml

29
.github/workflows/DINAR-PORT.yml

@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: "startsWith(github.event.issue.title, 'DINAR-PORT ')" if: "startsWith(github.event.issue.title, 'DINAR-PORT ')"
steps: steps:
- name: Post a message
- name: Post link
uses: KeisukeYamashita/create-comment@v1 uses: KeisukeYamashita/create-comment@v1
with: with:
comment: comment:
@ -87,12 +87,26 @@ jobs:
pip install -e ./odoo-module-migrator pip install -e ./odoo-module-migrator
- name: apply OCA/odoo-module-migrator - name: apply OCA/odoo-module-migrator
run: | run: |
LOG_FILE=../odoo-module-migrator.logs
cd REPO cd REPO
odoo-module-migrate \ odoo-module-migrate \
--modules ${{ env.PORT_MODULE }} \ --modules ${{ env.PORT_MODULE }} \
--init-version-name ${{ env.PORT_FROM_BRANCH }} \ --init-version-name ${{ env.PORT_FROM_BRANCH }} \
--target-version-name ${{ env.PORT_TO_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 add -A
git commit -m ":arrow_up:${{ env.PORT_TO_BRANCH_TAGS }} OCA/odoo-module-migrator 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" > Made via .github/workflows/DINAR-PORT.yml" || echo "pre-commit: no changes"
- name: PR - name: PR
uses: peter-evans/create-pull-request@v3 uses: peter-evans/create-pull-request@v3
id: cpr
with: with:
path: REPO path: REPO
# GITHUB_TOKEN would not trigger PR checks # GITHUB_TOKEN would not trigger PR checks
@ -116,3 +131,13 @@ jobs:
title: "[${{ env.PORT_TO_BRANCH }}] ${{ env.PORT_MODULE }}" title: "[${{ env.PORT_TO_BRANCH }}] ${{ env.PORT_MODULE }}"
body: | body: |
Made by [DINAR](https://github.com/itpp-labs/DINAR#readme) by request in #${{ github.event.issue.number }} 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 }}
```
Loading…
Cancel
Save