Update offsets #154
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update offsets | |
on: | |
schedule: | |
- cron: '1 1 * * *' | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
UpdateOffsets: | |
permissions: | |
contents: write # Required for creating PRs | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Checkout repo" | |
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
with: | |
persist-credentials: true | |
- name: "Update Go" | |
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0 | |
with: | |
cache: 'false' | |
go-version: '>=1.25' | |
check-latest: true | |
- name: "Update offsets" | |
run: make update-offsets | |
- uses: actions/create-github-app-token@a8d616148505b5069dccd32f177bb87d7f39123b # v2.1.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 |