Update imjasonh/setup-ko action to v0.7 #159
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: Validate | |
on: | |
pull_request: | |
env: | |
GOPRIVATE: "github.com" | |
jobs: | |
validate: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Configure git for private modules | |
env: | |
TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
run: git config --global url."https://YOUR_GITHUB_USERNAME:${TOKEN}@github.com".insteadOf "https://github.com" | |
- run: |- | |
docker-compose up -d | |
timeout 2m bash -c 'until go generate ./...; do sleep 5; done' | |
- id: check_generated | |
name: Check Generated Files | |
run: |- | |
DIFF=`git diff -p -- .` | |
if [[ ! -z "$DIFF" ]]; then | |
echo "# Generated files don't match" >> $GITHUB_STEP_SUMMARY | |
echo "run yarn generate" >> $GITHUB_STEP_SUMMARY | |
echo '```diff' >> $GITHUB_STEP_SUMMARY | |
echo "$DIFF" | tee -a $GITHUB_STEP_SUMMARY | |
echo "::error Generated files do not match. See job summary for diff." | |
echo '```' >> $GITHUB_STEP_SUMMARY | |
echo "::set-output name=changes::true" | |
fi | |
- name: Create Pull Request | |
id: cpr | |
uses: peter-evans/create-pull-request@v5 | |
if: github.event_name == 'pull_request' | |
with: | |
commit-message: Update generated files | |
base: ${{ github.head_ref }} | |
branch: regenerate/${{ github.head_ref }} | |
delete-branch: true | |
title: "Regenerate files for ${{ github.head_ref }}" | |
body: | | |
Update generated files | |
labels: | | |
automated | |
assignees: ${{ !contains(github.actor, '[bot]') && github.actor }} | |
draft: false | |
- name: Fail if there were changes | |
if: ${{ steps.cpr.outputs.pull-request-number }} | |
run: | | |
echo "Generated files don't match, pull request created:" | |
echo "${{ steps.cpr.outputs.pull-request-url }}" | |
exit 1 |