Skip to content

Automatic Offset Generation #1069

Automatic Offset Generation

Automatic Offset Generation #1069

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@8e8c483db84b4bee98b60c0593521ed34d9990e8 # 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@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
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