Skip to content

Update wrap action #80

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jan 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 17 additions & 46 deletions .github/workflows/wrap_branch.yml
Original file line number Diff line number Diff line change
@@ -1,75 +1,46 @@
name: "Wrap all po files in branch"
name: "Wrap All"

on: workflow_dispatch
on:
workflow_dispatch:
schedule:
- cron: '0 0 15 * *'

jobs:
wrap:
runs-on: ubuntu-latest
steps:
# Checkout the latest code from the repo
- name: Checkout repo
uses: actions/checkout@v3

# Setup which version of Python to use
- name: Set Up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"

# Update pip
- name: Update pip
# Upgrade pip
- name: Upgrade pip
run: python -m pip install --upgrade pip

# Install requirements.
- name: Install requirements
run: python -m pip install --upgrade -r requirements.txt

# Install dependencies
- name: Install dependencies
run: sudo apt install -y gettext
run: python -m pip install --upgrade -r requirements.txt && sudo apt install -y gettext

# Wrap all po files
- name: Wrap
run: powrap *.po */*.po

- name: Sphinx lint
run: |
sphinx-lint *.po */*.po

# Detect changed files
- name: Detect changed files
run: echo "WRAPPED=$(git diff --name-only | tr '\n' ' ')" >> $GITHUB_ENV

# Commit changes
- name: Commit changes
run: |
array=($WRAPPED)
len=${#array[@]}
if [[ $len -eq 0 ]]; then
echo "No files to commit"
echo "WRAPPED=False" >> $GITHUB_ENV
else
echo "Committing changes"
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add ${WRAPPED}
git commit -m "Wrap translations"
echo "WRAPPED=True" >> $GITHUB_ENV
fi

# Create pull request
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v4
uses: peter-evans/create-pull-request@v4.2.3
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update report
committer: GitHub <noreply@github.com>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
signoff: false
branch: ${{ github.ref_name }}_wrapped
commit-message: 'Wrap all files on: ${{ github.ref_name }}'
branch: ${{ github.ref_name }}-wrapped
delete-branch: true
committer: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
title: 'Wrap branch: ${{ github.ref_name }}'
body: Wrapped all translations on branch ${{ github.ref_name }}.
body: 'Wrapped all files on branch: ${{ github.ref_name }}.'
labels: wrap
draft: false
reviewers: |
egeakman
ardasak