-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (48 loc) · 1.65 KB
/
build-dist-on-trigger.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
name: Build dist on trigger
on:
issue_comment:
types: [created]
jobs:
build:
runs-on: ubuntu-latest
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the changed files back to the repository.
contents: write
if: |
github.event.comment &&
github.event.issue.pull_request &&
startsWith(github.event.comment.body, '/build')
steps:
- name: Get PR branch name
id: comment-pr-ref
uses: actions/github-script@v6
with:
result-encoding: string
script: |
const pr = await github.rest.pulls.get({
owner: context.issue.owner,
repo: context.issue.repo,
pull_number: context.issue.number,
});
return pr.data.head.ref
- name: Checkout PR code based on trigger comment
uses: actions/checkout@v3
with:
ref: ${{ steps.comment-pr-ref.outputs.result }}
- name: Insert auth font awesome auth token
run: echo "@fortawesome:registry=https://npm.fontawesome.com/" > .npmrc && echo "//npm.fontawesome.com/:_authToken=${{ secrets.FONT_AWESOME_AUTH_TOKEN }}" >> .npmrc
- uses: actions/setup-node@v3
with:
node-version: '20.9.0'
cache: 'yarn'
- name: Install and Build 🔧
run: |
yarn install --pure-lockfile
yarn build
- name: Push 🚀
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: ${{ steps.comment-pr-ref.outputs.result }}-dist
commit_message: Build dist
create_branch: true
push_options: '--force'