-
Notifications
You must be signed in to change notification settings - Fork 602
73 lines (69 loc) · 2.3 KB
/
import_paths.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
# This is a manua workflow that does the following when trigerred:
# - Runs a script to find and replace Go import path major version with given version.
# - Commits and pushes changes to the source-branch.
# - Opens a PR from the source branch to the target-branch.
name: Update Go Import Paths
on:
workflow_dispatch:
inputs:
version:
description: 'Current Version that we want to change'
default: '10'
required: true
target-branch:
description: 'Target Branch'
default: 'main'
required: true
source-branch:
description: 'Source Branch'
default: 'update-paths'
required: true
jobs:
update-import-paths:
runs-on: ubuntu-latest
steps:
-
name: Check out repository code
uses: actions/checkout@v2
-
name: Setup Golang
uses: actions/[email protected]
with:
go-version: 1.18
-
name: Display go version
run: go version
-
name: Get data from build cache
uses: actions/cache@v2
with:
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
# * Build cache (Windows)
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
~\AppData\Local\go-build
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ matrix.go-version }}-
-
name: Run find & replace script
run: ./scripts/replace_import_paths.sh ${{ inputs.version }}
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.ADD_TO_PROJECT_PAT }}
title: "auto: update Go import paths to v${{ inputs.version }}"
commit-message: "auto: update Go import paths to v${{ inputs.version }}"
body: "**Automated pull request**\n\nUpdating Go import paths to v${{ inputs.version }}"
base: ${{ inputs.target-branch }}
branch-suffix: random
branch: ${{ inputs.source-branch }}
delete-branch: true
assignees: ${{ github.actor }}
draft: true
labels: T:auto,T:code-hygiene