-
Notifications
You must be signed in to change notification settings - Fork 56
42 lines (42 loc) · 1.23 KB
/
main.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
name: Convert Scripts to Bookmarklets
on: push
jobs:
bookmarkletify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Minify Scripts
uses: nizarmah/[email protected]
with:
output: min
js_engine: uglify-js # removes "javascript:" label unlike babel
- name: Delete Newlines
uses: jacobtomlinson/gha-find-replace@v2
with:
find: "\\n\\s*"
replace: " "
include: min/**
- name: Percent-Encode Percents
uses: jacobtomlinson/gha-find-replace@v2
with:
find: "%"
replace: "%25"
include: min/**
regex: false
- name: Replace Faulty Wrapper
uses: jacobtomlinson/gha-find-replace@v2
with:
find: "^!(function.*})(\\(\\);?)$" # !function{}() doesn't work in firefox
replace: "($1)$2"
include: min/**
- name: Prepend Labels
uses: jacobtomlinson/gha-find-replace@v2
with:
find: "(.*)"
replace: "javascript:krazete:$1" # credit
include: min/**
- name: Commit Bookmarklets
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "Github Action: Convert Scripts to Bookmarklets"
branch: ${{ github.ref }}