|
| 1 | +name: Update GitHub Copilot CLI Version |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: "0 * * * *" |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + pull-requests: write |
| 11 | + |
| 12 | +jobs: |
| 13 | + check-and-update: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + |
| 16 | + steps: |
| 17 | + - name: Checkout repository |
| 18 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 19 | + with: |
| 20 | + fetch-depth: 0 |
| 21 | + |
| 22 | + - name: Install Nix |
| 23 | + uses: cachix/install-nix-action@ab739621df7a23f52766f9ccc97f38da6b7af14f # v31.10.5 |
| 24 | + with: |
| 25 | + nix_path: nixpkgs=channel:nixos-unstable |
| 26 | + extra_nix_config: | |
| 27 | + experimental-features = nix-command flakes |
| 28 | + access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} |
| 29 | + env: |
| 30 | + NIX_FIRST_BUILD_UID: 400 |
| 31 | + |
| 32 | + - name: Check for updates |
| 33 | + id: check |
| 34 | + env: |
| 35 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 36 | + run: | |
| 37 | + CURRENT_VERSION=$(sed -n 's/.*"version": "\([^"]*\)".*/\1/p' sources.json | head -1) |
| 38 | + LATEST_VERSION=$(./scripts/update-version.sh --latest-version) |
| 39 | +
|
| 40 | + echo "current=$CURRENT_VERSION" >> "$GITHUB_OUTPUT" |
| 41 | + echo "latest=$LATEST_VERSION" >> "$GITHUB_OUTPUT" |
| 42 | +
|
| 43 | + if [ "$CURRENT_VERSION" = "$LATEST_VERSION" ]; then |
| 44 | + echo "update_needed=false" >> "$GITHUB_OUTPUT" |
| 45 | + else |
| 46 | + echo "update_needed=true" >> "$GITHUB_OUTPUT" |
| 47 | + fi |
| 48 | +
|
| 49 | + - name: Update version and hashes |
| 50 | + if: steps.check.outputs.update_needed == 'true' |
| 51 | + env: |
| 52 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 53 | + run: ./scripts/update-version.sh --version "${{ steps.check.outputs.latest }}" |
| 54 | + |
| 55 | + - name: Create Pull Request |
| 56 | + if: steps.check.outputs.update_needed == 'true' |
| 57 | + id: create-pr |
| 58 | + uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1 |
| 59 | + with: |
| 60 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 61 | + commit-message: "chore: update github-copilot-cli to version ${{ steps.check.outputs.latest }}" |
| 62 | + title: "chore: update github-copilot-cli to version ${{ steps.check.outputs.latest }}" |
| 63 | + body: | |
| 64 | + ## Automated GitHub Copilot CLI Update |
| 65 | +
|
| 66 | + This PR updates GitHub Copilot CLI from version `${{ steps.check.outputs.current }}` to `${{ steps.check.outputs.latest }}`. |
| 67 | +
|
| 68 | + ### Changes |
| 69 | + - Updated `sources.json` version and per-platform release hashes |
| 70 | + - Updated `flake.lock` |
| 71 | + - Verified the package build |
| 72 | +
|
| 73 | + To test locally: |
| 74 | + ```bash |
| 75 | + nix build |
| 76 | + ./result/bin/copilot --version |
| 77 | + ``` |
| 78 | +
|
| 79 | + This PR was automatically generated by the update workflow. |
| 80 | + branch: update-github-copilot-cli-${{ steps.check.outputs.latest }} |
| 81 | + delete-branch: true |
| 82 | + labels: | |
| 83 | + dependencies |
| 84 | + automated |
| 85 | +
|
| 86 | + - name: Enable Auto-Merge |
| 87 | + if: steps.check.outputs.update_needed == 'true' && steps.create-pr.outputs.pull-request-number |
| 88 | + env: |
| 89 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 90 | + run: gh pr merge "${{ steps.create-pr.outputs.pull-request-number }}" --auto --squash --delete-branch |
| 91 | + |
| 92 | + - name: Summary |
| 93 | + if: always() |
| 94 | + run: | |
| 95 | + echo "## Update Summary" >> "$GITHUB_STEP_SUMMARY" |
| 96 | + echo "" >> "$GITHUB_STEP_SUMMARY" |
| 97 | + echo "- **Current Version:** ${{ steps.check.outputs.current }}" >> "$GITHUB_STEP_SUMMARY" |
| 98 | + echo "- **Latest Version:** ${{ steps.check.outputs.latest }}" >> "$GITHUB_STEP_SUMMARY" |
| 99 | + echo "" >> "$GITHUB_STEP_SUMMARY" |
| 100 | +
|
| 101 | + if [ "${{ steps.check.outputs.update_needed }}" = "true" ]; then |
| 102 | + echo "Update pull request created." >> "$GITHUB_STEP_SUMMARY" |
| 103 | + else |
| 104 | + echo "Already up to date." >> "$GITHUB_STEP_SUMMARY" |
| 105 | + fi |
0 commit comments