From: Patrick Donnelly Date: Tue, 12 Aug 2025 15:55:04 +0000 (-0400) Subject: .github: only run redmine-upkeep actions from ceph/ceph.git X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F64821%2Fhead;p=ceph.git .github: only run redmine-upkeep actions from ceph/ceph.git Signed-off-by: Patrick Donnelly --- diff --git a/.github/workflows/redmine-upkeep.yml b/.github/workflows/redmine-upkeep.yml index 58aab58945cb..11400145ee49 100644 --- a/.github/workflows/redmine-upkeep.yml +++ b/.github/workflows/redmine-upkeep.yml @@ -37,7 +37,8 @@ concurrency: jobs: redmine-upkeep: runs-on: ubuntu-latest - if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/feature/redmine-upkeep' + # This condition ensures the job only runs in the main ceph/ceph repository and only on the specified branches. + if: github.repository == 'ceph/ceph' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/feature/redmine-upkeep') permissions: # To allow writing comments on PRs: issues: write diff --git a/src/script/redmine-upkeep.py b/src/script/redmine-upkeep.py index f8b30042d7df..4a7f1a010a8e 100755 --- a/src/script/redmine-upkeep.py +++ b/src/script/redmine-upkeep.py @@ -48,9 +48,7 @@ GITHUB_RUN_ID = os.getenv("GITHUB_RUN_ID", "nil") GITHUB_ACTION_LOG = f"{GITHUB_SERVER_URL}/{GITHUB_REPOSITORY}/actions/runs/{GITHUB_RUN_ID}" GITHUB_USER = os.getenv("GITHUB_USER", os.getenv("GITHUB_USER", getuser())) -GITHUB_ORG = "ceph" -GITHUB_REPO = "ceph" -GITHUB_API_ENDPOINT = f"https://api.github.com/repos/{GITHUB_ORG}/{GITHUB_REPO}" +GITHUB_API_ENDPOINT = f"https://api.github.com/repos/{GITHUB_REPOSITORY}" REDMINE_CUSTOM_FIELD_ID_BACKPORT = 2 REDMINE_CUSTOM_FIELD_ID_RELEASE = 16 @@ -1400,6 +1398,10 @@ def main(): log.fatal("REDMINE_API_KEY not found! Please set REDMINE_API_KEY environment variable or ~/.redmine_key.") sys.exit(1) + if IS_GITHUB_ACTION and GITHUB_REPOSITORY != "ceph/ceph": + log.fatal("refusing to run ceph/ceph.git github action for repository {GITHUB_REPOSITORY}") + sys.exit(0) + RU = None try: RU = RedmineUpkeep(args)