Skip to content

Disable scheduled jobs for forks#1084

Merged
tompng merged 1 commit into
ruby:masterfrom
andyw8:andyw8/disable-schedule-jobs-for-forks
Feb 13, 2025
Merged

Disable scheduled jobs for forks#1084
tompng merged 1 commit into
ruby:masterfrom
andyw8:andyw8/disable-schedule-jobs-for-forks

Conversation

@andyw8
Copy link
Copy Markdown
Contributor

@andyw8 andyw8 commented Feb 11, 2025

@andyw8 andyw8 force-pushed the andyw8/disable-schedule-jobs-for-forks branch from 64e7523 to ea79bd6 Compare February 12, 2025 00:25
Comment thread .github/workflows/test.yml Outdated

jobs:
ruby-versions:
if: github.repository == 'ruby/irb'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a use case where I want to check the CI results on my forked repository, so I’d like to disable only the scheduled job. How about this?

Suggested change
if: github.repository == 'ruby/irb'
if: github.event_name == 'schedule' && github.repository != 'ruby/irb'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if: github.repository == 'ruby/irb' || github.event_name != 'schedule'
Examples in other repositories in ruby org
https://github.com/search?q=org%3Aruby%20github.event_name%20%22%27schedule%27%22&type=code

I wish GitHub have a configuration of enabling/disabling scheduled jobs, not the whole workflow.

Comment thread .github/workflows/test.yml Outdated
- name: Run rubocop
run: bundle exec rubocop
irb:
if: github.repository == 'ruby/irb'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This if: (and if: in vterm-yamatanooroti job) is not needed because these jobs depend on ruby-versions.
Maybe lint and debug-test can have needs: ruby-versions so that we don't need to write many if: with the same condition. (I'd be happy if there is a better idea)

@andyw8 andyw8 force-pushed the andyw8/disable-schedule-jobs-for-forks branch from ea79bd6 to 26a66bd Compare February 13, 2025 02:27
@andyw8
Copy link
Copy Markdown
Contributor Author

andyw8 commented Feb 13, 2025

Updated with @tompng's feedback.

@tompng tompng merged commit 421c28f into ruby:master Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants