Logo : Permissioning Ci Workflows

Permissioning Ci Workflows

Communauté
wdm0006
permissioning-ci-workflows

Donnez à un job CI exactement les identifiants dont il a besoin et vérifiez quand il n’en a aucun : déclarez explicitement `permissions:` car la portée par défaut de GITHUB_TOKEN dépend des paramètres du dépôt ; consultez l’en-tête x-accepted-github-permissions de l’erreur 403 au lieu de deviner la portée manquante ; tenez compte du fait qu’un appel API peut nécessiter deux portées, qu’une pull request provenant d’un fork reçoit un jeton en lecture seule et aucun secret du dépôt, que les étapes conditionnées par un événement peuvent être ignorées lors d’une relance et faire réussir le job sans rien corriger, et que `pull_request_target` n’est pas une solution de contournement. Privilégiez un contrôle qui ne nécessite aucun identifiant. À utiliser lorsqu’une étape du workflow commente une PR, pousse un commit, ouvre une issue, téléverse un rapport, appelle l’API d’un autre dépôt ou échoue avec une erreur 403 alors que toutes les étapes de build et de test réussissent.

Add to TypingMind

Présentation

Éditeurwdm0006
Dépôtpython-skills
Nom de la compétencepermissioning-ci-workflows
Étoiles
111
Forks
17
Fichiers inclus
Instructions uniquement
LicenceMIT
Liens
  • Instructions en Markdown

    Un fichier SKILL.md que le modèle charge à la demande : il ne consomme donc des tokens que lorsqu’une demande correspond réellement à la compétence.

  • Compatible avec tous les LLM

    Les compétences IA sont rédigées en Markdown et non sous forme de code propre à un fournisseur. Elles fonctionnent donc avec GPT, Claude, Gemini, Grok ou un modèle local.

  • Tout dans les instructions

    Tout ce dont le modèle a besoin se trouve dans les instructions : aucun fichier supplémentaire à synchroniser.

  • Open source

    Publiée par wdm0006 sur GitHub. Consultez les sources avant de l’installer.

Installation

Installez la compétence IA Permissioning Ci Workflows dans TypingMind pour l’utiliser avec n’importe quel LLM, ou ajoutez-la à un autre agent capable de lire SKILL.md.

1

Installer dans TypingMind

TypingMind installe une compétence directement depuis son dossier GitHub : l’application lit SKILL.md, regroupe les fichiers de ressources et enregistre le tout localement.

  1. Ouvrez l’application et accédez à Plugins → Compétences.
  2. Choisissez « Installer depuis GitHub ».
  3. Copiez l’URL ci-dessous, qui pointe vers le dossier de la compétence, puis collez-la et confirmez.
    https://github.com/wdm0006/python-skills/tree/main/skills/common/ci-permissions
  4. Activez la compétence dans chaque discussion où vous souhaitez pouvoir l’utiliser.
Plugins → Compétences → Ajouter une compétence → Via une URL GitHub, puis collez l’URL du dossier et appuyez sur Continuer.
2

Installer dans un autre agent

Tout agent capable de lire le format Agent Skills peut utiliser cette compétence : copiez le dossier dans le répertoire des compétences de cet agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/wdm0006/python-skills.git /tmp/python-skills
mkdir -p .claude/skills
cp -r /tmp/python-skills/skills/common/ci-permissions .claude/skills/permissioning-ci-workflows
Redémarrez Claude Code après la copie pour que la nouvelle compétence soit prise en compte.

Utilisez cette compétence dans TypingMind

Activez Permissioning Ci Workflows dans n’importe quelle discussion TypingMind et le modèle s’occupe du reste. Le nom et la description de la compétence figurent dans le prompt système. Dès qu’une demande correspond, le modèle charge lui-même l’intégralité des instructions : vous n’avez jamais à l’invoquer manuellement, et elle ne consomme aucun token tant qu’elle n’est pas utilisée.

