mirror of
https://github.com/lukaszraczylo/go-telegram.git
synced 2026-10-14 00:47:54 +00:00
ci: use the shared pull request, release and autoupdate workflows (#19)
* ci(workflows): migrate to shared go-pr and go-release workflows Replace the generic vet, staticcheck, govulncheck, gosec, test and release jobs with the shared go-pr and go-release workflows. Keep the codegen-clean and audit jobs in ci.yml. Add an examples build job and the ci-success aggregator there. Add autoupdate.yaml from the shared go-autoupdate workflow. The release job now runs only on Go source changes and on manual dispatch. The dry-run input and the Bot API note in the tag message no longer exist. * ci(release): gate release on repo checks and export Bot API version Move the codegen-clean, audit and examples jobs into the reusable checks.yml workflow. The ci.yml and release.yml workflows both call it. The release job now needs the checks job. A failed or cancelled check blocks the release. Add workflow-prepare.sh. It appends BOT_API_VERSION to GITHUB_ENV so the GoReleaser header shows the Bot API version. The script does nothing when GITHUB_ENV is unset. * ci(regen): name release.yml in the merge step comments The release now runs from release.yml. The comments still named ci.yml as the workflow that cuts the release.
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
name: checks
|
||||
|
||||
# Repo-specific gates. Called by ci.yml (PR/push) and release.yml (release gate).
|
||||
on:
|
||||
workflow_call:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
examples:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version: '>=1.25'
|
||||
check-latest: true
|
||||
- name: Build all examples
|
||||
run: go build ./examples/...
|
||||
|
||||
codegen-clean:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version: '>=1.25'
|
||||
check-latest: true
|
||||
- name: Regenerate against pinned snapshot
|
||||
run: make regen-from-fixture
|
||||
- name: Assert clean diff
|
||||
run: git diff --exit-code internal/spec/api.json api/ docs/reference/
|
||||
|
||||
audit:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0 # need history for drift comparison
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version: '>=1.25'
|
||||
check-latest: true
|
||||
- name: Audit fallbacks
|
||||
run: make audit
|
||||
- name: Audit drift vs base
|
||||
# On PRs: compare against the merge base (origin/<base>).
|
||||
# On push to main: compare against the parent commit.
|
||||
# Drift is informational; doesn't fail CI.
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" = "pull_request" ]; then
|
||||
BASE="origin/${{ github.base_ref }}"
|
||||
else
|
||||
BASE="HEAD~1"
|
||||
fi
|
||||
echo "Drift base: $BASE"
|
||||
go run ./cmd/audit -ir internal/spec/api.json -drift -against "$BASE" || true
|
||||
Reference in New Issue
Block a user