Update test summary #78
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 test summary | |
| on: | |
| workflow_run: | |
| workflows: ["Update and test"] | |
| types: [completed] | |
| workflow_dispatch: | |
| inputs: | |
| run_id: | |
| description: 'Workflow run ID to process' | |
| required: true | |
| type: string | |
| permissions: | |
| contents: write | |
| jobs: | |
| update-readme: | |
| runs-on: [self-hosted, Linux] | |
| if: github.event.workflow_run.head_branch == 'main' || github.event_name == 'workflow_dispatch' | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| ref: main | |
| fetch-depth: 1 | |
| - name: Configure Git | |
| run: | | |
| git config user.name 'GitHub Actions Bot' | |
| git config user.email 'actions@github.com' | |
| - name: Install Nix | |
| uses: cachix/install-nix-action@v31 | |
| - name: Install devenv | |
| run: nix profile add github:cachix/devenv/latest --accept-flake-config | |
| - name: Get test results and update README | |
| shell: devenv shell bash -- -e {0} | |
| run: | | |
| if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
| RUN_ID="${{ inputs.run_id }}" | |
| RUN_URL="https://github.com/${{ github.repository }}/actions/runs/$RUN_ID" | |
| else | |
| RUN_ID="${{ github.event.workflow_run.id }}" | |
| RUN_URL="${{ github.event.workflow_run.html_url }}" | |
| fi | |
| test-summary --run-id "$RUN_ID" --run-url "$RUN_URL" --repo "${{ github.repository }}" | |
| # Get nixpkgs short hash from flake.lock | |
| NIXPKGS_SHORT=$(nix flake metadata --json | jq -r '.locks.nodes["nixpkgs-src"].locked.rev' | cut -c1-7) | |
| git add README.md | |
| git diff --cached --quiet || git commit -m "ci: update test results for nixpkgs $NIXPKGS_SHORT" | |
| git push origin main | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |