Skip to content

Commit 367b5a1

Browse files
committed
Disable docs job if contributor is external
1 parent 48d3b52 commit 367b5a1

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

.github/workflows/docs-build-push.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,27 @@ env:
4949
DOMAIN_PROD: "docs.nginx.com"
5050

5151
jobs:
52+
checks:
53+
name: Checks and variables
54+
runs-on: ubuntu-22.04
55+
permissions:
56+
contents: read
57+
outputs:
58+
forked_workflow: ${{ steps.vars.outputs.forked_workflow }}
59+
steps:
60+
- name: Checkout Repository
61+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
62+
63+
- name: Set Variables
64+
id: vars
65+
run: |
66+
echo "forked_workflow=${{ (github.event.pull_request && github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name) || !(startsWith(github.repository, 'nginx/') || startsWith(github.repository, 'nginxinc/')) }}" >> $GITHUB_OUTPUT
67+
- name: Output variables
68+
run: |
69+
echo forked_workflow: ${{ steps.vars.outputs.forked_workflow }}
5270
build:
71+
needs: [checks]
72+
if: ${{ needs.checks.outputs.forked_workflow == 'false' }}
5373
runs-on: ubuntu-latest
5474
env:
5575
# Remapping of inputs to envs

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ _note: autodeploy from branch is currently in progress. This docs will be update
2222

2323
## Usage
2424

25+
_note: This action **will not work** with Pull Requests on forked repositories. GitHub does not allow secrets to be shared with forked Pull Requests. Secrets are required as part of Azure interactions. The "Checks and variables" job stops this action from running on forked repositories._
26+
2527
### Security considerations
2628
`AZURE_CREDENTIALS` need to contain service principal credentials with the following roles assigned;
2729
- **Storage Blob Data Contributor**

0 commit comments

Comments
 (0)