-
Notifications
You must be signed in to change notification settings - Fork 2
84 lines (74 loc) · 2.22 KB
/
pr.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Pull Request
on:
pull_request_target:
types:
- opened
- ready_for_review
- synchronize
- reopened
branches:
- develop
jobs:
build:
name: Build
runs-on: ubuntu-22.04
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Restoring node_modules cache
uses: actions/cache@v3
with:
path: 'node_modules'
key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}
- name: Restoring vendor/bundle cache
uses: actions/cache@v3
with:
path: 'vendor/bundle'
key: ${{ runner.os }}-vendor-bundle-${{ hashFiles('Gemfile.lock') }}
- name: Set environment variable
run: |
echo "UID=$(id -u)" >> $GITHUB_ENV
echo "GID=$(id -g)" >> $GITHUB_ENV
touch .env
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Building docker image
uses: docker/build-push-action@v5
with:
tags: collagelabs/collagelabs.org:latest
file: Dockerfile
context: .
build-args: |
UID=${{ env.UID }}
GID=${{ env.GID }}
cache-from: type=gha
cache-to: type=gha,mode=max
push: false
load: true
- name: Building project
run: |
make dependencies build_production
approve:
name: Approve pull request
runs-on: ubuntu-22.04
needs: build
steps:
- name: Approve
uses: hmarr/auto-approve-action@v3.2.1
with:
github-token: "${{ github.actor == 'LuisAlejandro' && secrets.GITHUB_TOKEN || secrets.REPO_PERSONAL_ACCESS_TOKEN }}"
merge:
name: Merge pull request
runs-on: ubuntu-22.04
needs: approve
steps:
- name: Merge
uses: actions/github-script@v7
with:
github-token: "${{ github.actor == 'LuisAlejandro' && secrets.GITHUB_TOKEN || secrets.REPO_PERSONAL_ACCESS_TOKEN }}"
script: |
await github.rest.pulls.merge({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number
})