|
44 | 44 | if: github.event.sender.type != 'Bot' |
45 | 45 | runs-on: ubuntu-latest |
46 | 46 | steps: |
| 47 | + # Check out the base ref (pull_request_target / issues both resolve to |
| 48 | + # the trusted base branch, never the fork head) so we can read the |
| 49 | + # welcome message template below. The template lives in its own .txt |
| 50 | + # file so editing the wording does not trigger a full CI run; see the |
| 51 | + # `ci` label exclusion in .github/labeler.yml. |
| 52 | + - uses: actions/checkout@v5 |
| 53 | + with: |
| 54 | + persist-credentials: false |
| 55 | + sparse-checkout: .github/welcome-first-time-contributor.txt |
| 56 | + sparse-checkout-cone-mode: false |
47 | 57 | - uses: actions/github-script@v8 |
48 | 58 | with: |
49 | 59 | github-token: ${{ secrets.GITHUB_TOKEN }} |
@@ -104,46 +114,17 @@ jobs: |
104 | 114 | return; |
105 | 115 | } |
106 | 116 |
|
107 | | - const body = [ |
108 | | - MARKER, |
109 | | - `👋 Thanks for your first contribution to Texera, @${author}!`, |
110 | | - ``, |
111 | | - `You can drive common housekeeping tasks just by leaving a comment. Type the command on its own line.`, |
112 | | - ``, |
113 | | - `### On issues`, |
114 | | - ``, |
115 | | - `| Command | What it does |`, |
116 | | - `|---|---|`, |
117 | | - `| \`/take\` | Assign the issue to yourself (self-claim it) |`, |
118 | | - `| \`/untake\` | Remove yourself as assignee |`, |
119 | | - ``, |
120 | | - `To find unclaimed work, search \`is:issue is:open no:assignee\` — there's no "triage" label; the search filter *is* the triage state.`, |
121 | | - ``, |
122 | | - `### Linking sub-issues`, |
123 | | - ``, |
124 | | - `| Command | Where to run it | What it does |`, |
125 | | - `|---|---|---|`, |
126 | | - `| \`/sub-issue #12 #13\` | On the **parent** | Links #12 and #13 as children of this issue |`, |
127 | | - `| \`/unsub-issue #12 #13\` | On the **parent** | Unlinks those children |`, |
128 | | - `| \`/parent-issue #5\` | On the **child** | Sets #5 as this issue's parent |`, |
129 | | - `| \`/unparent-issue\` | On the **child** | Removes this issue's parent (auto-detected) |`, |
130 | | - `| \`/unparent-issue #5\` | On the **child** | Removes parent #5 explicitly |`, |
131 | | - ``, |
132 | | - `You can write references as \`#12\` or bare \`12\`. Cross-repo references like \`owner/repo#12\` aren't supported and are ignored.`, |
133 | | - ``, |
134 | | - `### On pull requests (author only)`, |
135 | | - ``, |
136 | | - `| Command | What it does |`, |
137 | | - `|---|---|`, |
138 | | - `| \`/request-review @user [@user ...]\` | Request reviews from those users |`, |
139 | | - `| \`/unrequest-review @user [@user ...]\` | Cancel those review requests |`, |
140 | | - ``, |
141 | | - `You can mention teams as \`@org/team\`, and \`@copilot\` works too. Only the PR **author** can use these commands.`, |
142 | | - ``, |
143 | | - `> **Note:** Commands must match exactly — \`/take this\` won't work, only \`/take\`. Bots are ignored, and you can't self-link an issue or set an issue as its own parent.`, |
144 | | - ``, |
145 | | - `For the full contribution flow, see [CONTRIBUTING.md](https://github.com/${owner}/${repo}/blob/main/CONTRIBUTING.md).`, |
146 | | - ].join('\n'); |
| 117 | + // Message body lives in .github/welcome-first-time-contributor.txt |
| 118 | + // so wording edits skip CI. Substitute the runtime placeholders |
| 119 | + // and prepend the idempotency marker. |
| 120 | + const fs = require('fs'); |
| 121 | + const template = fs.readFileSync( |
| 122 | + '.github/welcome-first-time-contributor.txt', 'utf8', |
| 123 | + ); |
| 124 | + const body = MARKER + '\n' + template |
| 125 | + .replaceAll('{{author}}', author) |
| 126 | + .replaceAll('{{owner}}', owner) |
| 127 | + .replaceAll('{{repo}}', repo); |
147 | 128 |
|
148 | 129 | try { |
149 | 130 | await github.rest.issues.createComment({ |
|
0 commit comments