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 requestsGH_TOKENmust be set in your workflow environment:env: GH_TOKEN: ${{github.token }}
name: Profilingon: schedule: - cron: "0 8 * * 1"# every Monday at 08:00amenv: GH_TOKEN: ${{github.token }} # requiredpermissions: contents: writepull-requests: writejobs: profiling: runs-on: ubuntu-lateststeps: - uses: actions/checkout@v3 - name: Download profileuses: botify-labs/profilecli-action@v1with: endpoint: https://example.com/my-endpointusername: ${{secrets.PROFILING_USERNAME }}password: ${{secrets.PROFILING_PASSWORD }}query: '{service_name="<my-service>"}'output_path: default.pgorange_from: now-24hrange_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. |