Le modèle charge automatiquement Permissioning Ci Workflows dès qu’une demande correspond à cette compétence.

Compatible avec tous les modèles IA

Les compétences IA sont de simples instructions Markdown, et non du code propre à un fournisseur. Ainsi, la compétence Permissioning Ci Workflows n’est pas liée au modèle pour lequel elle a été conçue. Installez-la une seule fois dans TypingMind et utilisez-la avec GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ou un modèle local que vous exécutez vous-même, le tout avec vos propres clés API.

  • Chargée uniquement en cas de besoin

    Le prompt système ne contient que le nom et la description. Les instructions sont récupérées à la première demande correspondante : une compétence inutilisée ne coûte donc rien.

  • Changez de modèle en cours de discussion

    La compétence étant constituée d’instructions et non de code, elle reste fonctionnelle lorsque vous changez de modèle : le nouveau modèle lit le même fichier SKILL.md.

Instructions de la compétence

Voici le contenu de SKILL.md que le modèle charge. Lisez-le avant l’installation : une compétence contient des instructions que votre modèle suivra.

Permissioning CI Workflows

A job that only reads code and runs tests needs no thought about credentials. The moment a step comments on a pull request, pushes a commit, opens an issue, uploads a report, or calls another repository's API, it depends on two things that are invisible in the YAML: which scopes the token carries, and whether the run was allowed to have secrets at all.

Both fail in the same shape — every build, lint, and test step green, one trailing step red — which is why they get re-run instead of fixed.

For the cost side of workflows (triggers, concurrency, caching, matrix), see running-github-actions-efficiently. This skill is about what a workflow is allowed to do.

Declare permissions; never inherit them

The default GITHUB_TOKEN permission set is a repository/organization setting (permissive vs. restricted), not a property of your YAML. Identical workflow files therefore behave differently across repos and across orgs — and a repo that tightens the default later breaks a workflow nobody touched.

Declare a read-only floor at workflow level and grant writes per job:

yaml
permissions:
  contents: read          # floor for every job in this workflow

jobs:
  test:
    runs-on: ubuntu-latest
    # inherits contents: read — nothing else

  comment:
    runs-on: ubuntu-latest
    permissions:          # REPLACES the workflow-level set, does not merge
      contents: read
      issues: write
      pull-requests: write

A permissions: block sets every scope you did not name to none, and a job-level block replaces the workflow-level set rather than merging with it. That is the point at workflow level and the trap at job level: restate every scope the job needs, not only the one you came to add.

One API call can need two scopes

Scopes do not map one-to-one onto endpoints. The clearest case: commenting on a pull request goes through the issues API (POST /repos/{owner}/{repo}/issues/{number}/comments), and because a pull request is an issue and a pull request, the token check requires issues: write and pull-requests: write. With only the first it returns 403 after everything else in the run has already passed.

Do not guess the missing scope from the endpoint's noun. The 403 response names what it will accept:

console
$ gh api -i repos/OWNER/REPO/issues/123/comments -f body=probe
HTTP/2.0 403
x-accepted-github-permissions: issues=write; pull_requests=write

Read that header out of the failing run's log, or reproduce the single call with gh api -i against a scratch resource. It is a one-line answer to a question that otherwise costs a round of guess-and-push.

The failure hides behind the step's own condition

Steps that write to a PR are usually gated on the event that should trigger them:

yaml
- name: Comment on PR
  if: github.event.action == 'opened'
  uses: actions/github-script@v7

Pushing a commit to that PR re-runs the workflow as synchronize. The step is skipped, the job goes green, and the permission was never granted — so the next PR fails identically and the fix looks like it landed.

Any red check whose step is event-conditioned is not verified by pushing a commit. Re-verify it on the event that runs it: a fresh PR, a workflow_dispatch path, or a temporary condition change reverted in the same PR. A green run that skipped the step under test is the same defect as a test that never asserted — see writing-defect-reports on not filing a red gate as an aside.

