From 9f36e72f2b78557ad90dcd2b0854849f59266bcd Mon Sep 17 00:00:00 2001 From: "Erick G. Islas-Osuna" Date: Sun, 13 Feb 2022 12:01:03 -0600 Subject: [PATCH 1/5] wip: github action to run pospell --- .github/workflows/pospell.yml | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/pospell.yml diff --git a/.github/workflows/pospell.yml b/.github/workflows/pospell.yml new file mode 100644 index 0000000000..bee555f58e --- /dev/null +++ b/.github/workflows/pospell.yml @@ -0,0 +1,42 @@ +name: pospell +on: + issue_comment: + types: + - created + +jobs: + fix-spell: + name: Fix spelling + runs-on: ubuntu-latest + if: ${{ github.event.comment.body == 'pospell-fix'}} + steps: + - name: Confirm process + uses: actions/github-script@v6 + with: + script: | + const {owner, repo} = context.issue + github.reactions.createForIssueComment({ + owner, + repo, + comment_id: context.payload.comment.id, + content: "+1", + }); + - uses: actions/checkout@v2 + - name: Preparar Python v3.10 + uses: actions/setup-python@v2 + with: + python-version: "3.10" + - name: Instalar dependencias + run: | + sudo apt-get update + sudo apt-get install -y hunspell hunspell-es gettext + python -m pip install -r requirements.txt + - name: Powrap + run: powrap --quiet **/*.po + - name: Pospell + run: python scripts/check_spell.py + - name: Commit & Push changes + uses: actions-js/push@master + with: + message: "auto: spell check" + github_token: ${{ secrets.GITHUB_TOKEN }} From 4784132e166429e68f6c0b04c080ce874b2de30a Mon Sep 17 00:00:00 2001 From: "Erick G. Islas-Osuna" Date: Mon, 3 Oct 2022 16:37:41 -0500 Subject: [PATCH 2/5] fix: execute only on PR --- .github/workflows/pospell.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pospell.yml b/.github/workflows/pospell.yml index bee555f58e..92c60395a9 100644 --- a/.github/workflows/pospell.yml +++ b/.github/workflows/pospell.yml @@ -8,7 +8,9 @@ jobs: fix-spell: name: Fix spelling runs-on: ubuntu-latest - if: ${{ github.event.comment.body == 'pospell-fix'}} + if: | + github.event.comment.body == 'pospell-fix' + && github.event.issue.pull_request steps: - name: Confirm process uses: actions/github-script@v6 From b60f9014d846da50e27c2b95516fc7f118a53771 Mon Sep 17 00:00:00 2001 From: "Erick G. Islas-Osuna" Date: Mon, 3 Oct 2022 17:07:35 -0500 Subject: [PATCH 3/5] Apply suggestions from code review Co-authored-by: Ezio Melotti --- .github/workflows/pospell.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pospell.yml b/.github/workflows/pospell.yml index 92c60395a9..67907b52ab 100644 --- a/.github/workflows/pospell.yml +++ b/.github/workflows/pospell.yml @@ -23,11 +23,12 @@ jobs: comment_id: context.payload.comment.id, content: "+1", }); - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Preparar Python v3.10 - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: "3.10" + cache: 'pip' - name: Instalar dependencias run: | sudo apt-get update From 94a5617bb0f52e2f66f1a0af10b29d1a524f973e Mon Sep 17 00:00:00 2001 From: "Erick G. Islas-Osuna" Date: Mon, 3 Oct 2022 17:12:06 -0500 Subject: [PATCH 4/5] rename and add continue-on-error --- .github/workflows/pospell-on-demand.yml | 46 +++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/pospell-on-demand.yml diff --git a/.github/workflows/pospell-on-demand.yml b/.github/workflows/pospell-on-demand.yml new file mode 100644 index 0000000000..16e48dec90 --- /dev/null +++ b/.github/workflows/pospell-on-demand.yml @@ -0,0 +1,46 @@ +name: pospell +on: + issue_comment: + types: + - created + +jobs: + fix-spell: + name: Fix spelling + runs-on: ubuntu-latest + if: | + github.event.comment.body == 'run-powrap' + && github.event.issue.pull_request + steps: + - name: Confirmar ejecucion + uses: actions/github-script@v6 + with: + script: | + const {owner, repo} = context.issue + github.reactions.createForIssueComment({ + owner, + repo, + comment_id: context.payload.comment.id, + content: "+1", + }); + - uses: actions/checkout@v3 + - name: Preparar Python v3.10 + uses: actions/setup-python@v4 + with: + python-version: "3.10" + cache: "pip" + - name: Instalar dependencias + run: | + sudo apt-get update + sudo apt-get install -y hunspell hunspell-es gettext + python -m pip install -r requirements.txt + - name: Ejecutar Powrap + run: powrap --quiet **/*.po + - name: Revisar con Pospell + run: python scripts/check_spell.py + continue-on-error: true + - name: Commit & Push changes + uses: actions-js/push@master + with: + message: "auto: spell check" + github_token: ${{ secrets.GITHUB_TOKEN }} From 4c88e59bc3553942a8dac036bdc5eb338db69375 Mon Sep 17 00:00:00 2001 From: "Erick G. Islas-Osuna" Date: Mon, 3 Oct 2022 18:08:34 -0500 Subject: [PATCH 5/5] one liner to avoid confusion --- .github/workflows/pospell.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pospell.yml b/.github/workflows/pospell.yml index 67907b52ab..d0bcf844f2 100644 --- a/.github/workflows/pospell.yml +++ b/.github/workflows/pospell.yml @@ -2,15 +2,14 @@ name: pospell on: issue_comment: types: + - edited - created jobs: fix-spell: name: Fix spelling runs-on: ubuntu-latest - if: | - github.event.comment.body == 'pospell-fix' - && github.event.issue.pull_request + if: ${{ github.event.issue.pull_request && github.event.comment.body == 'pospell-fix' }} steps: - name: Confirm process uses: actions/github-script@v6 @@ -28,7 +27,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: "3.10" - cache: 'pip' + cache: "pip" - name: Instalar dependencias run: | sudo apt-get update