diff --git a/.github/workflows/pospell-on-demand.yml b/.github/workflows/pospell-on-demand.yml index 16e48dec90..5a97b4d1bd 100644 --- a/.github/workflows/pospell-on-demand.yml +++ b/.github/workflows/pospell-on-demand.yml @@ -2,24 +2,22 @@ name: pospell on: issue_comment: types: + - edited - created jobs: fix-spell: name: Fix spelling runs-on: ubuntu-latest - if: | - github.event.comment.body == 'run-powrap' - && github.event.issue.pull_request + if: ${{ github.event.issue.pull_request && github.event.comment.body == 'pospell-fix' }} steps: - name: Confirmar ejecucion uses: actions/github-script@v6 with: script: | - const {owner, repo} = context.issue - github.reactions.createForIssueComment({ - owner, - repo, + await github.rest.issues.createForIssueComment({ + context.repo.owner, + context.repo.repo, comment_id: context.payload.comment.id, content: "+1", }); diff --git a/.github/workflows/pospell.yml b/.github/workflows/pospell.yml deleted file mode 100644 index d0bcf844f2..0000000000 --- a/.github/workflows/pospell.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: pospell -on: - issue_comment: - types: - - edited - - created - -jobs: - fix-spell: - name: Fix spelling - runs-on: ubuntu-latest - if: ${{ github.event.issue.pull_request && 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@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: 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 }} diff --git a/scripts/check_spell.py b/scripts/check_spell.py index e9193665f6..001c13f7f6 100644 --- a/scripts/check_spell.py +++ b/scripts/check_spell.py @@ -22,9 +22,7 @@ # Write merged dictionary file output_filename = tempfile.mktemp(suffix="_merged_dict.txt") with open(output_filename, "w") as f: - for e in entries: - f.write(e) - f.write("\n") + f.writelines(entries) # Run pospell either against all files or the file given on the command line po_files = sys.argv[1:]