A fork pull request has a read-only token and no secrets

On pull_request from a fork, GITHUB_TOKEN is read-only regardless of your permissions: block, and repository and organization secrets are not passed into the run. This is not configurable per workflow, and it is correct: a contributor you have never met is proposing code that your runner is about to execute.

The consequence is that every credentialed gate — a cross-repo API read, a registry publish, a report upload, a comment — does nothing on exactly the contributions you control least. Worse, the usual workaround makes it invisible:

yaml
# BAD — on a fork PR this is green and verified nothing.
- name: Validate against the upstream registry
  if: ${{ secrets.REGISTRY_TOKEN != '' }}
  env:
    TOKEN: ${{ secrets.REGISTRY_TOKEN }}
  run: ./scripts/validate.sh

Split the check by what it needs instead of skipping it by what it has:

  • The half that needs no external truth — schema, structure, denylists of known-bad patterns, anything decidable from files in the repo — must run on every PR, standalone, with a read-only token. Land that half first; it is a real gate on day one.
  • The half that needs a credential runs where credentials exist: post-merge on push, on a schedule, or in a workflow_run triggered by the completed PR build.

Then say which is which in the contributing docs, so a fork PR going green is not read as full verification.

pull_request_target is not the workaround

pull_request_target runs in the base repository's context: writable token, full secrets, and the workflow file from the base ref. That is what makes it useful for labeling and greeting — and what makes this catastrophic:

yaml
# BAD — hands a writable token and every secret to whoever opened the PR.
on: pull_request_target
jobs:
  build:
    steps:
      - uses: actions/checkout@v4
        with: { ref: ${{ github.event.pull_request.head.sha }} }
      - run: npm ci && npm test        # executes the contributor's code

Any step that runs head-ref content under pull_request_target — a build, a dependency install with lifecycle scripts, a test, a linter with a repo-local plugin — executes untrusted code with your credentials in the environment. Use pull_request_target only for steps that never execute head content: labels, greetings, size and metadata checks done through the API.

Prefer a check that needs no credential at all

Every credentialed check is one that cannot run on a fork, cannot run offline, and breaks when the token rotates. Before granting a scope, ask whether the check needs the network at all.

  • When the truth lives in another repository, do not have this repo reach in. Have the owning repo publish it outward as a generated, versioned artifact that the consumer commits and validates against — the consumer's check then needs no token, runs on forks, and states which upstream version it was checked against. See shipping-across-surfaces on never hand-maintaining a snapshot of a surface you don't own.
  • Never hand-maintain the allowlist instead. Copying another system's valid values into a constant in this repo removes the token and keeps the coupling, with nothing to detect drift.
  • Coverage and quality reports that exist only behind a third-party upload token vanish on fork PRs and during that service's outages. Run the tool in the job and print the report into the log (--cov-report=term-missing or the equivalent), so the number is in the run everyone can already read.

Checklist

Scopes:
- [ ] Every workflow declares permissions explicitly; none rely on the repo default
- [ ] Workflow-level floor is read-only; writes granted per job
- [ ] Job-level permissions blocks restate contents: read (they replace, not merge)
- [ ] Missing scope taken from the 403's x-accepted-github-permissions, not guessed
- [ ] PR-comment steps carry issues: write AND pull-requests: write

Forks:
- [ ] Known which gates do nothing on a fork PR (read-only token, no secrets)
- [ ] Credential-free half of each gate runs standalone on every PR
- [ ] No step silently skipped on an empty secret and reported as passing
- [ ] pull_request_target used only for steps that never run head-ref content

Verification:
- [ ] Event-conditioned steps re-verified on the event that runs them, not by a push
- [ ] Green run confirmed to have actually executed the step, not skipped it
- [ ] Checks that could be decided from repo contents don't take a token

Foire aux questions

