-
Notifications
You must be signed in to change notification settings - Fork 56
67 lines (59 loc) · 2.99 KB
/
update-pac-cli-version.yml
File metadata and controls
67 lines (59 loc) · 2.99 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
# This workflow checks for the latest Microsoft.PowerApps.CLI version and creates a PR if a newer version is available
name: Update PowerApps CLI Version
on:
push:
branches:
- users/priyanshuag/pac
schedule:
- cron: '0 3 * * *' # Runs daily at 03:00 UTC
workflow_dispatch:
jobs:
check-and-update-cli-version:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Get latest Microsoft.PowerApps.CLI version from NuGet
id: get_latest_version
run: |
latest_version=$(curl -s "https://api.nuget.org/v3-flatcontainer/microsoft.powerapps.cli/index.json" | jq -r '.versions[-1]')
echo "latest_version=$latest_version" >> $GITHUB_OUTPUT
- name: Get current CLI version from gulpfile.mjs
id: get_current_version
run: |
current_version=$(grep -oP "const cliVersion = '\K[0-9.]+(?=')" gulpfile.mjs)
echo "current_version=$current_version" >> $GITHUB_OUTPUT
- name: Compare versions
id: compare_versions
run: |
if [ "${{ steps.get_latest_version.outputs.latest_version }}" != "${{ steps.get_current_version.outputs.current_version }}" ]; then
echo "update_needed=true" >> $GITHUB_OUTPUT
else
echo "update_needed=false" >> $GITHUB_OUTPUT
fi
# Instead of updating the file and creating a PR, create a GitHub issue and assign it to Copilot if a new version is available
- name: Create GitHub issue to update CLI version and assign to Copilot
if: steps.compare_versions.outputs.update_needed == 'true'
uses: peter-evans/create-issue-from-file@v5
with:
title: "Update PowerApps CLI version to ${{ steps.get_latest_version.outputs.latest_version }}"
content-filepath: .github/cli-update-issue-template.md
labels: "automation,dependencies"
assignees: "github-copilot[bot]"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Generate issue content file
if: steps.compare_versions.outputs.update_needed == 'true'
run: |
echo "A new version of Microsoft.PowerApps.CLI is available on NuGet." > .github/cli-update-issue-template.md
echo "" >> .github/cli-update-issue-template.md
echo "Current version in gulpfile.mjs: ${{ steps.get_current_version.outputs.current_version }}" >> .github/cli-update-issue-template.md
echo "Latest version on NuGet: ${{ steps.get_latest_version.outputs.latest_version }}" >> .github/cli-update-issue-template.md
echo "" >> .github/cli-update-issue-template.md
echo "Please update the CLI version in the repository." >> .github/cli-update-issue-template.md
echo "" >> .github/cli-update-issue-template.md
echo "For implementation reference, see PR #1236." >> .github/cli-update-issue-template.md