-
| Why are you starting this discussion?Question What GitHub Actions topic or product is this about?Actions Runner Discussion DetailsI'm trying to trigger an error when branch names include Spanish characters with tilde. This is what I use: However, it does not seem to like that syntax, or the other equivalent like áéí. I've copied that syntax directly from the denomination of the branch once it's pushed to GitHub, maybe there's something wrong? In general,if I want to include non-ASCII character in a branch pattern, what should I do? | 
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
| Instead of filtering at the workflow trigger level, you can let the workflow run and then check the branch name: name: Fail when incorrect branch names are used
on: push
jobs:
  check-branch-name:
    runs-on: ubuntu-latest
    steps:
      - name: Check for Spanish characters
        run: |
          BRANCH_NAME="${GITHUB_REF#refs/heads/}"
          if echo "$BRANCH_NAME" | grep -qP '[áéíóúÁÉÍÓÚñÑ]'; then
            echo "Error: Branch name contains Spanish characters: $BRANCH_NAME"
            exit 1
          fiHope it helps! | 
Beta Was this translation helpful? Give feedback.
-
| Workaround idea: name: Fail when incorrect branch names are used
on:
  push:
    branches:
      - '**'  # allow all branches for now
jobs:
  check-branch:
    runs-on: ubuntu-latest
    steps:
      - name: Validate branch name
        run: |
          branch_name="${GITHUB_REF##*/}"
          echo "Branch name: $branch_name"
          if echo "$branch_name" | grep -q '[áéíóú]'; then
            echo " Invalid branch name: contains accented characters"
            exit 1
          else
            echo " Branch name is fine"
          fi
 | 
Beta Was this translation helpful? Give feedback.
-
| There is apparently no way to insert Unicode characters into character classes in branch/tag patterns. However, you can use them directly. It's up to to you decide if that's cleaner than using character classes in regular expression within the action itself, which would be triggered for every branch, as the answers above. | 
Beta Was this translation helpful? Give feedback.
There is apparently no way to insert Unicode characters into character classes in branch/tag patterns. However, you can use them directly.
It's up to to you decide if that's cleaner than using character classes in regular expression within the action itself, which would be triggered for every branch, as the answers above.