-
Notifications
You must be signed in to change notification settings - Fork 17
79 lines (70 loc) · 2.49 KB
/
go-update.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
name: Open Go Update PR
on:
workflow_dispatch:
inputs:
go_version:
description: 'Go version'
required: true
type: string
open_pr:
description: 'Whether to open a PR'
required: false
type: boolean
default: true
draft:
description: 'Open a Draft PR'
required: false
type: boolean
default: false
branch:
description: 'Git branch to use (defaults to "gobot/go-update-<go_version>")'
required: false
type: string
default: ''
env:
BRANCH_NAME: ${{ inputs.branch || format('gobot/go-update-{0}', inputs.go_version) }}
jobs:
open-go-update-pr:
runs-on: ubuntu-latest
permissions:
contents: write # push commit and branch
pull-requests: write # create PR
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Setup Python and pip
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Install dependencies
run: |
python3 -m pip install -r requirements.txt
- name: Update Go version
run: |
inv update-go -v "${{ inputs.go_version }}" --check-archive
- uses: stefanzweifel/git-auto-commit-action@v5
id: autocommit
with:
commit_message: Update go version to ${{ inputs.go_version }}
branch: ${{ env.BRANCH_NAME }}
create_branch: true
- name: Create Pull Request
uses: actions/github-script@v7
if: ${{ inputs.open_pr && steps.autocommit.outputs.changes_detected }}
with:
# TODO: if minor update, add changelog to the PR body: https://tip.golang.org/doc/go1.21
script: |
github.rest.pulls.create({
title: `Update Go version to ${{ inputs.go_version }}`,
owner: context.repo.owner,
repo: context.repo.repo,
head: ${{ env.BRANCH_NAME }},
base: context.ref,
draft: ${{ inputs.draft }},
body: [
'## Update docker images to Go ${{ inputs.go_version }}',
'For more information about this version, see the [Go release notes](https://golang.org/doc/devel/release.html#go${{ inputs.go_version }}) and the [Github milestone](https://github.com/golang/go/issues?q=milestone%3AGo${{ inputs.go_version }}+label%3ACherryPickApproved).',
].join('\n')
});