À quoi sert la compétence IA Permissioning Ci Workflows ?

Donnez à un job CI exactement les identifiants dont il a besoin et vérifiez quand il n’en a aucun : déclarez explicitement `permissions:` car la portée par défaut de GITHUB_TOKEN dépend des paramètres du dépôt ; consultez l’en-tête x-accepted-github-permissions de l’erreur 403 au lieu de deviner la portée manquante ; tenez compte du fait qu’un appel API peut nécessiter deux portées, qu’une pull request provenant d’un fork reçoit un jeton en lecture seule et aucun secret du dépôt, que les étapes conditionnées par un événement peuvent être ignorées lors d’une relance et faire réussir le job s...

Pourquoi utiliser Permissioning Ci Workflows sur TypingMind ?

Parce que vous l’installez une seule fois pour l’utiliser avec n’importe quel modèle. Permissioning Ci Workflows se compose de simples instructions en Markdown plutôt que de code propre à un fournisseur. La même compétence fonctionne donc avec GPT-5, Claude, Gemini, Grok ou un modèle local, et vous pouvez changer de modèle en cours de discussion sans perturber son fonctionnement. TypingMind utilise vos propres clés API : vous payez donc directement les fournisseurs plutôt qu’un abonnement par siège, et vos compétences et discussions restent dans votre propre espace de stockage.

Comment installer Permissioning Ci Workflows dans TypingMind ?

Dans TypingMind, ouvrez Plugins → Compétences → Installer depuis GitHub et collez https://github.com/wdm0006/python-skills/tree/main/skills/common/ci-permissions. TypingMind lit le fichier SKILL.md et l’installe sous forme de compétence que vous pouvez activer pour chaque discussion.

Quels modèles d’IA peuvent utiliser Permissioning Ci Workflows ?

N’importe quel modèle que vous connectez dans TypingMind. Les compétences IA sont de simples instructions en Markdown, et non du code propre à un fournisseur. GPT, Claude, Gemini, Grok et les modèles locaux peuvent donc tous charger cette compétence lorsqu’une demande lui correspond.

Combien de modèles d’IA puis-je utiliser avec Permissioning Ci Workflows ?

Autant que vous le souhaitez. Vous pouvez utiliser Permissioning Ci Workflows avec tout modèle qui prend en charge les compétences : GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama et bien d’autres, le tout dans TypingMind avec vos propres clés API.

La compétence IA Permissioning Ci Workflows est-elle gratuite ?

Oui. Cette compétence est publiée sur GitHub par wdm0006 sous licence MIT. Vous ne payez que votre propre fournisseur d’IA pour les tokens utilisés.

Que sont les compétences IA ?

Une compétence IA est un ensemble d’instructions réutilisables qui apprend à un modèle d’IA à accomplir une tâche précise. Elle suit le format ouvert Agent Skills : un fichier SKILL.md contenant un nom et une description, ainsi que les éventuels scripts, gabarits ou fichiers de référence dont le modèle peut avoir besoin. Le modèle ne lit les instructions que lorsque votre demande correspond à la compétence. Une compétence installée ne coûte donc rien tant qu’elle n’est pas utilisée.

En quoi les compétences IA diffèrent-elles des plugins ou des serveurs MCP ?

Un plugin ou un serveur MCP fournit au modèle de nouveaux outils à appeler : du code qui s’exécute quelque part et renvoie un résultat. Une compétence IA lui apporte plutôt des connaissances et une méthode : comment aborder une tâche, quelles étapes suivre et à quoi ressemble un bon résultat. Les compétences sont de simples instructions en Markdown. Elles ne nécessitent donc ni serveur, ni clé API, ni environnement d’exécution, et fonctionnent avec n’importe quel modèle.

Tout voir

Créez votre propre espace de travail IA dès maintenant

Abonnez-vous à notre newsletter pour être informé des nouvelles fonctionnalités et des prochains cadeaux à gagner 👇