-
Notifications
You must be signed in to change notification settings - Fork 2
135 lines (114 loc) · 4.06 KB
/
boto.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: Boto
on:
- issue_comment
jobs:
Act:
if: |
github.event.issue.pull_request &&
(github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER')
runs-on: ubuntu-latest
outputs:
BOOL_TRIGGERED: ${{ steps.prcomm.outputs.BOOL_TRIGGERED }}
TRAILING_TOKEN : ${{ steps.prcomm.outputs.TRAILING_TOKEN }}
TRAILING_LINE : ${{ steps.prcomm.outputs.TRAILING_LINE }}
RUN_URL : ${{ steps.vars.outputs.run-url }}
RUN_COMMENT_ID : ${{ steps.runcomm.outputs.comment-id }}
steps:
- name: Listen for PR Comments
id: prcomm
uses: machine-learning-apps/actions-chatops@master
with:
TRIGGER_PHRASE: "@SocialGroovyBot"
env:
GITHUB_TOKEN: ${{ secrets.SOCIALGROOVYBOT_BOTO_PAT }}
- name: Create URL to the run output
id: vars
run: echo ::set-output name=run-url::https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID
- name: Add reaction
if: steps.prcomm.outputs.BOOL_TRIGGERED == 'True'
uses: peter-evans/create-or-update-comment@v1
with:
token: ${{ secrets.SOCIALGROOVYBOT_BOTO_PAT }}
comment-id: ${{ github.event.comment.id }}
reaction-type: eyes
- name: Create comment
id: runcomm
if: steps.prcomm.outputs.BOOL_TRIGGERED == 'True'
uses: peter-evans/create-or-update-comment@v1
with:
token: ${{ secrets.SOCIALGROOVYBOT_BOTO_PAT }}
issue-number: ${{ github.event.issue.number }}
body: |
[Running `${{ steps.prcomm.outputs.TRAILING_LINE }}`](${{ steps.vars.outputs.run-url }})
Yarn:
needs:
- Act
if: |
(
needs.Act.outputs.BOOL_TRIGGERED == 'True'
&&
needs.Act.outputs.TRAILING_TOKEN == 'yarn'
)
runs-on: ubuntu-latest
steps:
- name: Get upstream commit branch
id: comment
run: |
echo "::set-output name=branch::$( \
curl \
-H "Accept: application/vnd.github.sailor-v-preview+json" \
-u ${{ secrets.GITHUB_TOKEN }} \
${{ github.event.issue.pull_request.url }} \
| jq '.head.ref' \
| sed 's/\"//g' \
)"
- name: Checkout upstream repo
uses: actions/checkout@v4
with:
token: ${{ secrets.SOCIALGROOVYBOT_BOTO_PAT }}
ref: ${{ steps.comment.outputs.branch }}
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: lts/*
cache: yarn
- name: Get yarn cache directory path
id: init
shell: bash
run: |
echo "::set-output name=yarn_cache::$(yarn cache dir)"
#
echo "Node $(node --version)"
echo "NPM $(npm --version)"
echo "Npx $(npx --version)"
echo "Yarn $(yarn --version)"
- name: Installing
run: yarn --frozen-lockfile --perfer-offline --link-duplicates
- name: Run
run: |
${{ needs.Act.outputs.TRAILING_LINE }}
- name: Status
run: |
git status
- uses: EndBug/add-and-commit@v7
env:
HUSKY_SKIP_HOOKS: "true"
GITHUB_TOKEN: ${{ secrets.SOCIALGROOVYBOT_BOTO_PAT }}
with:
author_email: ${{ secrets.SOCIALGROOVYBOT_EMAIL }}
author_name: ${{ secrets.SOCIALGROOVYBOT_NAME }}
branch: ${{ steps.comment.outputs.branch }}
message: "chore(:robot:): ${{ needs.Act.outputs.TRAILING_LINE }}"
- name: Add success reaction
uses: peter-evans/create-or-update-comment@v1
with:
token: ${{ secrets.SOCIALGROOVYBOT_BOTO_PAT }}
comment-id: ${{ needs.Act.outputs.RUN_COMMENT_ID }}
reaction-type: "+1"
- name: Add failure reaction
if: failure()
uses: peter-evans/create-or-update-comment@v1
with:
token: ${{ secrets.SOCIALGROOVYBOT_BOTO_PAT }}
comment-id: ${{ needs.Act.outputs.RUN_COMMENT_ID }}
reaction-type: "-1"