mirror of
https://github.com/strukturag/nextcloud-spreed-signaling
synced 2026-03-14 14:35:44 +01:00
120 lines
3.2 KiB
YAML
120 lines
3.2 KiB
YAML
name: generated
|
|
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
paths:
|
|
- '.github/workflows/generated.yml'
|
|
- '**/api*.go'
|
|
- '**/*_easyjson.go'
|
|
- '**/*.pb.go'
|
|
- '**/*.proto'
|
|
- 'go.*'
|
|
- 'api/signaling.go'
|
|
- 'talk/ocs.go'
|
|
pull_request:
|
|
branches: [ master ]
|
|
paths:
|
|
- '.github/workflows/generated.yml'
|
|
- '**/api*.go'
|
|
- '**/*_easyjson.go'
|
|
- '**/*.pb.go'
|
|
- '**/*.proto'
|
|
- 'go.*'
|
|
- 'api/signaling.go'
|
|
- 'talk/ocs.go'
|
|
|
|
env:
|
|
CODE_GENERATOR_NAME: struktur AG service user
|
|
CODE_GENERATOR_EMAIL: opensource@struktur.de
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
check-token:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
token-exists: ${{ steps.token-check.outputs.defined }}
|
|
steps:
|
|
- name: Check for Token availability
|
|
id: token-check
|
|
# perform secret check & put boolean result as an output
|
|
shell: bash
|
|
run: |
|
|
if [ "${{ secrets.CODE_GENERATOR_PAT }}" != '' ]; then
|
|
echo "defined=true" >> $GITHUB_OUTPUT;
|
|
else
|
|
echo "defined=false" >> $GITHUB_OUTPUT;
|
|
fi
|
|
|
|
build:
|
|
name: build
|
|
runs-on: ubuntu-latest
|
|
needs: [check-token]
|
|
if: ${{ github.event_name == 'pull_request' && needs.check-token.outputs.token-exists == 'true' }}
|
|
permissions:
|
|
contents: write
|
|
continue-on-error: true
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
token: ${{ secrets.CODE_GENERATOR_PAT }}
|
|
ref: ${{ github.event.pull_request.head.ref }}
|
|
|
|
- uses: actions/setup-go@v6
|
|
with:
|
|
go-version: "stable"
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt -y update && sudo apt -y install protobuf-compiler
|
|
|
|
- name: Generate files
|
|
run: |
|
|
make clean-generated
|
|
make common
|
|
|
|
- name: Commit changes
|
|
run: |
|
|
CHECKOUT_SHA=$(git rev-parse HEAD)
|
|
echo "Checked out $CHECKOUT_SHA"
|
|
if [ "$CHECKOUT_SHA" != "${{github.event.pull_request.head.sha}}" ]; then
|
|
echo "More changes since this commit ${{github.event.pull_request.head.sha}}, skipping"
|
|
else
|
|
git add --all
|
|
CHANGES=$(git status --porcelain)
|
|
if [ -z "$CHANGES" ]; then
|
|
echo "No files have changed, no need to commit / push."
|
|
else
|
|
go mod tidy
|
|
git config user.name "$CODE_GENERATOR_NAME"
|
|
git config user.email "$CODE_GENERATOR_EMAIL"
|
|
git commit --all --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}}"
|
|
git push
|
|
fi
|
|
fi
|
|
|
|
check:
|
|
name: check
|
|
runs-on: ubuntu-latest
|
|
continue-on-error: true
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: actions/setup-go@v6
|
|
with:
|
|
go-version: "stable"
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
sudo apt -y update && sudo apt -y install protobuf-compiler
|
|
|
|
- name: Generate files
|
|
run: |
|
|
make clean-generated
|
|
make common
|
|
|
|
- name: Check generated files
|
|
run: |
|
|
git add --all
|
|
git diff --cached --exit-code
|