Update class-names.json #16
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: Extract Class Names | |
| on: | |
| push: | |
| paths: | |
| - "features/**.js" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| extract: | |
| if: github.repository == 'STForScratch/ScratchTools' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 0 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Generate GitHub App token | |
| id: generate_token | |
| uses: tibdex/github-app-token@v2 | |
| with: | |
| app_id: ${{ secrets.APP_ID }} | |
| private_key: ${{ secrets.APP_PRIVATE_KEY }} | |
| installation_id: ${{ secrets.INSTALLATION_ID }} | |
| - name: Run extraction script | |
| run: node .github/scripts/extract-classnames.js | |
| - name: Check for changes | |
| id: git-diff | |
| run: | | |
| if git diff --quiet --exit-code class-names.json; then | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create or Update Pull Request | |
| if: steps.git-diff.outputs.changed == 'true' | |
| uses: peter-evans/create-pull-request@v6 | |
| with: | |
| token: ${{ steps.generate_token.outputs.token }} | |
| commit-message: "Update class-names.json" | |
| branch: update-class-names | |
| title: "Update feature class names" | |
| body: "Automated update of class-names.json to keep track of class names used across all features." | |
| labels: automated | |
| assignees: rgantzos | |
| delete-branch: true |