Skip to content

Commit

Permalink
Move _scripts/ and _configs/config.json under .github/ (#70)
Browse files Browse the repository at this point in the history
* Move _scripts/ -> .github/scripts/

* Move _configs/config.json -> .github/update-config.json
  • Loading branch information
eemeli authored Aug 6, 2024
1 parent dc1633e commit 54d5b53
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 16 deletions.
1 change: 0 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
* @mozilla-l10n/l10n-firefox

# Code reviewers (workflows, scripts)
/_scripts/ @mozilla-l10n/l10n-firefox @eemeli
/.github/ @mozilla-l10n/l10n-firefox @eemeli
File renamed without changes.
4 changes: 2 additions & 2 deletions _scripts/prune.py → .github/scripts/prune.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ def write_commit_msg(data: list[str], files: int, messages: int):


if __name__ == "__main__":
prog = "python -m _scripts.prune"
prog = "python .github/scripts/prune.py"
parser = ArgumentParser(prog=prog, description=__doc__)
args = parser.parse_args()

config_file = join("_configs", "config.json")
config_file = join(".github", "update-config.json")
with open(config_file) as f:
cfg_automation = json.load(f)

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions _scripts/update.py → .github/scripts/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,11 @@ def write_commit_msg(args, new_files: int, updated_files: int):


if __name__ == "__main__":
config_file = join("_configs", "config.json")
config_file = join(".github", "update-config.json")
with open(config_file) as f:
cfg_automation = json.load(f)

prog = "python -m _scripts.update"
prog = "python .github/scripts/update.py"
parser = ArgumentParser(
prog=prog,
description=__doc__.format(HEAD=cfg_automation["head"]),
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions .github/workflows/cmp_geckostrings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ jobs:
with:
python-version: "3.12"
cache: pip
cache-dependency-path: l10n/_scripts/requirements.txt
- run: pip install -r l10n/_scripts/requirements.txt
cache-dependency-path: l10n/.github/scripts/requirements.txt
- run: pip install -r l10n/.github/scripts/requirements.txt

- name: Compare content
run: |
diff=$(python l10n/_scripts/diff.py l10n gecko-strings --ignore LICENSE README.md || true)
diff=$(python l10n/.github/scripts/diff.py l10n gecko-strings --ignore LICENSE README.md || true)
if [[ -n "$diff" ]]; then
echo "### There are differences between the two repositories" >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ jobs:
id: config
run: |
# Store the list of branches as a JSON array
echo "branches=$(jq -c '.branches' < _configs/config.json)" >> "$GITHUB_OUTPUT"
echo "branches=$(jq -c '.branches' < .github/update-config.json)" >> "$GITHUB_OUTPUT"
# Store the list of paths as a multiline list
# Bash multiline version
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings
{
echo 'paths<<EOF'
jq -r ".paths[]" < _configs/config.json
jq -r ".paths[]" < .github/update-config.json
echo EOF
} >> "$GITHUB_OUTPUT"
update:
Expand All @@ -62,10 +62,10 @@ jobs:
with:
python-version: "3.12"
cache: pip
cache-dependency-path: l10n/_scripts/requirements.txt
- run: pip install -r l10n/_scripts/requirements.txt
cache-dependency-path: l10n/.github/scripts/requirements.txt
- run: pip install -r l10n/.github/scripts/requirements.txt
- run: >
python -m _scripts.update
python .github/scripts/update.py
--branch ${{ matrix.ref }}
--commit $(cd ../firefox && git rev-parse --short HEAD)
--firefox ../firefox
Expand All @@ -92,9 +92,9 @@ jobs:
with:
python-version: "3.12"
cache: pip
cache-dependency-path: _scripts/requirements.txt
- run: pip install -r _scripts/requirements.txt
- run: python -m _scripts.prune
cache-dependency-path: .github/scripts/requirements.txt
- run: pip install -r .github/scripts/requirements.txt
- run: python .github/scripts/prune.py
- name: git config
run: |
git config --global user.name "github-actions[bot]"
Expand Down

0 comments on commit 54d5b53

Please sign in to comment.