Update GitHub Copilot CLI Version #32
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 GitHub Copilot CLI Version | |
| on: | |
| schedule: | |
| - cron: "0 * * * *" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| check-and-update: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install Nix | |
| uses: cachix/install-nix-action@v31 | |
| with: | |
| nix_path: nixpkgs=channel:nixos-unstable | |
| extra_nix_config: | | |
| experimental-features = nix-command flakes | |
| access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
| env: | |
| NIX_FIRST_BUILD_UID: 400 | |
| - name: Check for updates | |
| id: check | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| CURRENT_VERSION=$(sed -n 's/.*"version": "\([^"]*\)".*/\1/p' sources.json | head -1) | |
| LATEST_VERSION=$(./scripts/update-version.sh --latest-version) | |
| echo "current=$CURRENT_VERSION" >> "$GITHUB_OUTPUT" | |
| echo "latest=$LATEST_VERSION" >> "$GITHUB_OUTPUT" | |
| if [ "$CURRENT_VERSION" = "$LATEST_VERSION" ]; then | |
| echo "update_needed=false" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "update_needed=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Update version and hashes | |
| if: steps.check.outputs.update_needed == 'true' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: ./scripts/update-version.sh --version "${{ steps.check.outputs.latest }}" | |
| - name: Create Pull Request | |
| if: steps.check.outputs.update_needed == 'true' | |
| id: create-pr | |
| uses: peter-evans/create-pull-request@v8 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| commit-message: "chore: update github-copilot-cli to version ${{ steps.check.outputs.latest }}" | |
| title: "chore: update github-copilot-cli to version ${{ steps.check.outputs.latest }}" | |
| body: | | |
| ## Automated GitHub Copilot CLI Update | |
| This PR updates GitHub Copilot CLI from version `${{ steps.check.outputs.current }}` to `${{ steps.check.outputs.latest }}`. | |
| ### Changes | |
| - Updated `sources.json` version and per-platform release hashes | |
| - Updated `flake.lock` | |
| - Verified the package build | |
| To test locally: | |
| ```bash | |
| nix build | |
| ./result/bin/copilot --version | |
| ``` | |
| This PR was automatically generated by the update workflow. | |
| branch: update-github-copilot-cli-${{ steps.check.outputs.latest }} | |
| delete-branch: true | |
| labels: | | |
| dependencies | |
| automated | |
| - name: Enable Auto-Merge | |
| if: steps.check.outputs.update_needed == 'true' && steps.create-pr.outputs.pull-request-number | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: gh pr merge "${{ steps.create-pr.outputs.pull-request-number }}" --auto --squash --delete-branch | |
| - name: Summary | |
| if: always() | |
| run: | | |
| echo "## Update Summary" >> "$GITHUB_STEP_SUMMARY" | |
| echo "" >> "$GITHUB_STEP_SUMMARY" | |
| echo "- **Current Version:** ${{ steps.check.outputs.current }}" >> "$GITHUB_STEP_SUMMARY" | |
| echo "- **Latest Version:** ${{ steps.check.outputs.latest }}" >> "$GITHUB_STEP_SUMMARY" | |
| echo "" >> "$GITHUB_STEP_SUMMARY" | |
| if [ "${{ steps.check.outputs.update_needed }}" = "true" ]; then | |
| echo "Update pull request created." >> "$GITHUB_STEP_SUMMARY" | |
| else | |
| echo "Already up to date." >> "$GITHUB_STEP_SUMMARY" | |
| fi |