-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (44 loc) · 1.94 KB
/
generate.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
name: Generate
on:
schedule:
- cron: "0 0 * * *" # Daily run.
push:
branches:
- main
permissions:
contents: write
pull-requests: write
jobs:
generate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Read old tools commit hash
id: old-commit-hash
run: echo ::set-output name=commit-hash::$(cat .tools_commit_hash)
- name: Generate
run: ./generate.sh
# Checks if the pkg folder has changed.
- name: Check if changed
id: changed
run: |
git diff --exit-code pkg
echo ::set-output name=code::$?
# Set own shell so '-e' is not set, that would exit when git diff exits with code 1.
shell: bash {0}
- name: Read new tools commit hash
id: new-commit-hash
run: echo ::set-output name=commit-hash::$(cat .tools_commit_hash)
- name: Create PR
if: steps.changed.outputs.code == '1'
uses: peter-evans/create-pull-request@v4
with:
title: "Generation updates based on github.com/golang/tools@${{ steps.new-commit-hash.outputs.commit-hash }}"
commit-message: "build(deps): generate based on github.com/golang/tools@${{ steps.new-commit-hash.outputs.commit-hash }}"
branch: pull-tools-updates
delete-branch: true
body: |
Generation updates pulled from [github.com/golang/tools](https://github.com/golang/tools).
Bumps from [${{ steps.old-commit-hash.outputs.commit-hash }}](https://github.com/golang/tools/commit/${{ steps.old-commit-hash.outputs.commit-hash }}) to [${{ steps.new-commit-hash.outputs.commit-hash }}](https://github.com/golang/tools/commit/${{ steps.new-commit-hash.outputs.commit-hash }}).
[Compare diff of the commits](https://github.com/golang/tools/compare/${{ steps.old-commit-hash.outputs.commit-hash }}...${{ steps.new-commit-hash.outputs.commit-hash }})