-
Notifications
You must be signed in to change notification settings - Fork 28
132 lines (107 loc) · 4.11 KB
/
executeAction.yml
File metadata and controls
132 lines (107 loc) · 4.11 KB
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
name: ExecuteAction
on:
workflow_call:
inputs:
issueInfo:
required: true
type: string
operation:
required: true
type: string
prTitle:
required: true
type: string
prBody:
required: true
type: string
env:
CHAIN_BASE_PATH: src/public/images/${{ fromJSON(inputs.issueInfo).chainId }}
LIST_PATH: src/public/CowSwap.json
jobs:
execute:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- name: Set up npmrc
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
with:
script:
const { installSdkPreview } = await import("${{github.workspace}}/src/scripts/install-sdk-preview.mjs");
installSdkPreview(context, core);
env:
PACKAGE_READ_AUTH_TOKEN: ${{ secrets.PACKAGE_READ_AUTH_TOKEN }}
- name: Set environment variables
run: |
ADDRESS=$(echo "$INPUT_ADDRESS" | tr '[:upper:]' '[:lower:]')
echo "BASE_PATH=$CHAIN_BASE_PATH/$ADDRESS" >> "$GITHUB_ENV"
env:
INPUT_ADDRESS: ${{ fromJSON(inputs.issueInfo).address }}
- name: Create base path and info.json if it doesn't exist
run: |
mkdir -p $BASE_PATH
touch "$BASE_PATH/info.json"
- name: Save input into local file
run: echo "$ISSUE_INFO" > data.json
env:
ISSUE_INFO: ${{ inputs.issueInfo }}
# Image handling
- name: Download image
if: ${{ inputs.operation == 'addImage' || inputs.operation == 'addToken' }}
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
with:
name: ${{ fromJSON(inputs.issueInfo).address }}
- name: Move image to destination
if: ${{ inputs.operation == 'addImage' || inputs.operation == 'addToken' }}
run: mv output.png $BASE_PATH/logo.png
- name: Update json files
run: yarn workflowHelper $OPERATION data.json
env:
OPERATION: ${{ inputs.operation }}
# Validation steps
- name: Set up node
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
with:
node-version: lts/*
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Validate
run: yarn validate
# Passed validation
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
with:
commit-message: "[${{ inputs.operation }}] ${{ fromJSON(inputs.issueInfo).network }}/${{ fromJSON(inputs.issueInfo).address }}"
branch: ${{ inputs.operation }}/${{ fromJSON(inputs.issueInfo).chainId }}_${{ fromJSON(inputs.issueInfo).address }}
delete-branch: true
title: ${{ inputs.prTitle }}
body: |
# ${{ inputs.operation }}
**Note** This is an automated PR
Submitted by @${{ github.event.issue.user.login }}
Closes #${{ github.event.issue.number }}
---
${{ inputs.prBody }}
add-paths: |
${{ env.BASE_PATH }}/*
${{ env.LIST_PATH }}
- name: Comment on issue
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
with:
issue-number: ${{ github.event.issue.number }}
body: |
Your request is ready and will be reviewed by a team member.
You can follow the progress in the Pull Request #${{ steps.cpr.outputs.pull-request-number }}
- name: Report error
if: ${{ failure() }}
uses: peter-evans/close-issue@276d7966e389d888f011539a86c8920025ea0626 # v3.0.1
with:
comment: |
Failed to ${{ inputs.operation }}
Check the input is correct and try again in a new issue
If the issue persists, create a bug report
cc @cowprotocol/frontend