Skip to content

Commit

Permalink
Push .pot changes without GitHub secret
Browse files Browse the repository at this point in the history
Use a short lived token to push to the repository.
Don't expose the token to the test jobs.
  • Loading branch information
sbidoul committed Jan 4, 2025
1 parent 6ea5ca8 commit ac40f08
Showing 1 changed file with 35 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,40 @@ jobs:
with:
token: {{"${{ secrets.CODECOV_TOKEN }}"}}
{%- endif %}
{% raw -%}
- name: Update .pot files
run: oca_export_and_push_pot https://x-access-token:${{ secrets.GIT_PUSH_TOKEN }}@github.com/${{ github.repository }}
{%- endraw %}
run: |
git reset --hard {% raw %}${{ github.sha }}{% endraw %}
oca_export_and_commit_pot
mkdir oca-ci-po-patch && touch oca-ci-po-patch/keep
git format-patch --output-directory=oca-ci-po-patch --keep-subject @{u}..@
if: {{ "${{" }} matrix.makepot == 'true' && github.event_name == 'push' && github.repository_owner == '{{ org_slug }}' {{ "}}" }}
- uses: actions/upload-artifact@v4
with:
name: oca-ci-po-patch
path: oca-ci-po-patch
retention-days: 7
if: {{ "${{" }} matrix.makepot == 'true' && github.event_name == 'push' && github.repository_owner == '{{ org_slug }}' {{ "}}" }}
push-pot:
needs: [test]
runs-on: ubuntu-latest
if: {{ "${{" }} github.event_name == 'push' && github.repository_owner == '{{ org_slug }}' {{ "}}" }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: oca-ci-po-patch
path: oca-ci-po-patch
- name: Configure git user
run: |
git config user.name "oca-ci"
git config user.email "[email protected]"
- name: Apply .pot files changes
run: git am --keep oca-ci-po-patch/*.patch
if: {% raw %}${{ hashFiles('oca-ci-po-patch/*.patch') != '' }}{% endraw %}
- name: Push .pot file changes
run: git push
if: {% raw %}${{ hashFiles('oca-ci-po-patch/*.patch') != '' }}{% endraw %}
# Don't fail in case something has changed upstream in the meantime
continue-on-error: true

0 comments on commit ac40f08

Please sign in to comment.