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

Prohibited branch incorrect detection #393

Closed
zachbryant opened this issue Jul 13, 2020 · 4 comments · Fixed by #394
Closed

Prohibited branch incorrect detection #393

zachbryant opened this issue Jul 13, 2020 · 4 comments · Fixed by #394
Assignees
Labels
bug Something isn't working resolved

Comments

@zachbryant
Copy link
Contributor

zachbryant commented Jul 13, 2020

Describe the bug

The prohibited branch detection prohibits branches that include the publish branch, but do not equal the publish branch. For example, my branch name is gh-pages-redesign and I want to publish to gh-pages, but this is prohibited.

To Reproduce

Steps to reproduce the behavior:

  1. Create branch gh-pages and gh-pages-redesign
  2. Push changes to gh-pages-redesign
  3. Attempt to deploy to gh-pages
  4. See error

Expected behavior

Deploy as normal, don't error out.

Your YAML file

name: Publish to Github Pages
on:
  push:
    branches:
      - gh-pages-redesign

jobs:
  build-publish:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@master
      - uses: actions/cache@v1
        with:
          path: vendor/bundle
          key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
          restore-keys: |
            ${{ runner.os }}-gems-
      - name: Use Node.js 12.14.1
        uses: actions/setup-node@v1
        with:
          node-version: '12.14.1'
      - name: Install dependencies
        run: |
          npm install
          npm install --only=dev
      - name: 💎 setup ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: 2.7
      - name: 🔨 install dependencies & build site
        uses: limjh16/jekyll-action-ts@v2
        with:
          enable_cache: true
      - name: 🚀 deploy
        uses: peaceiris/actions-gh-pages@v3
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          publish_dir: ./_site
          publish_branch: gh-pages
          keep_files: false

Additional context

image

The problem is in src/set-tokens.ts on line 86:

86    isProhibitedBranch = ref.includes(`refs/heads/${publishBranch}`);

it should check that the branch name is exact with nothing else appended

isProhibitedBranch = ref.match(new RegExp(`refs/heads/${publishBranch}$`));
@zachbryant zachbryant added the bug Something isn't working label Jul 13, 2020
@peaceiris
Copy link
Owner

peaceiris commented Jul 13, 2020

Thanks!
Do you want to work on this on your Pull-Request? (I also can do it)

@zachbryant
Copy link
Contributor Author

I can make a quick PR :)

@peaceiris peaceiris linked a pull request Jul 13, 2020 that will close this issue
@peaceiris
Copy link
Owner

peaceiris commented Jul 14, 2020

The v3.6.3 has been released and the v3 tag has been updated.

@github-actions
Copy link
Contributor

This issue has been LOCKED because of it being resolved!

The issue has been fixed and is therefore considered resolved.
If you still encounter this or it has changed, open a new issue instead of responding to solved ones.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working resolved
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants