Skip to content

Add HedIDs

Add HedIDs #6

Workflow file for this run

name: Add HedIDs
on:
workflow_dispatch:
inputs:
schema_name:
description: 'The name of the schema("standard" for standard schema)'
default: ''
required: true
schema_version:
description: 'The schema version to convert'
required: true
pr_title:
description: 'Pull Request Title'
required: true
default: 'Adding HedIDs to schema on main'
pr_description:
description: 'Pull Request Description'
required: true
default: 'Automatically updating the schema from main with HedIDs'
jobs:
create-hed-ids-pr:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Ensure you have the complete history.
- name: Delete old provisional branch if needed
run: |
# Check if the provisional branch exists on the remote
EXISTS=$(git ls-remote --heads origin provisional | wc -l)
if [ "$EXISTS" -ne 0 ]; then
git push origin --delete provisional
echo "Provisional branch deleted."
else
echo "Provisional branch does not exist on remote, skipping delete."
fi
- name: Create new provisional branch from develop
run: |
git checkout main
git pull
git checkout -b provisional
git push origin main
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Install dependencies
run: pip install git+https://github.com/hed-standard/hed-python.git@develop
- name: Update schemas
run: |
hed_add_ids . "${{ github.event.inputs.schema_name }}" "${{ github.event.inputs.schema_version }}"
- name: Commit and push changes
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email '[email protected]'
git add .
git commit -m "Automatically adding hedIds"
git push origin provisional
- name: Create provisional to main PR
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create --base main --head provisional --title "${{ github.event.inputs.pr_title }}" --body "${{ github.event.inputs.pr_description }}"