Skip to content
This repository was archived by the owner on Oct 19, 2026. It is now read-only.

Commit 6def411

Browse files
Fix block new pull requests workflow (#30017)
## Summary - fix invalid YAML in `BlockNewPullRequests.yml` caused by an unindented multiline JavaScript template literal - run the PR blocker on `pull_request_target` with explicit `issues: write` and `pull-requests: write` permissions so it can comment on and close new PRs - quote `$GITHUB_OUTPUT` writes and set `shell: bash` for the date comparison step ## Validation - parsed `.github/workflows/BlockNewPullRequests.yml` with PyYAML successfully - confirmed the original run failure points to YAML syntax line 30 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 8503552 commit 6def411

1 file changed

Lines changed: 22 additions & 11 deletions

File tree

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,48 @@
11
name: Block New Pull Requests
22

33
on:
4-
pull_request:
4+
pull_request_target:
55
types: [opened]
6+
branches: [main]
7+
8+
permissions:
9+
contents: read
10+
issues: write
11+
pull-requests: write
612

713
jobs:
814
block-new-prs:
15+
if: github.repository_owner == 'microsoft' && github.event.pull_request.state == 'open'
916
runs-on: ubuntu-latest
1017
steps:
1118
- name: Check PR creation date
1219
id: check
20+
shell: bash
1321
run: |
1422
created_at="${{ github.event.pull_request.created_at }}"
1523
cutoff="2026-05-05T00:00:00Z"
1624
1725
if [[ "$created_at" > "$cutoff" ]]; then
18-
echo "block=true" >> $GITHUB_OUTPUT
26+
echo "block=true" >> "$GITHUB_OUTPUT"
1927
else
20-
echo "block=false" >> $GITHUB_OUTPUT
28+
echo "block=false" >> "$GITHUB_OUTPUT"
2129
fi
2230
2331
- name: Comment and close PR
2432
if: steps.check.outputs.block == 'true'
2533
uses: actions/github-script@v7
2634
with:
35+
github-token: ${{ secrets.GITHUB_TOKEN }}
2736
script: |
28-
const message = `👋 Thanks for your contribution!
29-
30-
ALAppExtensions no longer accepts new pull requests.
31-
32-
Extensibility requests, such as event requests and requests to make functions external, are still accepted as issues using the extensibility request template.
33-
34-
We appreciate your understanding and look forward to continuing extensibility collaboration here 🙌`;
37+
const message = [
38+
'👋 Thanks for your contribution!',
39+
'',
40+
'ALAppExtensions no longer accepts new pull requests.',
41+
'',
42+
'Extensibility requests, such as event requests and requests to make functions external, are still accepted as issues using the extensibility request template.',
43+
'',
44+
'We appreciate your understanding and look forward to continuing extensibility collaboration here 🙌'
45+
].join('\n');
3546
3647
await github.rest.issues.createComment({
3748
...context.repo,
@@ -42,5 +53,5 @@ We appreciate your understanding and look forward to continuing extensibility co
4253
await github.rest.pulls.update({
4354
...context.repo,
4455
pull_number: context.issue.number,
45-
state: "closed"
56+
state: 'closed'
4657
});

0 commit comments

Comments
 (0)