@@ -43,24 +43,20 @@ jobs:
4343 });
4444
4545 core.setOutput('author', pr.user.login);
46- core.setOutput('body', pr.body || '');
4746 core.setOutput('state', pr.state);
4847 core.setOutput('number', pr.number.toString());
4948
5049 - name : Check if author is org member
5150 id : org_check
52- uses : actions/github-script@v7
51+ uses : actions/github-script@v8
5352 with :
5453 github-token : ${{ secrets.GITHUB_TOKEN }}
5554 script : |
5655 const org = 'Pycord-Development';
5756 const username = '${{ steps.load_pr.outputs.author }}';
5857
5958 try {
60- await github.rest.orgs.checkMembershipForUser({
61- org,
62- username,
63- });
59+ await github.rest.orgs.checkMembershipForUser({ org, username });
6460 core.setOutput('is_member', 'true');
6561 } catch (error) {
6662 if (error.status === 404) {
@@ -81,11 +77,20 @@ jobs:
8177 with :
8278 github-token : ${{ secrets.GITHUB_TOKEN }}
8379 script : |
84- const body = (`${{ steps.load_pr.outputs.body }}` || '').trim();
80+ const prNumber = Number('${{ steps.load_pr.outputs.number }}');
81+
82+ // Fetch PR fresh here to safely get the body
83+ const { data: pr } = await github.rest.pulls.get({
84+ owner: context.repo.owner,
85+ repo: context.repo.repo,
86+ pull_number: prNumber,
87+ });
88+
89+ const body = (pr.body || '').trim();
8590
8691 const problems = [];
8792
88- // Basic length check – adjust as desired
93+ // Basic length check – adjust as needed
8994 if (body.length < 150) {
9095 problems.push('PR description is too short (expected more content based on the template).');
9196 }
@@ -122,18 +127,15 @@ jobs:
122127 github-token : ${{ secrets.GITHUB_TOKEN }}
123128 script : |
124129 const prNumber = Number('${{ steps.load_pr.outputs.number }}');
125- const problems = `${{ steps.validate.outputs.problems }}`;
126- const prState = '${{ steps.load_pr.outputs.state }}';
127-
128- const INVALID_LABEL = 'invalid';
129-
130- // 1) Add 'invalid' label if not present
130+ const problems = '${{ steps.validate.outputs.problems }}';
131131 const { data: pr } = await github.rest.pulls.get({
132132 owner: context.repo.owner,
133133 repo: context.repo.repo,
134134 pull_number: prNumber,
135135 });
136136
137+ const INVALID_LABEL = 'invalid';
138+
137139 const existingLabels = (pr.labels || []).map(l => l.name);
138140 if (!existingLabels.includes(INVALID_LABEL)) {
139141 await github.rest.issues.addLabels({
@@ -144,7 +146,6 @@ jobs:
144146 });
145147 }
146148
147- // 2) Comment with reason
148149 await github.rest.issues.createComment({
149150 owner: context.repo.owner,
150151 repo: context.repo.repo,
@@ -162,8 +163,7 @@ jobs:
162163 ].join('\n'),
163164 });
164165
165- // 3) Close PR if it is still open
166- if (prState === 'open') {
166+ if (pr.state === 'open') {
167167 await github.rest.pulls.update({
168168 owner: context.repo.owner,
169169 repo: context.repo.repo,
0 commit comments