Skip to content

Mirroring Mercury repo of ASTAP #823

Mirroring Mercury repo of ASTAP

Mirroring Mercury repo of ASTAP #823

Workflow file for this run

name: mirror-astap-to-git
run-name: Mirroring Mercury repo of ASTAP
on:
#push:
# branches: [ tmp ]
schedule:
- cron: '0 12 * * *'
workflow_dispatch:
jobs:
mirror:
runs-on: ubuntu-latest
container:
image: canardconfit/hg-to-git:python3.9.18-alpine3.18
steps:
- name: Create Folder data
run: mkdir -p data
- name: Clear All
id: clear_all
if: ${{ github.event_name == 'workflow_dispatch' }}
run: "rm -rf git-repo hg-repo"
working-directory: data
- name: Check for folders
id: folders_check
run: |
if [ -d "data/hg-repo" ]; then
echo "hg_repo=true" >> $GITHUB_OUTPUT
echo "hg_repo=true"
else
echo "hg_repo=false" >> $GITHUB_OUTPUT
echo "hg_repo=false"
fi
- name: Clone Mercury Repo
run: hg clone http://hg.code.sf.net/p/astap-program/code data/hg-repo
if: steps.folders_check.outputs.hg_repo == 'false'
- name: Pull existing Mercury repo
run: hg pull
if: steps.folders_check.outputs.hg_repo == 'true'
working-directory: data/hg-repo
- name: Write author file for resolution
run: "echo '\"han59\"=\"Han59 <han.k@hnsky.org>\"' > data/authors"
- name: Checkout imported branch in git-repo
uses: actions/checkout@v4
with:
ref: imported
path: data/git-repo
- name: Process mirroring
run: /data/fast-export/hg-fast-export.sh -r ../hg-repo --force -A ../authors -M imported
working-directory: data/git-repo
- name: Push changes to imported
uses: ad-m/github-push-action@master
with:
force_with_lease: true
branch: imported
directory: data/git-repo
ASTAP-script:
needs: [mirror]
runs-on: ubuntu-latest
container:
image: ghcr.io/puppeteer/puppeteer:latest
options: --user root
steps:
- name: Checkout main branch
uses: actions/checkout@v4
with:
ref: main
path: git-repo
- name: Install node prerequises
run: yarn
working-directory: git-repo/.github/workflows/ASTAP-scripts
- name: Build
run: yarn build
working-directory: git-repo/.github/workflows/ASTAP-scripts
- name: Launch script to check if PR is needed, and create PR with ASTAP News
run: yarn start createPullRequest true -t ${{ secrets.GITHUB_TOKEN }}
working-directory: git-repo/.github/workflows/ASTAP-scripts