Generate #256
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }}) |