This repository has been archived by the owner on Jan 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
59 lines (54 loc) · 1.67 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: "Crowdin Nested JSON Postprocessor"
description: "Runs a Python script that remove empty string in JSON caused by Crowdin not respecting skip untranslated strings"
inputs:
token:
description: "GitHub's Personal Access Token"
required: true
source_dir:
description: "The source directory to copy"
required: true
destination_dir:
description: "The destination directory (optional)"
required: false
signing_key:
description: "The GPG key to sign commits (optional)"
required: false
commit_message:
description: "Commit message (optional)"
required: false
default: "JSON Cleanup"
runs:
using: "composite"
steps:
- name: Setup directories and copy files
run: |
mkdir -p input output
cp -r "${{ inputs.source_dir }}"/* input/
if [[ -n "${{ inputs.destination_dir }}" ]]; then
DESTINATION_DIR="${{ inputs.destination_dir }}"
else
DESTINATION_DIR=input
fi
shell: bash
- name: Run Python script
run: python3 main.py
shell: bash
- name: Copy output files
run: |
cp -r output/* "$DESTINATION_DIR/"
shell: bash
- name: Commit changes
run: |
echo "Committing changes..."
if [[ -n "${{ inputs.signing_key }}" ]]; then
git config --global user.signingkey "${{ inputs.signing_key }}"
git config --global commit.gpgsign true
COMMIT_OPTIONS="-S"
else
COMMIT_OPTIONS=""
fi
echo "${{ inputs.token }}" | gh auth login --with-token
git add .
git commit $COMMIT_OPTIONS -m ${{ inputs.commit_message }}
git push
shell: bash