fix: inherit permissions instead

The PR caller doesnt allow package write, the builder requested it always. Inherit it from caller instead -> Write on push and no write on PR

Also fix a potential race conditions when fast, consecutive pushes can result in a invalid comment state.
This commit is contained in:
GameTec_live
2026-08-10 21:55:12 +02:00
parent e509bc5311
commit ba353eadbd
2 changed files with 12 additions and 4 deletions
+1 -4
View File
@@ -15,10 +15,7 @@ on:
jobs:
build_fw_builder:
name: Build fw-builder Docker image
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
runs-on: ubuntu-latest # Inherits permissions from caller
outputs:
image_ref: ${{ steps.published-image.outputs.image_ref || steps.local-image.outputs.image_ref }}
steps:
+11
View File
@@ -38,6 +38,17 @@ jobs:
return;
}
const { data: pull } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pullNumber,
});
if (pull.head.sha !== run.head_sha) {
core.notice(`Skipping superseded workflow run ${run.id}`);
return;
}
const marker = '<!-- chameleon-ultra-pr-build-artifacts -->';
const lines = [marker, `# Build result for commit ${run.head_sha}`, ''];