Find Repos #1
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: Find Repos | |
| permissions: | |
| pull-requests: write | |
| contents: write | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| testFramework: | |
| description: space delimited list of testing frameworks to find in manifest files (the list is ORed) | |
| default: 'pytest unit' | |
| start_page: | |
| description: the page to start collecting data from | |
| type: number | |
| end_page: | |
| description: the page to end collecting data at | |
| type: number | |
| start_dependency: | |
| description: the dependency to start collecting data from | |
| type: number | |
| default: 0 | |
| end_dependency: | |
| description: the dependency to end collecting data at | |
| type: number | |
| default: -1 | |
| jobs: | |
| distribute-load: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| ranges: ${{ steps.distribute-load.outputs.ranges }} | |
| release-tag: ${{ steps.release-tag.outputs.release-tag }} | |
| steps: | |
| - id: distribute-load | |
| name: Distribute Load | |
| run: | | |
| RANGES=$(python3 -c "print([{'start': i, 'end': min(i + 5, ${{inputs.end_dependency}})} for i in range(${{inputs.start_dependency}}, ${{inputs.end_dependency}}, 5)])") | |
| echo "RANGES: $RANGES" | |
| echo "ranges=${RANGES}" >> $GITHUB_OUTPUT | |
| - id: release-tag | |
| name: Determine Release Tag | |
| run: | | |
| echo "release-tag=gh-dependency-based-repo-data-$(date +%m-%d-%Y_%H-%M-%S)" >> $GITHUB_OUTPUT | |
| crawl: | |
| permissions: | |
| pull-requests: write | |
| contents: write | |
| needs: distribute-load | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| range: ${{ fromJson(needs.distribute-load.outputs.ranges) }} | |
| fail-fast: false | |
| max-parallel: 1 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v2 | |
| with: | |
| node-version: 20 | |
| - name: Install Dependencies | |
| run: yarn install | |
| - name: Find Repos | |
| timeout-minutes: 295 | |
| run: yarn start gh collect -o ./collected-data -t ${{inputs.testFramework}} -s ${{inputs.start_page}} -e ${{inputs.end_page}} -c ${{matrix.range.start}} -d ${{matrix.range.end}} | |
| env: | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
| GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} | |
| - name: Upload report to GitHub Release | |
| uses: Wandalen/wretry.action@master | |
| with: | |
| attempt_delay: 60000 # 1 min | |
| attempt_limit: 10 | |
| action: softprops/action-gh-release@v1 | |
| with: | | |
| files: | | |
| ./collected-data/* | |
| tag_name: ${{needs.distribute-load.outputs.release-tag}} | |
| name: ${{needs.distribute-load.outputs.release-tag}} | |
| draft: false | |
| prerelease: true | |
| token: ${{ secrets.GITHUB_TOKEN }} |