fix(import-assertions-to-attributes): package name in codemod file #36
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: Codemod publish | |
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- "recipes/**" | |
branches: | |
- main | |
permissions: | |
contents: read | |
jobs: | |
paths-filter: | |
permissions: | |
contents: read | |
pull-requests: read | |
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: | |
- name: Harden the runner (Audit all outbound calls) | |
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 | |
with: | |
egress-policy: audit | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 | |
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: Harden the runner (Audit all outbound calls) | |
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 | |
with: | |
egress-policy: audit | |
- name: Checkout Code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
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: Harden the runner (Audit all outbound calls) | |
uses: step-security/harden-runner@6c439dc8bdf85cadbbce9ed30d1c7b959517bc49 | |
with: | |
egress-policy: audit | |
- name: Checkout Code | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e | |
with: | |
node-version-file: ".nvmrc" | |
- name: Install dependencies | |
run: | | |
sudo apt-get install libsecret-1-dev | |
npm install -g codemod | |
- name: Test codemod | |
run: | | |
DIR=$(dirname "${{ matrix.file }}") | |
echo "Testing codemod in: $DIR" | |
cd "$DIR" | |
npm install | |
npm run --if-present test | |
- name: Publish codemod | |
run: | | |
DIR=$(dirname "${{ matrix.file }}") | |
echo "Publishing codemod in: $DIR" | |
cd "$DIR" | |
npx codemod publish |