From c830fc969b98935ff808434a066f07d10983b30b Mon Sep 17 00:00:00 2001 From: AlexV Date: Mon, 29 Jun 2026 17:55:59 +0200 Subject: [PATCH] [chores] Added fork guard to non-CI workflows --- .github/workflows/backport.yml | 5 ++++- .github/workflows/bot-autoassign-issue.yml | 4 +++- .github/workflows/bot-autoassign-pr-issue-link.yml | 4 +++- .github/workflows/bot-autoassign-pr-reopen.yml | 11 +++++++++-- .github/workflows/bot-autoassign-stale-pr.yml | 1 + .github/workflows/bot-changelog-runner.yml | 8 ++++++-- .github/workflows/bot-changelog-trigger.yml | 3 ++- .github/workflows/bot-ci-failure.yml | 5 ++++- .github/workflows/pypi.yml | 1 + .github/workflows/version-branch.yml | 1 + 10 files changed, 34 insertions(+), 9 deletions(-) diff --git a/.github/workflows/backport.yml b/.github/workflows/backport.yml index 556ec7db8..63c107e76 100644 --- a/.github/workflows/backport.yml +++ b/.github/workflows/backport.yml @@ -17,7 +17,9 @@ permissions: jobs: backport-on-push: - if: github.event_name == 'push' + if: > + github.repository == 'openwisp/openwisp-users' && + github.event_name == 'push' uses: openwisp/openwisp-utils/.github/workflows/reusable-backport.yml@master with: commit_sha: ${{ github.sha }} @@ -27,6 +29,7 @@ jobs: backport-on-comment: if: > + github.repository == 'openwisp/openwisp-users' && github.event_name == 'issue_comment' && github.event.issue.pull_request && github.event.issue.pull_request.merged_at != null && diff --git a/.github/workflows/bot-autoassign-issue.yml b/.github/workflows/bot-autoassign-issue.yml index 754e35196..a02df370c 100644 --- a/.github/workflows/bot-autoassign-issue.yml +++ b/.github/workflows/bot-autoassign-issue.yml @@ -10,7 +10,9 @@ concurrency: cancel-in-progress: true jobs: respond-to-assign-request: - if: github.event.issue.pull_request == null + if: > + github.repository == 'openwisp/openwisp-users' && + github.event.issue.pull_request == null uses: openwisp/openwisp-utils/.github/workflows/reusable-bot-autoassign.yml@master with: bot_command: issue_assignment diff --git a/.github/workflows/bot-autoassign-pr-issue-link.yml b/.github/workflows/bot-autoassign-pr-issue-link.yml index dcc1d50db..d66be1c0d 100644 --- a/.github/workflows/bot-autoassign-pr-issue-link.yml +++ b/.github/workflows/bot-autoassign-pr-issue-link.yml @@ -11,7 +11,9 @@ concurrency: cancel-in-progress: true jobs: auto-assign-issue: - if: github.event.action != 'closed' || github.event.pull_request.merged == false + if: > + github.repository == 'openwisp/openwisp-users' && + (github.event.action != 'closed' || github.event.pull_request.merged == false) uses: openwisp/openwisp-utils/.github/workflows/reusable-bot-autoassign.yml@master with: bot_command: issue_assignment diff --git a/.github/workflows/bot-autoassign-pr-reopen.yml b/.github/workflows/bot-autoassign-pr-reopen.yml index 4ee943020..a38f4cb09 100644 --- a/.github/workflows/bot-autoassign-pr-reopen.yml +++ b/.github/workflows/bot-autoassign-pr-reopen.yml @@ -13,7 +13,10 @@ concurrency: cancel-in-progress: true jobs: reassign-on-reopen: - if: github.event_name == 'pull_request_target' && github.event.action == 'reopened' + if: > + github.repository == 'openwisp/openwisp-users' && + github.event_name == 'pull_request_target' && + github.event.action == 'reopened' uses: openwisp/openwisp-utils/.github/workflows/reusable-bot-autoassign.yml@master with: bot_command: pr_reopen @@ -21,7 +24,11 @@ jobs: OPENWISP_BOT_APP_ID: ${{ secrets.OPENWISP_BOT_APP_ID }} OPENWISP_BOT_PRIVATE_KEY: ${{ secrets.OPENWISP_BOT_PRIVATE_KEY }} handle-pr-activity: - if: github.event_name == 'issue_comment' && github.event.issue.pull_request && github.event.issue.user.login == github.event.comment.user.login + if: > + github.repository == 'openwisp/openwisp-users' && + github.event_name == 'issue_comment' && + github.event.issue.pull_request && + github.event.issue.user.login == github.event.comment.user.login uses: openwisp/openwisp-utils/.github/workflows/reusable-bot-autoassign.yml@master with: bot_command: pr_reopen diff --git a/.github/workflows/bot-autoassign-stale-pr.yml b/.github/workflows/bot-autoassign-stale-pr.yml index 80e420484..c4c0a37a1 100644 --- a/.github/workflows/bot-autoassign-stale-pr.yml +++ b/.github/workflows/bot-autoassign-stale-pr.yml @@ -12,6 +12,7 @@ concurrency: cancel-in-progress: false jobs: manage-stale-prs-python: + if: github.repository == 'openwisp/openwisp-users' uses: openwisp/openwisp-utils/.github/workflows/reusable-bot-autoassign.yml@master with: bot_command: stale_pr diff --git a/.github/workflows/bot-changelog-runner.yml b/.github/workflows/bot-changelog-runner.yml index 218a7cce1..2d84914ca 100644 --- a/.github/workflows/bot-changelog-runner.yml +++ b/.github/workflows/bot-changelog-runner.yml @@ -12,7 +12,9 @@ permissions: jobs: fetch-metadata: runs-on: ubuntu-latest - if: github.event.workflow_run.conclusion == 'success' + if: > + github.repository == 'openwisp/openwisp-users' && + github.event.workflow_run.conclusion == 'success' permissions: actions: read outputs: @@ -40,7 +42,9 @@ jobs: changelog: needs: fetch-metadata - if: needs.fetch-metadata.outputs.pr_number != '' + if: > + github.repository == 'openwisp/openwisp-users' && + needs.fetch-metadata.outputs.pr_number != '' permissions: contents: read pull-requests: write diff --git a/.github/workflows/bot-changelog-trigger.yml b/.github/workflows/bot-changelog-trigger.yml index 0c67145cd..565f280ca 100644 --- a/.github/workflows/bot-changelog-trigger.yml +++ b/.github/workflows/bot-changelog-trigger.yml @@ -8,7 +8,8 @@ permissions: {} jobs: check: - if: | + if: > + github.repository == 'openwisp/openwisp-users' && github.event.review.state == 'approved' && (github.event.review.author_association == 'OWNER' || github.event.review.author_association == 'MEMBER' || diff --git a/.github/workflows/bot-ci-failure.yml b/.github/workflows/bot-ci-failure.yml index daa3d848a..4465b82d7 100644 --- a/.github/workflows/bot-ci-failure.yml +++ b/.github/workflows/bot-ci-failure.yml @@ -18,7 +18,10 @@ concurrency: jobs: find-pr: runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'failure' && github.event.workflow_run.event == 'pull_request' }} + if: > + github.repository == 'openwisp/openwisp-users' && + github.event.workflow_run.conclusion == 'failure' && + github.event.workflow_run.event == 'pull_request' outputs: pr_number: ${{ steps.pr.outputs.number }} pr_author: ${{ steps.pr.outputs.author }} diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index f912644ac..7d6a4ffc5 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -9,6 +9,7 @@ permissions: jobs: pypi-publish: + if: github.repository == 'openwisp/openwisp-users' name: Release Python Package on Pypi.org runs-on: ubuntu-latest environment: diff --git a/.github/workflows/version-branch.yml b/.github/workflows/version-branch.yml index 20206be8a..c3e1918f0 100644 --- a/.github/workflows/version-branch.yml +++ b/.github/workflows/version-branch.yml @@ -7,6 +7,7 @@ on: jobs: version-branch: + if: github.repository == 'openwisp/openwisp-users' uses: openwisp/openwisp-utils/.github/workflows/reusable-version-branch.yml@master with: module_name: openwisp_users