-
-
Notifications
You must be signed in to change notification settings - Fork 5
62 lines (50 loc) · 1.71 KB
/
build.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
50
51
52
53
54
55
56
57
58
59
60
61
62
name: Build Userscript File
on:
push:
branches:
- master
jobs:
build:
if: contains(github.event.head_commit.message, 'Automated Build PR') == false
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "20"
- name: Install dependencies
run: npm install
- name: Setup GitHub CLI
run: |
sudo apt-get install gh
- name: Configure Git
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Check if automated-build-branch exists and checkout
run: |
git fetch origin
if git show-ref --quiet refs/heads/automated-build-branch; then
git checkout automated-build-branch
git pull --rebase origin automated-build-branch
else
git checkout -b automated-build-branch
fi
- name: Run build script
run: node ./build.js
- name: Check for changes before committing
run: |
if [ -n "$(git status --porcelain)" ]; then
git add .
git commit -m "Automated build commit"
git push origin automated-build-branch
else
echo "No changes to commit"
exit 0
fi
- name: Create Pull Request
run: |
gh auth login --with-token <<< "${{ secrets.GITHUB_TOKEN }}"
gh pr create --base master --head automated-build-branch --title "Automated Build PR" --body "This PR is automatically generated by GitHub Actions."