-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Bugfix - ExternalNotificationModule - ambientLightingThread not checked for non-null before use #11577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Bugfix - ExternalNotificationModule - ambientLightingThread not checked for non-null before use #11577
Changes from all commits
Commits
Show all changes
104 commits
Select commit
Hold shift + click to select a range
711abb5
activate HWID
caveman99 4d49067
remove private flag
caveman99 0f761d9
Update clock to be 70% max versus 80% to avoid unintended overlaps (#…
Xaositek a96f83f
Actions: Fix tagging upon release. (#10521)
vidplace7 73e7979
Refactor keyboard cell height logic for consistency (#10501)
Bjk8kds 8b22448
fix: first set pinMode, then write to pin (#10520)
kpmy 3851fbf
Refactor position precision handling to honor explicit channel settin…
thebentern 472b14c
Fix update neighbor_info before checking update_interval in handleSet…
thebentern 1c0182f
Update ESP32-CH390 to v1.1.0 (#10528)
vidplace7 0ee3602
Automated version bumps
thebentern 8049d77
Update meshtastic/device-ui digest to 34e96d2 (#10537)
renovate[bot] 0abd202
Upgrade trunk (#10533)
github-actions[bot] 7a3b439
Update libpax digest to 1730234 (#10507)
renovate[bot] f6c9b9a
Preserve forwarded position payload precision (#10554)
h3lix1 8e4ea08
Fix SHT2x detection for INA219 addresses (#10482)
balya cb867cc
Add Lilygo T-Impulse-Plus (#10497)
vidplace7 b6caf1e
Update meshtastic-esp8266-oled-ssd1306 digest to 2e26010 (#10562)
renovate[bot] da1ec94
Update platformio/ststm32 to v19.6.0 (#10329)
renovate[bot] ec80eb7
Update actions/stale action to v10.3.0 (#10532)
renovate[bot] 4d799cf
Noise floor (#9347)
thebentern c355215
Upgrade trunk (#10575)
github-actions[bot] c8bc76b
Update Adafruit SSD1306 to v2.5.17 (#10581)
renovate[bot] 747fc01
Add Heltec mesh node t1 (#10416)
Quency-D 7ddecd1
Compass improvements/refactoring (#10166)
HarukiToreda 51f56cc
Fix mini-epaper-s3 build: resolve SensorLib `isBitSet` macro conflict…
Copilot fe08803
Upgrade trunk (#10600)
github-actions[bot] 367cb92
Update SparkFun MMC5983MA Magnetometer to v1.1.5 (#10599)
renovate[bot] 9e672db
Actions: Update trunk-io/trunk-action to v1.3.1 (#10607)
vidplace7 cd56674
Upgrade trunk (#10608)
github-actions[bot] 266c143
Debian: Correctly build without signing (for forks) (#10605)
vidplace7 f565364
feat: Add Module configuration for RAK13300 and RAK13302 in Slot 2 (#…
pdxlocations 6cd9a3a
missing module config (#10496)
Littleaton be42d00
Update meshtastic/device-ui digest to 502ba30 (#10629)
renovate[bot] 41a558c
Update Thinknode m7 pins (#10635)
jp-bennett c7f17a8
Enhance RTC handling with unit test support for system time fallback …
thebentern 5c76902
Actions: Update protobufs using the triggering branch (#10612)
vidplace7 7440cd5
Update nanopb download URL in workflow
jp-bennett 104df5f
Update protobufs (#10654)
github-actions[bot] 49c5ad3
Automated version bumps (#10667)
github-actions[bot] 3471c0e
Update alpine Docker tag to v3.24 (#10668)
renovate[bot] 9eff900
Add GitHub Action to post web flasher link comments on successful PR …
thebentern f29f32b
Restrict web flasher link comments to organization members only
thebentern bfc206a
meshtasticd: Add configs for B&Q Station G3 (#10673)
vidplace7 6b3b263
Flasher link fix
thebentern dfae288
fix(workflows): update artifact selection to exclude expired firmware…
thebentern fcff9af
Add placeholder comment for web flasher during PR builds
thebentern 06db0f1
Update actions/github-script action to v9 (#10691)
renovate[bot] 4e7181c
Upgrade trunk (#10621)
github-actions[bot] 88137c6
Upgrade trunk (#10701)
github-actions[bot] c9398cc
Use standard GPS enable pin, for smarter power control on M3 (#10671)
jp-bennett 9972feb
Lora led rx (#10674)
jp-bennett 6e02b9a
Update Sensirion I2C SCD30 to v1.1.1 (#10294)
renovate[bot] a49729e
Additional *RAK* missing values for 6421 / 13300 13302 modules + Zebr…
Littleaton ac25b85
Update meshtastic/device-ui digest to 4ec010c (#10732)
renovate[bot] 40adf3a
Beta fixes (#10728)
jp-bennett ca1304e
Upgrade trunk (#10720)
github-actions[bot] 8ba9d0d
Set the time from GPS every 30 minutes (#10737)
jp-bennett 1003d15
Update OCV_ARRAY values in Thinknode m5 variant.h
jp-bennett 8975181
fix(esp32): skip RTC timer wake on user shutdown; TAP V2 OCV and part…
Ethan-chen1234-zy 804ec0f
Update meshtastic/device-ui digest to 6cadf54 (#10743)
renovate[bot] df3d5bb
Update actions/checkout action to v7 (#10744)
renovate[bot] e08b67a
Upgrade trunk (#10738)
github-actions[bot] 20c9e15
enable Adafruit SHTC3 library on native (#10747)
jp-bennett a9a88e7
Update platform-native digest to 61067ac (#10750)
renovate[bot] 3b20601
Update meshtastic/device-ui digest to 1c45ebc (#10749)
renovate[bot] 4044f4a
tdeck touch driver fix (#10740)
mverch67 560515f
Upgrade trunk (#10760)
github-actions[bot] 22d08b4
Fix build on picomputer
thebentern e4c1374
fix(FSCommon): add nRF52 LittleFS empty-name guard to getFiles() (#10…
Copilot 640002d
Upgrade trunk (#10763)
github-actions[bot] 54e0d8d
fix(phone-api): skip manifest scan for node-info-only config requests…
jeremiah-k e3145f9
Update actions/cache action to v6 (#10771)
renovate[bot] 217ada1
Automated version bumps (#10773)
github-actions[bot] 2482306
Upgrade trunk (#10772)
github-actions[bot] a4b2021
Upgrade trunk (#10788)
github-actions[bot] ae1cf49
Update platformio/nordicnrf52 to v10.12.0 (#10794)
renovate[bot] 2a855af
Upgrade trunk (#10810)
github-actions[bot] 8f4c45b
Reset noise floor on frequency changes (#10752)
RCGV1 d6a5f0a
Upgrade trunk (#10818)
github-actions[bot] 40d89bc
Update platformio/ststm32 to v19.7.0 (#10816)
renovate[bot] fc7f15b
Update LovyanGFX to v1.2.24 (#10783)
renovate[bot] 86fd206
Update pschatzmann_arduino-audio-driver to v0.3.0 (#10770)
renovate[bot] b7e0dc3
fix(nrf52): Restore BLE security state when resuming advertising (#10…
jeremiah-k fba24d1
Upgrade trunk (#10865)
github-actions[bot] a9f9605
Fix spiLock deadlock in MessageStore::clearAllMessages() (#10866)
thebentern 18e143f
Remove undefined trunk linters ascii-dash and too-many-defined (#10869)
thebentern 81a6788
Backport Tracker X1 to Master (#10854)
caveman99 e8b04c7
Upgrade trunk (#10895)
github-actions[bot] 964c9e1
trunk: ignore branding/ dir (#10912)
vidplace7 1599bab
Add Meshnology W10 AIOT Dev Kit (SX1262 via MCP23017 I2C expander) (#…
thebentern 699e3b8
Upgrade trunk (#10938)
github-actions[bot] 8aee281
Remove triage workflows
thebentern 0818476
Added wehooper4 Zebra Hat Duo Radio configs (#10731)
Littleaton 72267d1
Implement SD card backup/restore of preferences; add SD support for C…
termax 4127100
Upgrade trunk (#10974)
github-actions[bot] bfa5c1c
backport(tracker-x1): silence the buzzer during init (#11008)
caveman99 62df860
2.7: Update protobufs and classes (#11023)
vidplace7 3c275de
Upgrade trunk (#11000)
github-actions[bot] 6de6c3d
Upgrade trunk (#11140)
github-actions[bot] 71c555c
fix(trunk): remove undefined ascii-dash and too-many-defined linters
caveman99 74653dd
fix(mesh): update reconfigure methods to return true instead of RADIO…
caveman99 1113e48
2.7: Update protobufs and classes (#11548)
caveman99 6d41e27
feat(variants): add Seeed Wio Tracker L1 Pro 1W (#11541)
caveman99 160f446
Bug fix - check for ambientLightThread non-null before use
rbreesems File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,190 @@ | ||
| name: Post Web Flasher Link Comment | ||
|
|
||
| on: | ||
| workflow_run: | ||
| workflows: [CI] | ||
| types: [completed] | ||
|
|
||
| permissions: | ||
| pull-requests: write | ||
| actions: read | ||
|
|
||
| jobs: | ||
| post-flasher-link: | ||
| if: > | ||
| github.event.workflow_run.event == 'pull_request' && | ||
| github.event.workflow_run.conclusion != 'cancelled' && | ||
| github.repository == 'meshtastic/firmware' | ||
| continue-on-error: true | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| # Per-board manifests carry the firmware's own metadata (activelySupported, | ||
| # displayName, ...) generated from each target's custom_meshtastic_* config. | ||
| - name: Download board manifests | ||
| uses: actions/download-artifact@v8 | ||
| continue-on-error: true | ||
| with: | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
| run-id: ${{ github.event.workflow_run.id }} | ||
| pattern: manifest-* | ||
| path: ./manifests | ||
| merge-multiple: true | ||
|
|
||
| - name: Post or update web flasher link comment | ||
| uses: actions/github-script@v9 | ||
| with: | ||
| script: | | ||
| const marker = '<!-- web-flasher-link -->'; | ||
| const run = context.payload.workflow_run; | ||
| const { owner, repo } = context.repo; | ||
|
|
||
| // Resolve the PR number (run.pull_requests is empty for fork PRs) | ||
| let prNumber = run.pull_requests?.[0]?.number; | ||
| if (!prNumber) { | ||
| const { data: prs } = await github.rest.repos.listPullRequestsAssociatedWithCommit({ | ||
| owner, repo, commit_sha: run.head_sha, | ||
| }); | ||
| prNumber = (prs.find((pr) => pr.head.sha === run.head_sha) ?? prs[0])?.number; | ||
| } | ||
| if (!prNumber) { | ||
| core.info('No pull request associated with this run; skipping.'); | ||
| return; | ||
| } | ||
|
|
||
| const { data: pr } = await github.rest.pulls.get({ owner, repo, pull_number: prNumber }); | ||
|
|
||
| // Only comment on PRs authored by members of the organization. | ||
| // author_association MEMBER is computed by GitHub and reflects org | ||
| // membership (including concealed members); OWNER covers a repo owner. | ||
| const allowedAssociations = ['OWNER', 'MEMBER']; | ||
| if (!allowedAssociations.includes(pr.author_association)) { | ||
| core.info(`Author association ${pr.author_association} is not an org member; skipping.`); | ||
| return; | ||
| } | ||
| if (pr.state !== 'open') { | ||
| core.info('Pull request is not open; skipping.'); | ||
| return; | ||
| } | ||
| if (pr.head.sha !== run.head_sha) { | ||
| core.info('Run is for an outdated commit; skipping.'); | ||
| return; | ||
| } | ||
|
|
||
| // Require at least one per-arch firmware artifact from gather-artifacts | ||
| const artifacts = await github.paginate(github.rest.actions.listWorkflowRunArtifacts, { | ||
| owner, repo, run_id: run.id, per_page: 100, | ||
| }); | ||
| const archRe = /^firmware-(esp32|esp32s3|esp32c3|esp32c6|nrf52840|rp2040|rp2350|stm32)-(\d+\.\d+\.\d+\.[0-9a-f]+)$/; | ||
| const archArtifacts = artifacts.filter((a) => archRe.test(a.name) && !a.expired); | ||
| if (archArtifacts.length === 0) { | ||
| core.info('No per-arch firmware artifacts found; skipping.'); | ||
| return; | ||
| } | ||
|
|
||
| const version = archRe.exec(archArtifacts[0].name)[2]; | ||
| const expiresAt = archArtifacts[0].expires_at | ||
| ? new Date(archArtifacts[0].expires_at).toISOString().slice(0, 10) | ||
| : null; | ||
|
|
||
| // Read each built board's manifest (.mt.json). activelySupported, | ||
| // displayName and architecture come straight from the board's | ||
| // custom_meshtastic_* platformio config, so the list is in sync with | ||
| // the firmware itself — no external device database needed. | ||
| const fs = require('fs'); | ||
| let boards = []; | ||
| try { | ||
| boards = fs.readdirSync('./manifests') | ||
| .filter((f) => f.endsWith('.mt.json')) | ||
| .map((f) => { | ||
| try { return JSON.parse(fs.readFileSync(`./manifests/${f}`, 'utf8')); } | ||
| catch { return null; } | ||
| }) | ||
| .filter((m) => m && m.activelySupported === true && m.platformioTarget) | ||
| .map((m) => ({ | ||
| board: m.platformioTarget, | ||
| platform: m.architecture || '', | ||
| // displayName is maintainer-authored text; escape table-breaking pipes | ||
| displayName: String(m.displayName || m.platformioTarget).replace(/\|/g, '\\|'), | ||
| image: Array.isArray(m.images) && m.images[0] ? String(m.images[0]) : '', | ||
| })) | ||
| .sort((a, b) => a.board.localeCompare(b.board)); | ||
| } catch (e) { | ||
| core.warning(`Could not read board manifests: ${e.message}`); | ||
| } | ||
|
|
||
| const flasherUrl = `https://flasher.meshtastic.org/?pr=${prNumber}`; | ||
| // Device illustrations are served by the flasher from the same image | ||
| // names the manifest declares (custom_meshtastic_images). The flasher | ||
| // serves its SPA shell (HTML, 200) for unknown paths, so confirm each | ||
| // image really resolves to an image before linking it. | ||
| const imageBase = 'https://flasher.meshtastic.org/img/devices/'; | ||
| await Promise.all(boards.map(async (b) => { | ||
| if (!b.image) return; | ||
| try { | ||
| const res = await fetch(`${imageBase}${encodeURIComponent(b.image)}`); | ||
| const type = res.headers.get('content-type') || ''; | ||
| if (!res.ok || !type.startsWith('image/')) b.image = ''; | ||
| } catch { b.image = ''; } | ||
| })); | ||
|
|
||
| const boardLines = boards | ||
| .map((b) => { | ||
| const img = b.image ? `<img src="${imageBase}${encodeURIComponent(b.image)}" alt="" height="34">` : ''; | ||
| return `| ${img} | ${b.displayName} | [\`${b.board}\`](${flasherUrl}&device=${encodeURIComponent(b.board)}) | ${b.platform} |`; | ||
| }) | ||
| .join('\n'); | ||
|
|
||
| // Shields.io badges. Only non-user-controlled, charset-constrained values | ||
| // (version, commit sha, counts, dates) go into badge URLs — never board | ||
| // names or the PR title — so the rendered comment cannot be spoofed. | ||
| const shieldText = (s) => | ||
| encodeURIComponent(String(s).replace(/-/g, '--').replace(/_/g, '__').replace(/ /g, '_')); | ||
| const shield = (label, message, color) => | ||
| `https://img.shields.io/badge/${shieldText(label)}-${shieldText(message)}-${color}`; | ||
| const buttonUrl = | ||
| `https://img.shields.io/badge/${shieldText('Flash this PR in the Web Flasher')}-2C2D3C?style=for-the-badge`; | ||
| const badges = [ | ||
| `})`, | ||
| `, '2C2D3C')})`, | ||
| `})`, | ||
| ]; | ||
| if (expiresAt) badges.push(`})`); | ||
|
|
||
| // Only render the board table when there are supported boards to list | ||
| const boardTable = boards.length > 0 ? [ | ||
| `<details><summary>Supported boards built by this PR (${boards.length})</summary>`, | ||
| '', | ||
| '| | Device | Board | Platform |', | ||
| '| --- | --- | --- | --- |', | ||
| boardLines, | ||
| '', | ||
| '</details>', | ||
| '', | ||
| ] : []; | ||
|
|
||
| const body = [ | ||
| marker, | ||
| '## ⚡ Try this PR in the Web Flasher', | ||
| '', | ||
| `[](${flasherUrl})`, | ||
| '', | ||
| badges.join(' '), | ||
| '', | ||
| '> [!WARNING]', | ||
| '> This is an automated, unreviewed CI test build. Back up your device configuration', | ||
| '> before flashing, and only flash devices you are able to recover.', | ||
| '', | ||
| ...boardTable, | ||
| `*Build artifacts expire${expiresAt ? ` on ${expiresAt}` : ' after 30 days'}. Updated for \`${run.head_sha.slice(0, 7)}\`.*`, | ||
| ].join('\n'); | ||
|
|
||
| // Sticky comment: update in place when the marker is found | ||
| const comments = await github.paginate(github.rest.issues.listComments, { | ||
| owner, repo, issue_number: prNumber, per_page: 100, | ||
| }); | ||
| const existing = comments.find((c) => c.body?.includes(marker)); | ||
| if (existing) { | ||
| await github.rest.issues.updateComment({ owner, repo, comment_id: existing.id, body }); | ||
| } else { | ||
| await github.rest.issues.createComment({ owner, repo, issue_number: prNumber, body }); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| name: Post Web Flasher Build Placeholder | ||
|
|
||
| # Drops an immediate "build in progress" comment when a PR opens, so the web | ||
| # flasher entry shows up right away. The real CI-driven workflow | ||
| # (flasher-link-comment.yml) later replaces it in place via the shared marker. | ||
| # | ||
| # SECURITY: this uses pull_request_target (write token, runs for fork PRs) but is | ||
| # safe because it never checks out or runs PR code and posts a fully static body | ||
| # — no PR title, branch name, or other untrusted input is used anywhere. | ||
|
|
||
| on: | ||
| pull_request_target: | ||
| types: [opened, reopened] | ||
|
|
||
| permissions: | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| post-placeholder: | ||
| if: github.repository == 'meshtastic/firmware' | ||
| continue-on-error: true | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Post web flasher build-in-progress placeholder | ||
| uses: actions/github-script@v9 | ||
| with: | ||
| script: | | ||
| const marker = '<!-- web-flasher-link -->'; | ||
| const { owner, repo } = context.repo; | ||
| const pr = context.payload.pull_request; | ||
|
|
||
| // Only org members get the flasher comment (matches the real workflow) | ||
| const allowedAssociations = ['OWNER', 'MEMBER']; | ||
| if (!allowedAssociations.includes(pr.author_association)) { | ||
| core.info(`Author association ${pr.author_association} is not an org member; skipping.`); | ||
| return; | ||
| } | ||
|
|
||
| // Only seed a placeholder when no flasher comment exists yet — never | ||
| // overwrite a real (or existing placeholder) comment. | ||
| const comments = await github.paginate(github.rest.issues.listComments, { | ||
| owner, repo, issue_number: pr.number, per_page: 100, | ||
| }); | ||
| if (comments.some((c) => c.body?.includes(marker))) { | ||
| core.info('Flasher comment already exists; nothing to do.'); | ||
| return; | ||
| } | ||
|
|
||
| const body = [ | ||
| marker, | ||
| '## ⚡ Try this PR in the Web Flasher', | ||
| '', | ||
| '> [!NOTE]', | ||
| '> Building this pull request… the flash button, badges and supported-board', | ||
| '> list will appear here automatically once CI finishes.', | ||
| ].join('\n'); | ||
|
|
||
| await github.rest.issues.createComment({ | ||
| owner, repo, issue_number: pr.number, body, | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🌐 Web query:
GitHub Actions workflow_run webhook payload: verify the fields that identify the head repository and head branch for a fork pull request.💡 Result:
In a GitHub Actions workflow_run webhook payload, the fields that identify the head repository and branch for a pull request (including those from forks) are located within the github.event.workflow_run object [1][2]. For a workflow run triggered by a pull request, the payload contains: 1. github.event.workflow_run.head_branch: This field contains the name of the head branch (the source branch of the pull request, often in a forked repository) [1][2]. 2. github.event.workflow_run.head_repository: This field is an object that contains metadata about the repository where the head branch resides [2]. Key fields within this object include the repository name, owner, and URL, which identify the source fork [2]. Important Considerations: - Reliability of pull_requests array: While the workflow_run payload contains a pull_requests array, it is often empty for workflows triggered by pull requests from forked repositories [3][2]. Therefore, relying on the pull_requests array to identify the source of a fork is unreliable [2]. - Consistent data location: To identify the source of the changes (the fork), you should rely on the github.event.workflow_run.head_branch and github.event.workflow_run.head_repository fields, which reliably contain the information even when the pull_requests array is empty [2]. - Data parity: These fields are generally populated because the workflow_run event carries the metadata of the original check suite that triggered the run, capturing the state of the head branch at the time of the event [1].
Citations:
workflow_runevent (triggered frompull_requestevent from a forked repository branch) lack pull_request actions/runner#3444🏁 Script executed:
Repository: meshtastic/firmware
Length of output: 27030
🏁 Script executed:
Repository: meshtastic/firmware
Length of output: 50377
🌐 Web query:
GitHub REST list pull requests associated with a commit multiple pull requests same head SHA ordering open closed pull_requests endpoint💡 Result:
To list pull requests associated with a specific commit in GitHub's REST API, you should use the List pull requests associated with a commit endpoint [1][2]: GET /repos/{owner}/{repo}/commits/{commit_sha}/pulls This endpoint returns an array of pull requests associated with the specified commit [3]. According to official documentation, the behavior is as follows: - If the commit is present in the default branch, it lists the merged pull request that introduced the commit to the repository [1][4]. - If the commit is not present in the default branch, it returns both merged and open pull requests associated with the commit [1][5]. Regarding your specific constraints: - Multiple Pull Requests: The API endpoint returns an array of all associated pull requests [3]. If a commit is associated with multiple pull requests (e.g., due to cherry-picking or being part of different development branches), they will all be included in the response [6][3]. - Ordering: The GitHub REST API documentation does not explicitly define a guaranteed sort order for the pull requests returned by this endpoint [1][2]. You should process the resulting array in your application code if specific ordering (e.g., by created_at) is required. - State (Open/Closed): As noted above, the endpoint returns merged (closed) and open pull requests depending on whether the commit exists in the default branch [1][4]. The response objects contain a state field, which you can use to filter the results programmatically if necessary [1][3]. If you need to query by SHA across all repositories or in a different context, the GitHub Search API is an alternative; you can search for issues (including pull requests) containing a specific commit SHA using the query parameter q={commit_sha} [7].
Citations:
🌐 Web query:
GitHub Actions workflow_run payload head_repository full_name head_branch fork pull request official documentation💡 Result:
The workflow_run event in GitHub Actions is triggered when a workflow run is requested or completed [1][2]. Information about the triggering workflow run is available in the GitHub Actions context under github.event.workflow_run [3][4]. Key payload properties include: - head_branch: The name of the branch that the triggering workflow ran on [3][5]. - head_repository: An object containing details about the repository where the workflow was triggered, including its full_name [3]. - head_sha: The commit SHA that triggered the workflow [3]. - pull_requests: An array of pull request objects associated with the workflow run [3]. Important Considerations: - Forked Repository Limitations: When a workflow is triggered by an event in a forked repository (e.g., a pull_request from a fork), security restrictions often cause the pull_requests array to be empty and may result in null values for fields like head_branch [6][7][8]. - Retrieving Missing PR Information: If the pull_requests array is empty, you cannot rely on it to identify the associated pull request [7][8]. A common workaround is to use the github.event.workflow_run.head_sha to query the GitHub REST API (e.g., via actions/github-script) to find open pull requests that share that specific commit SHA [8]. Alternatively, community actions such as thedawiddias/workflow-origin-action or 8BitJonny/gh-get-current-pr are often used to simplify this lookup process [9][10]. Official documentation for the specific schema of the workflow_run event payload is maintained within the broader context of webhook event payloads [6][2]. While some fields like head_branch and pull_requests are documented as being present in the workflow_run object, their availability can depend on the security context of the triggering event [6][5][8].
Citations:
workflow_runevent (triggered frompull_requestevent from a forked repository branch) lack pull_request actions/runner#3444🏁 Script executed:
Repository: meshtastic/firmware
Length of output: 2763
🏁 Script executed:
Repository: meshtastic/firmware
Length of output: 2502
🏁 Script executed:
Repository: meshtastic/firmware
Length of output: 751
Bind the fallback lookup to the triggering pull request.
Line 47 selects the first associated pull request by commit SHA. Multiple pull requests can share a head SHA. Match
run.head_repositoryandrun.head_branch, and skip the update when the match is missing or ambiguous.🤖 Prompt for AI Agents