Skip to content

Commit 18c28eb

Browse files
committed
TS compile workflow
1 parent ea7cdad commit 18c28eb

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

.github/workflows/compile-ts.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: auto-format
2+
on:
3+
# This event type is dangerous
4+
pull_request_target:
5+
types: [opened, reopened, synchronize]
6+
jobs:
7+
format:
8+
# Ensure the PR is not from a fork
9+
if: github.event.pull_request.head.repo.full_name == github.repository
10+
# PR is from the base repository, so it is only running code that was added by someone with write access, so it's trusted
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: write
14+
steps:
15+
- uses: actions/checkout@v1
16+
with:
17+
ref: ${{ github.head_ref }}
18+
- name: Typescript Compile
19+
run: npm build
20+
- name: Check for modified files
21+
id: git-check
22+
run: echo "modified=$(if git diff-index --quiet HEAD --; then echo "false"; else echo "true"; fi)" >> $GITHUB_OUTPUT
23+
- name: Push changes
24+
if: steps.git-check.outputs.modified == 'true'
25+
run: |
26+
git config --global user.name 'github-actions[bot]'
27+
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
28+
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
29+
git commit -am "Automated TypeScript compile"
30+
git push

0 commit comments

Comments
 (0)