Trigger workflow #3
This file contains 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: Build and Process JSON | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- '**.js' | |
- '**.ts' | |
- '**.module.json' | |
pull_request: | |
branches: | |
- main | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 'latest' | |
- name: Install dependencies | |
run: cd compiler && npm install && npm install --global @swc/core && cd .. | |
- name: Compile TypeScript with SWC | |
run: npx swc compiler/ --out-dir compiler/dist --source-maps --config-file ./swc.config.json | |
- name: Find and process *.module.json files | |
run: | | |
find . -name '*.module.json' | while read path; do | |
node compiler/dist/cli ?json "$path" | |
done | |
- name: Commit formatted Go files | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git config user.name "GitHub Actions Bot" | |
git config user.email "<>" | |
git add -A | |
git diff --quiet && git diff --staged --quiet || git commit -m "Formatted Go files" | |
- name: Push changes | |
uses: ad-m/github-push-action@v0.6.0 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ github.ref }} |