Try to auto-generate BPF objects on PR #5
Workflow file for this run
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: Auto-generate and commit BPF files | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
permissions: | |
contents: write # Required for creating PRs | |
jobs: | |
generate-and-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Checkout repo" | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
with: | |
persist-credentials: false | |
- name: Run docker-generate | |
run: make docker-generate | |
- name: Add generated files | |
run: | | |
find . -name "*_bpfel*" -not -path "**/vendor/*" | xargs git add -f | |
- name: "Create/update PR" | |
id: git-check | |
env: | |
GITHUB_TOKEN: ${secrets.GITHUB_TOKEN} | |
run: | | |
if git diff --staged --quiet; then | |
echo "No changes to commit" | |
echo "changes=true" >> $GITHUB_OUTPUT | |
else | |
echo "Changes detected" | |
echo "changes=false" >> $GITHUB_OUTPUT | |
fi | |
- uses: actions/create-github-app-token@d72941d797fd3113feb6b93fd0dec494b13a2547 # v1.12.0 | |
id: generate-token | |
if: steps.git-check.outputs.changes == 'true' | |
with: | |
app-id: ${{ vars.OTELBOT_APP_ID }} | |
private-key: ${{ secrets.OTELBOT_PRIVATE_KEY }} | |
- name: "Create/update PR" | |
if: steps.git-check.outputs.changes == 'true' | |
env: | |
# not using secrets.GITHUB_TOKEN since pull requests from that token do not run workflows | |
GH_TOKEN: ${{ steps.generate-token.outputs.token }} | |
run: | | |
git config user.name otelbot | |
git config user.email [email protected] | |
git commit -m "Auto-generate BPF files" | |
branch="${GITHUB_HEAD_REF}" | |
git push origin HEAD:$branch |