|
1 | | -name: Update Kube-Stack Version |
| 1 | +name: Update Kube Stack Version |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | schedule: |
5 | 5 | # Run every Monday at 9:00 AM UTC |
6 | 6 | - cron: '0 9 * * 1' |
7 | | - workflow_dispatch: # Allow manual triggering |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + dry_run: |
| 10 | + description: 'Dry run (check for updates without creating PR)' |
| 11 | + required: false |
| 12 | + default: false |
| 13 | + type: boolean |
8 | 14 |
|
9 | 15 | jobs: |
10 | 16 | update-kube-stack-version: |
11 | 17 | runs-on: ubuntu-latest |
12 | 18 |
|
13 | 19 | steps: |
14 | 20 | - name: Checkout repository |
15 | | - uses: actions/checkout@v4 |
| 21 | + uses: actions/checkout@v5 |
16 | 22 | with: |
17 | 23 | token: ${{ secrets.GITHUB_TOKEN }} |
18 | | - |
| 24 | + fetch-depth: 0 |
| 25 | + |
19 | 26 | - name: Set up Python |
20 | | - uses: actions/setup-python@v4 |
| 27 | + uses: actions/setup-python@v5 |
21 | 28 | with: |
22 | | - python-version: '3.9' |
23 | | - |
24 | | - - name: Run kube-stack version update script |
| 29 | + python-version: '3.13' |
| 30 | + |
| 31 | + - name: Install dependencies |
25 | 32 | run: | |
26 | | - cd scripts |
27 | | - python update_kube_stack_version.py |
28 | | - |
| 33 | + python -m pip install --upgrade pip |
| 34 | + pip install requests |
| 35 | +
|
| 36 | + - name: Run update script |
| 37 | + id: update-script |
| 38 | + run: | |
| 39 | + echo "Running kube-stack-version update script..." |
| 40 | + python scripts/update_kube_stack_version.py |
| 41 | + echo "Script completed successfully" |
| 42 | +
|
29 | 43 | - name: Check for changes |
30 | | - id: verify-changed-files |
| 44 | + id: check-changes |
31 | 45 | run: | |
32 | | - if [ -n "$(git status --porcelain)" ]; then |
33 | | - echo "changed=true" >> $GITHUB_OUTPUT |
| 46 | + if git diff --quiet HEAD -- docset.yml; then |
| 47 | + echo "No changes detected in docset.yml" |
| 48 | + echo "has_changes=false" >> $GITHUB_OUTPUT |
34 | 49 | else |
35 | | - echo "changed=false" >> $GITHUB_OUTPUT |
| 50 | + echo "Changes detected in docset.yml" |
| 51 | + echo "has_changes=true" >> $GITHUB_OUTPUT |
| 52 | + |
| 53 | + # Show the diff for logging |
| 54 | + echo "Changes:" |
| 55 | + git diff HEAD -- docset.yml |
36 | 56 | fi |
37 | | - |
38 | | - - name: Commit and push changes |
39 | | - if: steps.verify-changed-files.outputs.changed == 'true' |
40 | | - run: | |
41 | | - git config --local user.email "[email protected]" |
42 | | - git config --local user.name "GitHub Action" |
43 | | - git add docs/docset.yml |
44 | | - git commit -m "chore: update kube-stack version [skip ci]" |
45 | | - git push |
46 | | - |
| 57 | +
|
47 | 58 | - name: Create Pull Request |
48 | | - if: steps.verify-changed-files.outputs.changed == 'true' |
49 | | - uses: peter-evans/create-pull-request@v5 |
| 59 | + if: steps.check-changes.outputs.has_changes == 'true' && github.event.inputs.dry_run != 'true' |
| 60 | + uses: peter-evans/create-pull-request@v7 |
50 | 61 | with: |
51 | 62 | token: ${{ secrets.GITHUB_TOKEN }} |
52 | | - commit-message: "chore: update kube-stack version" |
53 | | - title: "chore: update kube-stack version" |
| 63 | + commit-message: 'chore: update kube-stack-version' |
| 64 | + title: 'chore: update kube-stack-version' |
54 | 65 | body: | |
55 | | - This PR automatically updates the kube-stack version in `docs/docset.yml` based on the latest version from the elastic-agent repository. |
| 66 | + This PR automatically updates the `kube-stack-version` in `docset.yml` based on the latest version from the elastic-agent repository. |
56 | 67 | |
57 | 68 | **Changes:** |
58 | | - - Updated kube-stack version in docset.yml |
| 69 | + - Updated `kube-stack-version` to the latest value from elastic-agent repository |
| 70 | + |
| 71 | + **Generated by:** [Update Kube Stack Version workflow](https://github.com/${{ github.repository }}/actions/workflows/update-kube-stack-version.yml) |
59 | 72 | |
60 | | - This PR was created automatically by the weekly kube-stack version update workflow. |
| 73 | + This is an automated update. Please review the changes before merging. |
61 | 74 | branch: update-kube-stack-version |
62 | 75 | delete-branch: true |
63 | 76 | labels: | |
64 | 77 | automated |
65 | | - documentation |
| 78 | + chore |
| 79 | + kube-stack-version |
| 80 | +
|
| 81 | + - name: Dry run summary |
| 82 | + if: github.event.inputs.dry_run == 'true' |
| 83 | + run: | |
| 84 | + echo "## Dry Run Summary" >> $GITHUB_STEP_SUMMARY |
| 85 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 86 | + if [ "${{ steps.check-changes.outputs.has_changes }}" == "true" ]; then |
| 87 | + echo "✅ **Changes detected** - A PR would be created in a real run" >> $GITHUB_STEP_SUMMARY |
| 88 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 89 | + echo "**Changes that would be made:**" >> $GITHUB_STEP_SUMMARY |
| 90 | + echo '```diff' >> $GITHUB_STEP_SUMMARY |
| 91 | + git diff HEAD -- docset.yml >> $GITHUB_STEP_SUMMARY |
| 92 | + echo '```' >> $GITHUB_STEP_SUMMARY |
| 93 | + else |
| 94 | + echo "ℹ️ **No changes needed** - kube-stack-version is already up to date" >> $GITHUB_STEP_SUMMARY |
| 95 | + fi |
| 96 | +
|
| 97 | + - name: Summary |
| 98 | + if: github.event.inputs.dry_run != 'true' |
| 99 | + run: | |
| 100 | + echo "## Update Summary" >> $GITHUB_STEP_SUMMARY |
| 101 | + echo "" >> $GITHUB_STEP_SUMMARY |
| 102 | + if [ "${{ steps.check-changes.outputs.has_changes }}" == "true" ]; then |
| 103 | + echo "✅ **PR Created** - Changes detected and pull request created" >> $GITHUB_STEP_SUMMARY |
| 104 | + else |
| 105 | + echo "ℹ️ **No changes needed** - kube-stack-version is already up to date" >> $GITHUB_STEP_SUMMARY |
| 106 | + fi |
0 commit comments