From 6f7cd637cb36ccecf7d2928ffef7c5a285fa7df1 Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Tue, 23 Sep 2025 15:02:45 +1200 Subject: [PATCH] CI: Check repo for YosysHQ specific jobs Prevents unintended bumps on the flake.lock and Yosys version on forks (provided the forks synchronize their main after this gets merged). Update version.yml to use the same style of `if` on the job, rather than on specific actions. Wheels will still build as a cron job, but won't try to upload if it's a fork. --- .github/workflows/update-flake-lock.yml | 1 + .github/workflows/version.yml | 8 +++----- .github/workflows/wheels.yml | 1 + 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/update-flake-lock.yml b/.github/workflows/update-flake-lock.yml index de7ef04d6..b32498baf 100644 --- a/.github/workflows/update-flake-lock.yml +++ b/.github/workflows/update-flake-lock.yml @@ -6,6 +6,7 @@ on: jobs: lockfile: + if: github.repository == 'YosysHQ/Yosys' runs-on: ubuntu-latest steps: - name: Checkout repository diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml index 26dcba4a4..78d34db46 100644 --- a/.github/workflows/version.yml +++ b/.github/workflows/version.yml @@ -7,6 +7,7 @@ on: jobs: bump-version: + if: github.repository == 'YosysHQ/Yosys' runs-on: ubuntu-latest steps: - name: Checkout @@ -18,11 +19,8 @@ jobs: - name: Take last commit id: log run: echo "message=$(git log --no-merges -1 --oneline)" >> $GITHUB_OUTPUT - - name: Take repository - id: repo - run: echo "message=$GITHUB_REPOSITORY" >> $GITHUB_OUTPUT - name: Bump version - if: "!contains(steps.log.outputs.message, 'Bump version') && contains(steps.repo.outputs.message, 'YosysHQ/yosys')" + if: ${{ !contains(steps.log.outputs.message, 'Bump version') }} run: | make bumpversion git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" @@ -30,7 +28,7 @@ jobs: git add Makefile git commit -m "Bump version" - name: Push changes # push the output folder to your repo - if: "!contains(steps.log.outputs.message, 'Bump version') && contains(steps.repo.outputs.message, 'YosysHQ/yosys')" + if: ${{ !contains(steps.log.outputs.message, 'Bump version') }} uses: ad-m/github-push-action@master with: github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 41d9183fc..2a5b7e024 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -124,6 +124,7 @@ jobs: path: ./wheelhouse/*.whl upload_wheels: name: Upload Wheels + if: github.repository == 'YosysHQ/Yosys' runs-on: ubuntu-latest # Specifying a GitHub environment is optional, but strongly encouraged environment: pypi