-
Notifications
You must be signed in to change notification settings - Fork 38
80 lines (66 loc) · 2.92 KB
/
check-ruby-versions.yaml
File metadata and controls
80 lines (66 loc) · 2.92 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
name: Check for New Ruby Versions
on:
schedule:
- cron: '17 * * * *' # Hourly at minute 17
workflow_dispatch: # Allow manual triggers
permissions:
contents: write
pull-requests: write
issues: write
jobs:
check-versions:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: Check for new versions and create PR
id: check-and-create
env:
GITHUB_TOKEN: ${{ secrets.RUBY_AUTOMATION_PAT }}
run: bin/check-and-create-pr
- name: Annotate new versions added
if: steps.check-and-create.outputs.pr_created == 'true'
run: |
echo "::notice title=✨ New Ruby Versions Added::Added Ruby version(s): ${{ steps.check-and-create.outputs.new_versions }}. PR: ${{ steps.check-and-create.outputs.pr_url }}"
- name: Annotate no new versions
if: steps.check-and-create.outputs.pr_created == 'false' && steps.check-and-create.outputs.new_versions == ''
run: |
echo "::notice title=ℹ️ No New Ruby Versions::All Ruby versions are up to date. No new versions were found."
- name: Enable auto-merge
if: steps.check-and-create.outputs.pr_created == 'true'
env:
GH_TOKEN: ${{ secrets.RUBY_AUTOMATION_PAT }}
run: |
echo "Enabling auto-merge for PR #${{ steps.check-and-create.outputs.pr_number }}..."
gh pr merge ${{ steps.check-and-create.outputs.pr_number }} --auto --squash
- name: Annotate failure
if: failure()
run: |
echo "::error title=❌ Ruby Version Check Failed::The automated Ruby version check failed. Error: ${{ steps.check-and-create.outputs.error }}. See workflow run for details."
- name: Create issue on failure
if: failure()
id: create-issue
uses: actions/github-script@v7
with:
script: |
const issue = await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: '🔴 Ruby Version Check Failed',
body: `The automated Ruby version check workflow failed.
**Run:** ${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}
**Job:** ${context.job}
Please check the workflow logs for details.`,
labels: ['automation', 'bug', 'ruby-versions']
});
core.setOutput('issue_number', issue.data.number);
core.setOutput('issue_url', issue.data.html_url);
- name: Annotate issue created
if: failure() && steps.create-issue.outputs.issue_url
run: |
echo "::error title=🔴 Issue Created::An issue has been created to track this failure: ${{ steps.create-issue.outputs.issue_url }}"