From 4efce72184835a6afbca70c1c9a9d721309a1549 Mon Sep 17 00:00:00 2001 From: Paul O'Shannessy Date: Wed, 24 Apr 2024 15:36:57 -0700 Subject: [PATCH] Rebuild GitHub Actions workflows Summary: X-link: https://github.com/facebookincubator/zstrong/pull/749 Updating generated workflow files to account for recent changes. Most notably, this updates the checkout action to v4 and sets an explicit read-only permission. This also adds support for `--cron` in the codegen to account for only running CI on a schedule (useful for managing costs). Reviewed By: ahornby Differential Revision: D56165825 fbshipit-source-id: 298b16effefb6b8a2dc6cbcf07d4ec4a61f48364 --- .github/workflows/getdeps_linux.yml | 5 ++++- .github/workflows/getdeps_mac.yml | 5 ++++- build/fbcode_builder/getdeps.py | 9 +++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/getdeps_linux.yml b/.github/workflows/getdeps_linux.yml index e02c52340..c8af0c818 100644 --- a/.github/workflows/getdeps_linux.yml +++ b/.github/workflows/getdeps_linux.yml @@ -10,11 +10,14 @@ on: branches: - main +permissions: + contents: read # to fetch code (actions/checkout) + jobs: build: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Fetch ninja run: python3 build/fbcode_builder/getdeps.py fetch --no-tests ninja - name: Fetch cmake diff --git a/.github/workflows/getdeps_mac.yml b/.github/workflows/getdeps_mac.yml index 296385ed8..034863e98 100644 --- a/.github/workflows/getdeps_mac.yml +++ b/.github/workflows/getdeps_mac.yml @@ -10,11 +10,14 @@ on: branches: - main +permissions: + contents: read # to fetch code (actions/checkout) + jobs: build: runs-on: macOS-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Fetch ninja run: python3 build/fbcode_builder/getdeps.py fetch --no-tests ninja - name: Fetch cmake diff --git a/build/fbcode_builder/getdeps.py b/build/fbcode_builder/getdeps.py index 4ab21537f..3b15bd342 100755 --- a/build/fbcode_builder/getdeps.py +++ b/build/fbcode_builder/getdeps.py @@ -944,6 +944,11 @@ class GenerateGitHubActionsCmd(ProjectCmdBase): def get_run_on(self, args): if args.run_on_all_branches: return self.RUN_ON_ALL + if args.cron: + return f""" + schedule: + - cron: '{args.cron}'""" + return f""" push: branches: @@ -1213,6 +1218,10 @@ jobs: parser.add_argument( "--ubuntu-version", default="20.04", help="Version of Ubuntu to use" ) + parser.add_argument( + "--cron", + help="Specify that the job runs on a cron schedule instead of on pushes", + ) parser.add_argument( "--main-branch", default="main",