Skip to content

Initial release: Stage 1 publication with ethical safeguards #2

Initial release: Stage 1 publication with ethical safeguards

Initial release: Stage 1 publication with ethical safeguards #2

Workflow file for this run

name: Sync to GitLab
on:
push:
branches:
- main
tags:
- 'v*'
workflow_dispatch:
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for proper sync
- name: Sync to GitLab
env:
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
GITLAB_URL: ${{ secrets.GITLAB_URL || 'https://gitlab.com' }}
GITLAB_REPO: ${{ secrets.GITLAB_REPO }} # e.g., username/behaviour-lab
run: |
# Configure git
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"
# Add GitLab remote
git remote add gitlab https://oauth2:${GITLAB_TOKEN}@${GITLAB_URL#https://}/${GITLAB_REPO}.git || true
# Push to GitLab
git push gitlab main --force
# Push all tags
git push gitlab --tags --force
- name: Update GitLab README (platform-specific)
env:
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
GITLAB_URL: ${{ secrets.GITLAB_URL || 'https://gitlab.com' }}
GITLAB_PROJECT_ID: ${{ secrets.GITLAB_PROJECT_ID }}
run: |
# Add GitLab-specific badge if not present
if ! grep -q "gitlab" README.md; then
# Use GitLab API to update README with platform badge
echo "GitLab sync complete. Manual README update may be needed."
fi
- name: Notify on failure
if: failure()
run: |
echo "::error::GitLab sync failed. Check GITLAB_TOKEN and GITLAB_REPO secrets."