]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
.github: only run redmine-upkeep actions from ceph/ceph.git 64821/head
authorPatrick Donnelly <pdonnell@ibm.com>
Tue, 12 Aug 2025 15:55:04 +0000 (11:55 -0400)
committerPatrick Donnelly <pdonnell@ibm.com>
Tue, 12 Aug 2025 18:31:49 +0000 (14:31 -0400)
Signed-off-by: Patrick Donnelly <pdonnell@ibm.com>
.github/workflows/redmine-upkeep.yml
src/script/redmine-upkeep.py

index 58aab58945cbaa71f873767a80debf6a965b0fce..11400145ee4937be840e4bd9ec5c5fdd4aa4190a 100644 (file)
@@ -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
index f8b30042d7df7d5bd5c3183d4c342965b7fb89d3..4a7f1a010a8e58fc6183341cb9ab782302d9b4a6 100755 (executable)
@@ -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)