fix: invalid links, outdated info, and more (#80) #5
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: Publish legacy codemods | |
| on: | |
| workflow_dispatch: | |
| push: | |
| paths: | |
| - "codemods/**" | |
| branches: | |
| - main | |
| jobs: | |
| paths-filter: | |
| name: Check for .codemodrc.json files changes | |
| runs-on: ubuntu-latest | |
| outputs: | |
| codemods: ${{ steps.filter.outputs.codemods }} | |
| codemods_files: ${{ steps.filter.outputs.codemods_files }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dorny/paths-filter@v3 | |
| id: filter | |
| name: Filter codemods | |
| with: | |
| list-files: json | |
| filters: | | |
| codemods: | |
| - '**/.codemodrc.json' | |
| prepare-matrix: | |
| name: Prepare matrix | |
| runs-on: ubuntu-latest | |
| needs: paths-filter | |
| if: always() && needs.paths-filter.outputs.codemods == 'true' | |
| outputs: | |
| codemod_files: ${{ steps.set-matrix.outputs.codemod_files }} | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set matrix for codemods | |
| id: set-matrix | |
| run: | | |
| FILES_JSON=$(echo '${{ needs.paths-filter.outputs.codemods_files }}' | jq -c '{include: map({file: .})}') | |
| echo "codemod_files=$FILES_JSON" >> "$GITHUB_OUTPUT" | |
| echo "Matrix JSON: $FILES_JSON" | |
| publish: | |
| name: Publish ${{ matrix.file }} | |
| runs-on: ubuntu-latest | |
| needs: prepare-matrix | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{fromJson(needs.prepare-matrix.outputs.codemod_files)}} | |
| env: | |
| CODEMOD_API_KEY: ${{ secrets.CODEMOD_API_KEY }} | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get install libsecret-1-dev | |
| pnpm install -g codemod@legacy | |
| - name: Test codemod | |
| run: | | |
| DIR=$(dirname "${{ matrix.file }}") | |
| echo "Testing codemod in: $DIR" | |
| pnpm install | |
| pnpm run build | |
| cd "$DIR" | |
| pnpm run --if-present test | |
| - name: Publish codemod | |
| run: | | |
| DIR=$(dirname "${{ matrix.file }}") | |
| echo "Publishing codemod in: $DIR" | |
| cd "$DIR" | |
| pnpx codemod@legacy publish |