Create Synapse Curation Task #83
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Create Synapse Curation Task | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| upload_folder_id: | |
| description: 'Upload folder Synapse ID (e.g., syn12345678)' | |
| required: true | |
| type: string | |
| template: | |
| description: 'JSON Schema template name' | |
| required: true | |
| type: choice | |
| options: | |
| # Default option - most commonly used for genomics data | |
| - GenomicsAssayTemplate | |
| # Assay technical metadata templates | |
| - BehavioralAssayTemplate | |
| - BiologicalAssayDataTemplate | |
| - BulkSequencingAssayTemplate | |
| - ChIPSeqTemplate | |
| - ClinicalAssayTemplate | |
| - ElectrophysiologyAssayTemplate | |
| - EpidemiologyDataTemplate | |
| - EpigeneticsAssayTemplate | |
| - EpigenomicsAssayTemplate | |
| - FlowCytometryTemplate | |
| - GeneralMeasureDataTemplate | |
| - GeneticsAssayTemplate | |
| - GenomicsArrayTemplate | |
| - GenomicsAssayTemplateExtended | |
| - ImagingAssayTemplate | |
| - ImmunoMicroscopyTemplate | |
| - LightScatteringAssayTemplate | |
| - MassSpecAssayTemplate | |
| - MaterialScienceAssayTemplate | |
| - MethylationArrayTemplate | |
| - MicroscopyAssayTemplate | |
| - MRIAssayTemplate | |
| - NonBiologicalAssayDataTemplate | |
| - PdxGenomicsAssayTemplate | |
| - PharmacokineticsAssayTemplate | |
| - PlateBasedReporterAssayTemplate | |
| - ProteinArrayTemplate | |
| - ProteinAssayTemplate | |
| - ProteomicsAssayTemplate | |
| - RNASeqTemplate | |
| - ScRNASeqTemplate | |
| - ScSequencingAssayTemplate | |
| - WESTemplate | |
| - WGSTemplate | |
| # Processed data products (downstream analysis outputs) | |
| - ProcessedAlignedReadsTemplate | |
| - ProcessedExpressionTemplate | |
| - ProcessedMergedDataTemplate | |
| - ProcessedVariantCallsTemplate | |
| # Sample-level data templates | |
| # - AnimalIndividualTemplate | |
| # - BiospecimenTemplate | |
| # - HumanCohortTemplate | |
| # Portal/Documentation templates | |
| # - PortalDataset | |
| # - PortalPublication | |
| # - PortalStudy | |
| # - PublicationTemplate | |
| # Administrative/Workflow templates | |
| # - WorkflowReport | |
| # - UpdateMilestoneReport | |
| # Source code templates | |
| # - SourceCodeTemplate | |
| # Abstract/Generic templates (not meant for direct use) | |
| # - Template | |
| # - PartialTemplate | |
| # - Superdataset | |
| # Protocol documentation templates | |
| # - ProtocolTemplate | |
| instructions: | |
| description: 'Instructions to the data contributor' | |
| required: false | |
| type: string | |
| default: 'Please add metadata for your files' | |
| create_issue: | |
| description: 'Create mirror GitHub issue with task info' | |
| required: false | |
| type: boolean | |
| default: true | |
| jobs: | |
| create-task: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Validate inputs | |
| run: | | |
| if [[ ! "${{ inputs.upload_folder_id }}" =~ ^syn[0-9]+$ ]]; then | |
| echo "Error: upload_folder_id must be a valid Synapse ID (e.g., syn12345678)" | |
| exit 1 | |
| fi | |
| if [[ -z "${{ inputs.template }}" ]]; then | |
| echo "Error: template cannot be empty" | |
| exit 1 | |
| fi | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.10' | |
| - name: Install Synapse Python client | |
| run: | | |
| # Install from develop branch which has curation task support | |
| pip install git+https://github.com/Sage-Bionetworks/synapsePythonClient.git@develop | |
| - name: Create curation task and bind schema | |
| id: create_task | |
| env: | |
| SYNAPSE_AUTH_TOKEN: ${{ secrets.DATA_MODEL_SERVICE }} | |
| run: | | |
| python utils/create_curation_task.py \ | |
| --folder-id "${{ inputs.upload_folder_id }}" \ | |
| --template "${{ inputs.template }}" \ | |
| --instructions "${{ inputs.instructions }}" \ | |
| --bind-schema \ | |
| --output-format github | |
| - name: Display task summary | |
| if: success() | |
| run: | | |
| echo "## Curation Task Created Successfully" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Task Details" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Task ID:** ${{ steps.create_task.outputs.task_id }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Data Type:** ${{ steps.create_task.outputs.data_type }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Template:** ${{ inputs.template }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Schema URI:** ${{ steps.create_task.outputs.schema_uri }}" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Resources Created" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Project:** [${{ steps.create_task.outputs.project_id }}](https://www.synapse.org/#!Synapse:${{ steps.create_task.outputs.project_id }})" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Upload Folder:** [${{ inputs.upload_folder_id }}](https://www.synapse.org/#!Synapse:${{ inputs.upload_folder_id }})" >> $GITHUB_STEP_SUMMARY | |
| echo "- **File View:** [${{ steps.create_task.outputs.fileview_id }}](https://www.synapse.org/#!Synapse:${{ steps.create_task.outputs.fileview_id }})" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Instructions" >> $GITHUB_STEP_SUMMARY | |
| echo "${{ inputs.instructions }}" >> $GITHUB_STEP_SUMMARY | |
| - name: Create GitHub issue | |
| if: success() && inputs.create_issue == true | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| gh issue create \ | |
| --title "Curation Test Task Created: ${{ inputs.template }} (${{ inputs.upload_folder_id }})" \ | |
| --assignee "${{ github.actor }}" \ | |
| --label "testing" \ | |
| --body "## Curation Task Created Successfully | |
| ### Task Details | |
| - **Task ID:** ${{ steps.create_task.outputs.task_id }} | |
| - **Data Type:** ${{ steps.create_task.outputs.data_type }} | |
| - **Template:** ${{ inputs.template }} | |
| - **Schema URI:** ${{ steps.create_task.outputs.schema_uri }} | |
| ### Resources Created | |
| - **Project:** [${{ steps.create_task.outputs.project_id }}](https://www.synapse.org/#!Synapse:${{ steps.create_task.outputs.project_id }}) | |
| - **Upload Folder:** [${{ inputs.upload_folder_id }}](https://www.synapse.org/#!Synapse:${{ inputs.upload_folder_id }}) | |
| - **File View:** [${{ steps.create_task.outputs.fileview_id }}](https://www.synapse.org/#!Synapse:${{ steps.create_task.outputs.fileview_id }}) | |
| ### Instructions | |
| ${{ inputs.instructions }} | |
| --- | |
| *Created by @${{ github.actor }} via [workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})*" |