A GitHub Action to download and commit a PGO profile using profilecli.
-
On your repository, go to Settings > Actions > General and check
Allow GitHub Actions to create and approve pull requests
-
GH_TOKEN
must be set in your workflow environment:env: GH_TOKEN: ${{ github.token }}
name: Profiling
on:
schedule:
- cron: "0 8 * * 1" # every Monday at 08:00am
env:
GH_TOKEN: ${{ github.token }} # required
permissions:
contents: write
pull-requests: write
jobs:
profiling:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download profile
uses: botify-labs/profilecli-action@v1
with:
endpoint: https://example.com/my-endpoint
username: ${{ secrets.PROFILING_USERNAME }}
password: ${{ secrets.PROFILING_PASSWORD }}
query: '{service_name="<my-service>"}'
output_path: default.pgo
range_from: now-24h
range_to: now
Name | Default value | Description |
---|---|---|
endpoint * |
- | API endpoint to fetch profiling data. |
query * |
- | Query used to filter profiling data. |
username * |
- | Username for authentication. |
password * |
- | Password for authentication. |
output_path |
default.pgo |
File path to save the profile output. |
range_from |
now-24h |
Start time for the profiling range. |
range_to |
now |
End time for the profiling range. |
profile_type |
process_cpu:samples:count:cpu:nanoseconds |
Type of profile to fetch and analyze. |
profilecli_version |
"1.1.5" |
Version of profilecli to use. |
pr_title |
"Generate Go profile" |
Title for the pull request that will be created. |
pr_body |
"Autogenerated profile update." |
Body content for the pull request that will be created. |