@@ -21,9 +21,8 @@ name: check_required_files
21
21
22
22
# Workflow triggers:
23
23
on :
24
- # Trigger the workflow when a PR review is requested:
25
- pull_request_target :
26
- types : [review_requested]
24
+ # Allow the workflow to be triggered by other workflows
25
+ workflow_call :
27
26
28
27
# Global permissions:
29
28
permissions :
@@ -66,31 +65,15 @@ jobs:
66
65
lfs : false
67
66
timeout-minutes : 10
68
67
69
- # Check if the review is requested from the `stdlib-bot` user:
70
- - name : ' Check if review is requested from stdlib-bot'
71
- id : check-reviewers
72
- run : |
73
- # Get the list of reviewers:
74
- reviewers=$(jq -r '.pull_request.requested_reviewers | .[] | .login' "$GITHUB_EVENT_PATH")
75
-
76
- # Check if the list of reviewers contains the `stdlib-bot` user:
77
- if [[ $reviewers == *"stdlib-bot"* ]]; then
78
- echo "is_stdlib_bot=true" >> $GITHUB_OUTPUT
79
- else
80
- echo "is_stdlib_bot=false" >> $GITHUB_OUTPUT
81
- fi
82
-
83
68
# Configure git:
84
69
- name : ' Configure git'
85
- if : steps.check-reviewers.outputs.is_stdlib_bot == 'true'
86
70
run : |
87
71
git config --local user.email "noreply@stdlib.io"
88
72
git config --local user.name "stdlib-bot"
89
73
git fetch --all
90
74
91
75
# Get list of added files:
92
76
- name : ' Get list of added files'
93
- if : steps.check-reviewers.outputs.is_stdlib_bot == 'true'
94
77
id : added-files
95
78
run : |
96
79
page=1
108
91
109
92
# Check whether the pull request contains a new `README.md` file; if not, exit with a non-zero exit code:
110
93
- name : ' Exit if pull request does not contain a new README.md file'
111
- if : steps.check-reviewers.outputs.is_stdlib_bot == 'true'
112
94
run : |
113
95
if [[ ! "${{ steps.added-files.outputs.files }}" =~ "README.md" ]]; then
114
96
echo "Pull request does not contain a new README.md file."
117
99
118
100
# Check whether the pull request contains files which are required to be present for all packages:
119
101
- name : ' Check whether the pull request contains files which are required to be present for all packages'
120
- if : steps.check-reviewers.outputs.is_stdlib_bot == 'true'
121
102
id : check-required-files
122
103
run : |
123
104
# Define a list of required files:
@@ -218,7 +199,6 @@ jobs:
218
199
219
200
# Create a comment on the pull request informing the user whether the pull request is missing required files:
220
201
- name : ' Create a comment on the pull request informing the user whether the pull request is missing required files'
221
- if : steps.check-reviewers.outputs.is_stdlib_bot == 'true'
222
202
# Pin action to full length commit SHA
223
203
uses : peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
224
204
with :
0 commit comments