Skip to content

ci: fall back to github.token in the AI policy workflow - #349

Open
bakiburakogun wants to merge 1 commit into
nextcloud:masterfrom
bakiburakogun:fix/ai-policy-fork-token
Open

ci: fall back to github.token in the AI policy workflow#349
bakiburakogun wants to merge 1 commit into
nextcloud:masterfrom
bakiburakogun:fix/ai-policy-fork-token

Conversation

@bakiburakogun

Copy link
Copy Markdown

Problem

check-ai-trailers fails on every pull request from a fork, whatever the commits contain. The first step never gets as far as inspecting them:

gh: To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN environment variable.
Process completed with exit code 4

Secrets are not exposed to pull_request runs from forks, so secrets.COMMAND_BOT_PAT is empty and gh api exits 4.

Change

Fall back to github.token, which is what the organization template in nextcloud/.github already does:

GH_TOKEN: ${{ secrets.COMMAND_BOT_PAT || github.token }}

nextcloud/spreed already carries the updated version; this copy predates it. The workflow declares the permissions it needs (contents: read, pull-requests: write, issues: write), so the default token can read the commit list.

Noticed because it is the only red check on #343.

Secrets are not exposed to pull requests from forks, so COMMAND_BOT_PAT is
empty there and the first step fails before it checks anything:

    gh: To use GitHub CLI in a GitHub Actions workflow, set the GH_TOKEN
    environment variable.
    Process completed with exit code 4

check-ai-trailers therefore fails on every PR from a fork, regardless of its
commits. The workflow already requests the permissions it needs, so the default
token can read the commit list.

This is what the organization template in nextcloud/.github already does, and
what nextcloud/spreed carries; this copy predates that change.

Signed-off-by: Baki Burak Öğün <63836730+bakiburakogun@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant