forked from tachiyomiorg/issue-moderator-action
-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (41 loc) · 1.5 KB
/
generate-js.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: 'Generate JavaScript code and open pull request with it'
on:
push:
branches-ignore:
- 'renovate/*'
- 'github-actions/generate-js/*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- run: npm install
- run: npm run prepare
- name: Get word diff to see changes in dist folder
id: diff
run: |
if ! git diff --quiet dist
then
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "GIT_DIFF<<$EOF" >> $GITHUB_OUTPUT
git diff --word-diff=porcelain --word-diff-regex=. dist | grep '^[+-]' >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT
fi
- name: Create pull request with generated JavaScript
uses: peter-evans/create-pull-request@v5
with:
add-paths: dist/
commit-message: Generate JavaScript based on ${{ github.sha }}
author: GitHub <[email protected]>
branch: github-actions/generate-js/${{ github.ref_name }}
title: Generate JavaScript for branch `${{ github.ref_name }}`
body: |
This pull pequest is opened automatically and contains generated JavaScript code based on commit ${{ github.sha }}. The changes are the following (context excluded):
```
${{ steps.diff.outputs.GIT_DIFF }}
```