translation-ko #346
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: translation-ko | |
on: | |
workflow_run: | |
workflows: ["mov_to_gif"] | |
types: | |
- completed | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Check how many | |
id: number_check | |
run: | | |
echo "::set-output name=number::$(ls ./current/*.yaml | wc -l)" | |
- name: Set up Python | |
if: steps.number_check.outputs.number > 0 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Set up dependencies | |
if: steps.number_check.outputs.number > 0 | |
working-directory: py | |
run : | | |
pip install -r requirements.txt | |
- name: Set SSH file permissions for monitoring dstack instances | |
if: steps.number_check.outputs.number > 0 | |
working-directory: py | |
run: | | |
mkdir -p ~/.ssh | |
touch ~/.ssh/config | |
chmod 700 ~/.ssh | |
chmod 600 ~/.ssh/config | |
- name: Set parameters | |
id: parameters | |
if: steps.number_check.outputs.number > 0 | |
run: | | |
echo "::set-output name=yaml_dir::'current'" | |
echo "::set-output name=output_filename::arxiv_ids.txt" | |
echo "::set-output name=translated_filename::'paper.ko.html'" | |
- name: Run arxiv ids extractions from yamls | |
if: steps.number_check.outputs.number > 0 | |
run : | | |
python py/arxiv_ids_extractor.py \ | |
--yaml-dir ${{ steps.parameters.outputs.yaml_dir }} \ | |
--output-file ${{ steps.parameters.outputs.output_filename }} | |
- name: Check File Existence | |
if: steps.number_check.outputs.number > 0 | |
id: check_file | |
run: | | |
if [ -f ${{ steps.parameters.outputs.output_filename }} ]; then | |
echo "::set-output name=arxiv_ids_file_exist::true" | |
else | |
echo "::set-output name=arxiv_ids_file_exist::false" | |
fi | |
- name: Run translation jobs | |
if: steps.number_check.outputs.number > 0 && steps.check_file.outputs.arxiv_ids_file_exist == 'true' | |
run: | | |
python py/provision_translation_instance.py \ | |
--dstack-token="${{ secrets.DSTACK_TOKEN }}" \ | |
--github-token="${{ secrets.GH_TOKEN }}" \ | |
--hf-token="${{ secrets.HF_TOKEN }}" \ | |
--model-name="${{ secrets.MODEL_NAME }}" \ | |
--target-archive-github-repo="deep-diver/hf-daily-paper-newsletter" \ | |
--arxiv-ids $(cat ${{ steps.parameters.outputs.output_filename }}) \ | |
--num-of-workers 4 | |
- name: Reflect changes | |
if: steps.number_check.outputs.number > 0 && steps.check_file.outputs.arxiv_ids_file_exist == 'true' | |
run: | | |
git config --global user.name 'Chansung' | |
git config --global user.email '[email protected]' | |
git pull | |
- name: Update YAMLs | |
if: steps.number_check.outputs.number > 0 && steps.check_file.outputs.arxiv_ids_file_exist == 'true' | |
run: | | |
python py/update_yaml.py \ | |
--translated-output-github-repo "deep-diver/hf-daily-paper-newsletter" | |
- name: Commit Changes | |
if: steps.number_check.outputs.number > 0 && steps.check_file.outputs.arxiv_ids_file_exist == 'true' | |
run: | | |
git add . | |
git commit -m "Automated report" | |
git push |