Skip to content

Automatic Offset Generation #1183

Automatic Offset Generation

Automatic Offset Generation #1183

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@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Setup Go
uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # 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@f8d387b68d61c58ab83c6c016672934102569859 # v3.0.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 197425009+otelbot@users.noreply.github.com
git checkout -b $branch
git commit -a -m "$message"
git push --set-upstream origin $branch
gh pr create --title "$message" \
--body "$body" \
--base main