Skip to content

Update mirror

Update mirror #5941

Workflow file for this run

name: Update mirror
on:
push:
branches:
- automation
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '42 */3 * * *'
workflow_dispatch: # allows to be run manually
# Allow one concurrent release
concurrency:
group: "default-branch-push"
env:
SOURGE_HG_REPO_URL: https://hg.mozilla.org/l10n-central/ar/
SOURCE_HG_REPO_PATH: source_hg_repo
jobs:
update:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Clone repository
uses: actions/checkout@v3
with:
ref: automation
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Cache Python dependencies
uses: actions/cache@v3
with:
path: |
~/.cache/pip
!~/.cache/pip/log/debug.log
~/.local/bin
key: ${{ runner.os }}_pip_${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}_pip_
- name: Install dependencies
run: pip install --user -r requirements.txt
- name: Cache Mercurial repository clone - prepare cache key parts
id: cache_date
run: |
echo ::set-output name=YEAR::$(date +"%Y")
echo ::set-output name=MONTH::$(date +"%m")
echo ::set-output name=DAY::$(date +"%d")
- name: Cache Mercurial repository clone
uses: actions/cache@v3
with:
path: |
${{ env.SOURCE_HG_REPO_PATH }}
!${{ env.SOURCE_HG_REPO_PATH }}/.hg/hgrc
key: ${{ runner.os }}_${{ env.SOURCE_HG_REPO_PATH }}_${{ steps.cache_date.outputs.YEAR }}_${{ steps.cache_date.outputs.MONTH }}_${{ steps.cache_date.outputs.DAY }}
restore-keys: |
${{ runner.os }}_${{ env.SOURCE_HG_REPO_PATH }}_${{ steps.cache_date.outputs.YEAR }}_${{ steps.cache_date.outputs.MONTH }}_
- name: Update mirror
run: |
hg pull -u '${{ env.SOURGE_HG_REPO_URL }}'
hg update
hg bookmark -f default
hg \
--config auth.gh.prefix=github.com \
--config auth.gh.username=x-access-token \
--config auth.gh.password='${{ secrets.GITHUB_TOKEN }}' \
push 'https://github.com/${{ github.repository }}.git' || push_exit_code=$?
if [ -z $push_exit_code ]; then push_exit_code=0; fi
(($push_exit_code==0 || $push_exit_code==1)) || exit $push_exit_code
working-directory: ${{ env.SOURCE_HG_REPO_PATH }}