--- name: Version Maintenance on: schedule: # Run weekly on Monday at 9 AM UTC - cron: '0 9 * * 1' workflow_dispatch: inputs: major-version: description: 'Major version to check (e.g., v2025)' required: false type: string permissions: contents: write pull-requests: write issues: write jobs: check-and-update: name: Check Version References runs-on: ubuntu-latest steps: - name: Checkout Repository uses: actions/checkout@71cf2267d89c5cb81562390fa70a37fa40b1305e # v6-beta with: fetch-depth: 0 token: ${{ secrets.GITHUB_TOKEN }} - name: Determine Major Version id: version shell: sh run: | if [ -n "${{ inputs.major-version }}" ]; then printf '%s\n' "major=${{ inputs.major-version }}" >> "$GITHUB_OUTPUT" else current_year=$(date +%Y) printf '%s\n' "major=v$current_year" >> "$GITHUB_OUTPUT" fi - name: Ensure Major Version Tag Exists id: ensure-tag shell: sh env: MAJOR_VERSION: ${{ steps.version.outputs.major }} run: | set -eu git fetch --tags --force if git rev-list -n 1 "$MAJOR_VERSION" >/dev/null 2>&1; then echo "Tag $MAJOR_VERSION already exists" printf '%s\n' "created=false" >> "$GITHUB_OUTPUT" else echo "Tag $MAJOR_VERSION not found, creating..." git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" git tag -a "$MAJOR_VERSION" -m "Major version $MAJOR_VERSION" git push origin "$MAJOR_VERSION" echo "Created and pushed tag $MAJOR_VERSION" printf '%s\n' "created=true" >> "$GITHUB_OUTPUT" fi - name: Run Action Versioning id: action-versioning uses: ./action-versioning with: major-version: ${{ steps.version.outputs.major }} token: ${{ secrets.GITHUB_TOKEN }} - name: Create Pull Request if: steps.action-versioning.outputs.updated == 'true' uses: peter-evans/create-pull-request@98357b18bf14b5342f975ff684046ec3b2a07725 # v8.0.0 with: token: ${{ secrets.GITHUB_TOKEN }} commit-message: 'chore: update action references to ${{ steps.version.outputs.major }}' title: 'chore: Update action references to ${{ steps.version.outputs.major }}' body: | ## Version Maintenance This PR updates all internal action references to match the latest ${{ steps.version.outputs.major }} tag. **Updated SHA**: `${{ steps.action-versioning.outputs.commit-sha }}` ### Changes - Updated all `*/action.yml` files to reference the current ${{ steps.version.outputs.major }} SHA ### Verification ```bash make check-version-refs ``` branch: automated/version-update-${{ steps.version.outputs.major }} delete-branch: true labels: | automated dependencies - name: Check for Annual Bump if: steps.action-versioning.outputs.needs-annual-bump == 'true' uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 with: script: | const currentYear = new Date().getFullYear(); const majorVersion = '${{ steps.version.outputs.major }}'; await github.rest.issues.create({ owner: context.repo.owner, repo: context.repo.repo, title: `🔄 Annual Version Bump Needed: ${majorVersion} → v${currentYear}`, body: `## Annual Version Bump Required It's time to bump the major version from ${majorVersion} to v${currentYear}. ### Steps 1. **Create the new major version tag:** \`\`\`bash git tag -a v${currentYear} -m "Major version v${currentYear}" git push origin v${currentYear} \`\`\` 2. **Bump all action references:** \`\`\`bash make bump-major-version OLD=${majorVersion} NEW=v${currentYear} \`\`\` 3. **Update documentation:** \`\`\`bash make docs \`\`\` 4. **Commit and push:** \`\`\`bash git push origin main \`\`\` ### Verification \`\`\`bash make check-version-refs \`\`\` `, labels: ['maintenance', 'high-priority'] });