mirror of
https://github.com/TautvydasDerzinskas/Thingport.git
synced 2026-10-22 06:32:27 -05:00
36 lines
1.3 KiB
YAML
36 lines
1.3 KiB
YAML
name: Issue branding
|
|
|
|
# Issue forms can't put images in the submitted body, so add the logo once the issue exists.
|
|
on:
|
|
issues:
|
|
types: [opened]
|
|
|
|
permissions:
|
|
issues: write
|
|
|
|
jobs:
|
|
logo:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/github-script@v7
|
|
with:
|
|
script: |
|
|
const base = 'https://raw.githubusercontent.com/TautvydasDerzinskas/Thingport/main/frontend/src/assets/logos';
|
|
const light = `${base}/thingport-lockup-compact-color.svg`;
|
|
const dark = `${base}/thingport-lockup-compact-on-dark.svg`;
|
|
const body = context.payload.issue.body ?? '';
|
|
// Issues branded before the theme-aware logo carry the stacked one.
|
|
if (body.includes(light) || body.includes(`${base}/thingport-lockup-stacked-color.svg`)) return;
|
|
// GitHub picks the source matching the viewer's light or dark theme.
|
|
const logo = [
|
|
'<p align="center"><picture>',
|
|
`<source media="(prefers-color-scheme: dark)" srcset="${dark}">`,
|
|
`<img src="${light}" alt="Thingport" width="240">`,
|
|
'</picture></p>',
|
|
].join('');
|
|
await github.rest.issues.update({
|
|
...context.repo,
|
|
issue_number: context.issue.number,
|
|
body: `${logo}\n\n${body}`,
|
|
});
|