-
Notifications
You must be signed in to change notification settings - Fork 0
105 lines (88 loc) · 3.6 KB
/
update-github-copilot-cli.yml
File metadata and controls
105 lines (88 loc) · 3.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
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