Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails using token for forked repo #49

Open
chemelli74 opened this issue Oct 6, 2024 · 4 comments
Open

Fails using token for forked repo #49

chemelli74 opened this issue Oct 6, 2024 · 4 comments

Comments

@chemelli74
Copy link

Recently we are experiencing the issue shown by this run: https://github.com/rokam/midea-local/actions/runs/11203313741/job/31140493729

Can you help identifying the issue ?

CC @rokam (midea-lan/midea-local#314)

@chemelli74
Copy link
Author

Any kind feedback ?

@chemelli74
Copy link
Author

A kind reminder for a feedback

@abannachGrafana
Copy link
Collaborator

abannachGrafana commented Jan 31, 2025

@chemelli74 👋 Sorry for the missed notifications. Looks like you have a successful run at least once using a PAT. We've been successfully using the action with the GITHUB_TOKEN internally, but you do need to elevate the privileges a bit.

here's and example as a full workflow file.

name: Check PR

on:
  pull_request:
    types:
      - opened
      - reopened
      - edited
      - synchronize

jobs:
  pr-title:
    runs-on: ubuntu-x64
    name: Check PR Title
    steps:
      - name: Check PR Title
        uses: agenthunt/conventional-commit-checker-action@9e552d650d0e205553ec7792d447929fc78e012b # v2.0.0
        with:
          pr-title-regex: "^(build|chore|ci|docs|feat|fix|perf|refactor|style|test)(\\(.+\\))?(!)?:\\s.*"
          pr-body-regex: ".*" # We don't really care what the PR body description contains, just the title

  label:
    permissions:
      contents: read
      issues: read
      pull-requests: write
    if: github.actor != 'dependabot[bot]' # dependabot adds it's own labels
    runs-on: ubuntu-x64
    name: Update PR Labels
    needs: ['pr-title'] # Makes sure that the title follows conventional commits
    steps:
      - name: Label PR
        uses: grafana/pr-labeler-action@50737759cb150f5d312de1a45559027156db8bab # v0.1.0
        with:
          token: ${{ secrets.GITHUB_TOKEN }}

You'll notice the label job depends on pr-title which we're using for labeling purposes. Just an extra little check to make sure it doesn't fail to map a label type.

Let me know if that works for you as well. Feel free to tweak or omit the pr-title job. Ultimately I believe the fix will be to add the

permissions:
  contents: read
  issues: read
  pull-requests: write

to your labeling job

@abannachGrafana
Copy link
Collaborator

What this does tell me is that the documentation needs to be updated! 👍

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

No branches or pull requests

2 participants