4747 fetch-depth : 2 # To retrieve the preceding commit.
4848
4949 - name : Combine all tags.yml files
50- id : get_tags
51- run : find . -name "tags.yml" -not -path "./.github/*" -exec cat {} + > .github/tags.yml
50+ run : |
51+ echo "{}" > .github/tags.yml
52+
53+ for f in $(find . -name "tags.yml" -not -path "./.github/*"); do
54+ if [[ "$f" == *"/modules/"* ]]; then
55+ PREFIX="modules"
56+ elif [[ "$f" == *"/subworkflows/"* ]]; then
57+ PREFIX="subworkflows"
58+ else
59+ echo "Unknown feature type for $f"
60+ exit 1
61+ fi
62+
63+ yq eval "
64+ with_entries(
65+ .key = \"${PREFIX}/\" + .key
66+ )
67+ " "$f" > /tmp/tags.prefixed.yml
68+
69+ yq eval-all '. as $item ireduce ({}; . *+ $item)' \
70+ .github/tags.yml /tmp/tags.prefixed.yml > /tmp/tags.merged.yml
71+
72+ mv /tmp/tags.merged.yml .github/tags.yml
73+ done
74+
5275
5376 - name : debug
5477 run : cat .github/tags.yml
6790 needs : [pytest-changes, nf-test-changes]
6891 strategy :
6992 fail-fast : false
93+ max-parallel : 1
7094 matrix :
7195 tags :
7296 [
@@ -85,28 +109,52 @@ jobs:
85109 uses : actions/setup-python@v4
86110 with :
87111 python-version : " 3.10" # install the python version needed
112+ - name : Install yq
113+ run : sudo apt-get update && sudo apt-get install -y yq
88114 - uses : actions/checkout@v4
89115 with :
90116 ref : docs
91117 - name : Update name of ${{ matrix.tags }}
92118 run : |
93119 MATRIX_FRAGMENT="${{ matrix.tags }}"
94120 TEMP_NAME=$(echo $MATRIX_FRAGMENT | sed 's/subworkflows\///g')
95- SW_NAME=$(echo $TEMP_NAME | sed 's/modules\///g')
121+ SW_NAME=$(echo $TEMP_NAME | sed 's/modules\///g' | sed 's/\//\//' )
96122 echo "SW_NAME=$SW_NAME" >> $GITHUB_ENV
97123 - name : Rename md file
98124 id : replace_slash
99125 run : |
100126 FRAGMENT="${{ env.SW_NAME }}"
101- MD_NAME=$(echo $FRAGMENT | sed 's/\//_/g')
127+ if [[ "$FRAGMENT" == *"/"* ]]; then
128+ DIR="$(dirname "$FRAGMENT")"
129+ BASE="$(basename "$FRAGMENT")"
130+ MD_PATH="${DIR}/${DIR}_${BASE}"
131+ else
132+ MD_PATH="$FRAGMENT"
133+ fi
134+
135+ echo "MD_PATH=$MD_PATH" >> $GITHUB_ENV
136+ MD_NAME="${FRAGMENT}"
137+
138+ echo "MD_PATH=$MD_PATH" >> $GITHUB_ENV
102139 echo "MD_NAME=$MD_NAME" >> $GITHUB_ENV
103- echo "${MD_NAME}"
104140 - uses : EndBug/add-and-commit@v9
105141 with :
106142 default_author : github_actions
107143 message : " pull changes before adding doc for ${{ matrix.tags }}"
108144 pull : " --rebase"
109145 cwd : " ./"
146+ - name : Ensure output folder exists and debug
147+ run : |
148+ echo "MD_PATH=${MD_PATH}"
149+ echo "Creating folder: ./modules/$(dirname ${MD_PATH})"
150+ mkdir -p ./modules/$(dirname ${MD_PATH})
151+ ls -la ./modules
152+ - name : Ensure parent README exists
153+ run : |
154+ DIR="$(dirname "$MD_PATH")"
155+ if [ ! -f "./modules/$DIR/README.md" ]; then
156+ echo "# $DIR" > "./modules/$DIR/README.md"
157+ fi
110158 - name : Download convertor from yml to md
111159 run : |
112160 curl -o ${{ github.workspace }}/yaml_to_md.py https://raw.githubusercontent.com/mskcc-omics-workflows/yaml_to_md/0.0.3/yaml_to_md.py
@@ -152,24 +200,33 @@ jobs:
152200 echo "FEATURE_TYPE=$FEATURE_TYPE" >> $GITHUB_ENV
153201 echo "SUMMARY_TYPE=$SUMMARY_TYPE" >> $GITHUB_ENV
154202 echo "SUBWORKFLOW=$SUBWORKFLOW" >> $GITHUB_ENV
203+
155204 - name : Run convertor to generate md file for new module
156205 run : |
157206 echo ${{ matrix.tags }}
158- python ${{ github.workspace }}/yaml_to_md.py all --yaml-file ${{ github.workspace }}/temp.yml --output-file ./${{ env.FEATURE_TYPE }}/${{ env.MD_NAME }}.md --schema-url https://raw.githubusercontent.com/mskcc-omics-workflows/yaml_to_md/0.0.3/nextflow_schema/${{ env.FEATURE_TYPE }}/meta-schema.json ${{ env.SUBWORKFLOW }}
159- - name : Check file existence for modules
160- id : check_files
161- uses : andstor/file-existence-action@v1
162- with :
163- branch : docs
164- files : ${{ env.FEATURE_TYPE}}/${{ env.MD_NAME }}.md
207+ mkdir -p ./${{ env.FEATURE_TYPE }}/$(dirname $MD_PATH)
208+ python ${{ github.workspace }}/yaml_to_md.py all \
209+ --yaml-file ${{ github.workspace }}/temp.yml \
210+ --output-file ./${{ env.FEATURE_TYPE }}/${{ env.MD_PATH }}.md \
211+ --schema-url https://raw.githubusercontent.com/mskcc-omics-workflows/yaml_to_md/0.0.3/nextflow_schema/${{ env.FEATURE_TYPE }}/meta-schema.json \
212+ ${{ env.SUBWORKFLOW }}
165213 - name : Add to SUMMARY for new features
166214 run : |
167- curl -o ${{ github.workspace }}/update_summary.py https://raw.githubusercontent.com/mskcc-omics-workflows/modules/develop /.github/workflows/update_summary.py
168- python ${{ github.workspace }}/update_summary.py SUMMARY.md "* [ ${{ env.MD_NAME }}](${{ env.FEATURE_TYPE }}/${{ env.MD_NAME }}.md) " ${{ env.SUMMARY_TYPE }} > tmp_summary.md
215+ curl -o ${{ github.workspace }}/update_summary.py https://raw.githubusercontent.com/mskcc-omics-workflows/modules/release/0.2.4 /.github/workflows/update_summary.py
216+ python ${{ github.workspace }}/update_summary.py SUMMARY.md "${{ env.SW_NAME }}" ${{ env.SUMMARY_TYPE }} > tmp_summary.md
169217 mv tmp_summary.md SUMMARY.md
218+ - name : Check for changes
219+ run : |
220+ if git diff --quiet; then
221+ echo "NO_CHANGES=true" >> $GITHUB_ENV
222+ fi
223+ - name : Stage new files
224+ run : |
225+ git add "./${{ env.FEATURE_TYPE }}/${{ env.MD_PATH }}.md"
226+ git add SUMMARY.md
170227 - uses : EndBug/add-and-commit@v9
171228 with :
172229 default_author : github_actions
173230 message : " add doc for ${{ matrix.tags }}"
174- add : ' ["*/*.md --force", "SUMMARY.md --force"]'
175231 cwd : " ./"
232+ push : --force
0 commit comments