Skip to content

Commit

Permalink
Merge pull request #793 from strukturag/ci-generated-code-service-acc…
Browse files Browse the repository at this point in the history
…ount

CI: Push generated code from service account.
  • Loading branch information
fancycode authored Jul 31, 2024
2 parents c90d7ae + 49574e9 commit 6643f6b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/generated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ on:
- '*.proto'
- 'go.*'

env:
CODE_GENERATOR_NAME: struktur AG service user
CODE_GENERATOR_EMAIL: [email protected]

permissions:
contents: read

Expand All @@ -34,6 +38,7 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.CODE_GENERATOR_PAT }}
ref: ${{ github.event.pull_request.head.ref }}

- uses: actions/setup-go@v5
Expand All @@ -60,9 +65,9 @@ jobs:
if [ -z "$CHANGES" ]; then
echo "No files have changed, no need to commit / push."
else
git config user.name "$(git log -n 1 --pretty=format:%an)"
git config user.email "$(git log -n 1 --pretty=format:%ae)"
git commit -m "Update generated files from ${{github.event.pull_request.head.sha}}" *_easyjson.go *.pb.go
git config user.name "$CODE_GENERATOR_NAME"
git config user.email "$CODE_GENERATOR_EMAIL"
git commit --author="$(git log -n 1 --pretty=format:%an) <$(git log -n 1 --pretty=format:%ae)>" -m "Update generated files from ${{github.event.pull_request.head.sha}}" *_easyjson.go *.pb.go
git push
fi
fi
Expand Down

0 comments on commit 6643f6b

Please sign in to comment.