-
Notifications
You must be signed in to change notification settings - Fork 5
35 lines (33 loc) · 1.21 KB
/
tokens-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
name: Update PR description
on:
pull_request:
types: [opened]
paths:
- "tokens/*"
jobs:
tokens-preview:
runs-on: ubuntu-latest
steps:
- name: Get branch name
uses: rlespinasse/github-slug-action@v3.x
- name: Update description
uses: actions/github-script@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { data: pr } = await github.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
head: `${context.repo.owner}:${context.payload.ref}`
});
if (pr.length > 0) {
const newComment = '✅ [Preview token changes](https://mistica-design.vercel.app/tokens-map?branch=${{ env.GITHUB_REF_SLUG_URL }}&skin=movistar&tokenType=color&activeColor=undefined) with `${{ env.GITHUB_REF_SLUG_URL }}` as a branch target';
await github.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr[0].number,
body: newComment
});
} else {
console.log('No pull request found for this push');
}