|
| 1 | +name: 'Update GitHub Actions' |
| 2 | + |
| 3 | +description: 'Update GitHub Actions used in .github workflow files' |
| 4 | + |
| 5 | +inputs: |
| 6 | + token: |
| 7 | + required: false |
| 8 | + description: 'GitHub token' |
| 9 | + default: ${{ github.token }} |
| 10 | + |
| 11 | + base-branch: |
| 12 | + required: true |
| 13 | + description: 'Base branch for PR' |
| 14 | + default: 'main' |
| 15 | + |
| 16 | + branch-prefix: |
| 17 | + required: false |
| 18 | + description: 'Branch prefix' |
| 19 | + default: 'update-actions' |
| 20 | + |
| 21 | + pr-title: |
| 22 | + required: false |
| 23 | + description: 'Title for the pull request' |
| 24 | + default: 'Update GitHub Actions' |
| 25 | + |
| 26 | + commit-message: |
| 27 | + required: false |
| 28 | + description: 'The commit message for the update' |
| 29 | + default: 'Update GitHub Actions' |
| 30 | + |
| 31 | + file-glob: |
| 32 | + required: false |
| 33 | + description: 'Glob for workflow files (relative to repo root)' |
| 34 | + default: '.github/**/*.yml' |
| 35 | + |
| 36 | + prefixes: |
| 37 | + required: false |
| 38 | + description: 'Comma-separated list of action prefixes to include' |
| 39 | + default: 'actions' |
| 40 | + |
| 41 | + auto-merge: |
| 42 | + required: false |
| 43 | + description: 'Whether a successful PR should be automatically merged' |
| 44 | + default: 'false' |
| 45 | + |
| 46 | +runs: |
| 47 | + using: 'composite' |
| 48 | + steps: |
| 49 | + - name: Checkout and setup |
| 50 | + uses: alchemaxinc/composite-toolbox/checkout-and-setup@v1 |
| 51 | + with: |
| 52 | + token: ${{ inputs.token }} |
| 53 | + |
| 54 | + - name: Setup Python |
| 55 | + uses: actions/setup-python@v5 |
| 56 | + env: |
| 57 | + PYTHON_VERSION: '3.14' |
| 58 | + with: |
| 59 | + python-version: ${{ env.PYTHON_VERSION }} |
| 60 | + cache-dependency-path: ${{ github.action_path }}/requirements.txt |
| 61 | + |
| 62 | + - name: Install dependencies |
| 63 | + shell: bash |
| 64 | + run: python -m pip install -r ${{ github.action_path }}/requirements.txt |
| 65 | + |
| 66 | + - name: Update action versions |
| 67 | + shell: bash |
| 68 | + env: |
| 69 | + GH_TOKEN: ${{ inputs.token }} |
| 70 | + run: | |
| 71 | + python ${{ github.action_path }}/cli.py \ |
| 72 | + --root "$GITHUB_WORKSPACE" \ |
| 73 | + --file-glob "${{ inputs.file-glob }}" \ |
| 74 | + --prefixes "${{ inputs.prefixes }}" |
| 75 | +
|
| 76 | + - name: Check for changes |
| 77 | + id: check_changes |
| 78 | + uses: alchemaxinc/composite-toolbox/check-changes@v1 |
| 79 | + with: |
| 80 | + files: '.github' |
| 81 | + |
| 82 | + - name: Create Pull Request |
| 83 | + id: open-pr |
| 84 | + if: steps.check_changes.outputs.has_changes == 'true' |
| 85 | + uses: alchemaxinc/composite-toolbox/create-pr@v1 |
| 86 | + with: |
| 87 | + token: ${{ inputs.token }} |
| 88 | + base-branch: ${{ inputs.base-branch }} |
| 89 | + branch-prefix: ${{ inputs.branch-prefix }} |
| 90 | + files: '.github' |
| 91 | + commit-message: ${{ inputs.commit-message }} |
| 92 | + pr-title: ${{ inputs.pr-title }} |
| 93 | + pr-body: | |
| 94 | + # :arrows_counterclockwise: GitHub Actions Update |
| 95 | +
|
| 96 | + This pull request automatically updates GitHub Actions used in `.github` workflows. |
| 97 | +
|
| 98 | + ## :warning: Important Notes |
| 99 | +
|
| 100 | + - :robot: This PR was **automatically generated** |
| 101 | + - :mag: Please **review all changes** carefully before merging |
| 102 | + - :test_tube: Ensure all tests pass and functionality works as expected |
| 103 | + - :books: Check for any breaking changes or release notes for updated actions |
| 104 | +
|
| 105 | + ## :rocket: Next Steps |
| 106 | +
|
| 107 | + 1. Review the action changes above |
| 108 | + 2. Run tests locally or wait for CI/CD to complete |
| 109 | + 3. Merge when everything looks good! |
| 110 | +
|
| 111 | + --- |
| 112 | +
|
| 113 | + *Generated by the GitHub Actions Update action* :sparkles: |
| 114 | +
|
| 115 | + - name: Auto-merge Pull Request |
| 116 | + if: inputs.auto-merge == 'true' && steps.open-pr.outcome == 'success' |
| 117 | + uses: alchemaxinc/composite-toolbox/merge-pr@v1 |
| 118 | + with: |
| 119 | + token: ${{ inputs.token }} |
| 120 | + merge-method: 'squash' |
| 121 | + pull-request-number: ${{ steps.open-pr.outputs.pr_number }} |
0 commit comments