Skip to content

Automatic Offset Generation #1040

Automatic Offset Generation

Automatic Offset Generation #1040

Workflow file for this run

name: Automatic Offset Generation
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
permissions:
contents: read
jobs:
updateOffsets:
permissions:
contents: write # required for pushing changes
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6
- name: Setup Go
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6
with:
go-version: stable
check-latest: true
cache-dependency-path: "**/go.sum"
- name: Update offsets
run: make offsets
- name: generate token
uses: actions/create-github-app-token@7e473efe3cb98aa54f8d4bac15400b15fad77d94 # v2.2.0
id: generate-token
with:
app-id: ${{ vars.OTELBOT_APP_ID }}
private-key: ${{ secrets.OTELBOT_PRIVATE_KEY }}
- name: "Create/update PR"
env:
# Not using secrets.GITHUB_TOKEN since pull requests from that token
# do not run workflows.
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
message="Automatic update of offsets.json"
body="The offsets have been updated by go-offsets-tracker"
branch="otelbot/offset-content-auto-update"
git config user.name otelbot
git config user.email [email protected]
git checkout -b $branch
git commit -a -m "$message"
git push --set-upstream origin $branch
gh pr create --title "$message" \
--body "$body" \
--base main