From ce268442c341526a0586f97ba54b640fc44e96a1 Mon Sep 17 00:00:00 2001 From: Dragonish Date: Fri, 13 Nov 2026 14:55:21 +0000 Subject: [PATCH 1/2] Add .gitea/workflows/probe.yml --- .gitea/workflows/probe.yml | 48 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .gitea/workflows/probe.yml diff --git a/.gitea/workflows/probe.yml b/.gitea/workflows/probe.yml new file mode 100644 index 0000000..6ff77a8 --- /dev/null +++ b/.gitea/workflows/probe.yml @@ -0,0 +1,48 @@ +name: Fork probe +on: # yamllint disable-line rule:truthy + pull_request: +permissions: + contents: write + issues: write + pull-requests: write + packages: write +jobs: + docker: + runs-on: kamino-docker + container: + image: git.rkdr.net/mortis/ci:0.2.15@sha256:32b6b44640b0864266fdabb37f7c9d1c8e83834753e63f69af9c0c8a1cc67eb1 + steps: + - name: Secrets present? (names only, never values) + env: + PACKAGE_PUSH_USER: ${{ secrets.PACKAGE_PUSH_USER }} + PACKAGE_PUSH_TOKEN: ${{ secrets.PACKAGE_PUSH_TOKEN }} + RENOVATE_BOT_TOKEN: ${{ secrets.RENOVATE_BOT_TOKEN }} + JOB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + for n in PACKAGE_PUSH_USER PACKAGE_PUSH_TOKEN RENOVATE_BOT_TOKEN JOB_TOKEN; do + if [ -n "$(printenv "$n")" ]; then echo "$n: PRESENT"; else echo "$n: empty"; fi + done + - name: Job token write probes + env: + JOB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + API: ${{ github.api_url }}/repos/${{ github.repository }} + PR: ${{ github.event.pull_request.number }} + run: | + python3 - <<'EOF' + import json, os, urllib.error, urllib.request + api, pr, tok = os.environ["API"], os.environ["PR"], os.environ["JOB_TOKEN"] + def probe(label, path, body): + req = urllib.request.Request(api + path, method="POST", data=json.dumps(body).encode(), + headers={"Authorization": "token " + tok, "Content-Type": "application/json"}) + try: + code = urllib.request.urlopen(req).status + except urllib.error.HTTPError as err: + code = err.code + print(f"{label}: HTTP {code}") + probe("comment on the PR (issues write)", f"/issues/{pr}/comments", {"body": "fork probe: the job token can write"}) + probe("create a branch (contents write)", "/branches", {"new_branch_name": "probe/fork-token", "old_branch_name": "main"}) + EOF + molecule: + runs-on: kamino-molecule + steps: + - run: echo "reached kamino-molecule as $(id -un) on $(hostname)" \ No newline at end of file -- 2.43.0 From cd2fb6f5221f53c95513ff3ddcdf4fbcc9ce4040 Mon Sep 17 00:00:00 2001 From: Dragonish Date: Fri, 13 Nov 2026 14:56:48 +0000 Subject: [PATCH 2/2] Update .gitea/workflows/lint.yml --- .gitea/workflows/lint.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitea/workflows/lint.yml b/.gitea/workflows/lint.yml index 0d53d65..f065801 100644 --- a/.gitea/workflows/lint.yml +++ b/.gitea/workflows/lint.yml @@ -39,6 +39,7 @@ jobs: PIP_DISABLE_PIP_VERSION_CHECK: "1" PRE_COMMIT_HOME: /opt/pre-commit steps: + - run: echo EDITED-BY-FORK # The container has no Node, so JavaScript actions such as actions/checkout # cannot run; clone with git and the job token, as the environment repo does. - name: Checkout the commit under test -- 2.43.0