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

Automated Branch Protection Detection #43

Closed
paulmowat opened this issue Jan 17, 2022 · 4 comments
Closed

Automated Branch Protection Detection #43

paulmowat opened this issue Jan 17, 2022 · 4 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@paulmowat
Copy link

paulmowat commented Jan 17, 2022

Hi,

Just started using this and wanted to use this along with branch protection.

I noticed a recent change to automate detection of this and to raise a PR instead of doing it automatically.

It is possible to have branch protection and set up appropriate personal access tokens that you could pass instead of the GITHUB_TOKEN to allow it to work.

I have this working on v2.3 with a branch setup with branch protection and the is_protected option set to false (to avoid PR creation) and it updates fine.

jobs:
  contrib-readme-job:
    runs-on: ubuntu-latest
    name: A job to automate contrib in readme
    steps:
      - name: Contribute List
        uses: akhilmhdh/contributors-readme-action@v2.3
        env:
            GITHUB_TOKEN: ${{ secrets.BUILD_SVC_PAT }}
        with:
          is_protected: false
          commit_message: contrib-readme-action has updated readme [skip ci]

It would be good to still have ability to set is_protected to override the automated logic for above scenario.

Thanks

Paul

@akhilmhdh
Copy link
Owner

akhilmhdh commented Jan 17, 2022

Hey @paulmowat ,

First of all thank you for using my github action.

So your usecase If I am right is, directly committing by changing with personal token. I think I did suggest it in my readme regarding this. So a way to disable protection detection

So how about an option like detect_protection a boolean variable

@akhilmhdh akhilmhdh self-assigned this Jan 17, 2022
@akhilmhdh akhilmhdh added enhancement New feature or request good first issue Good for newcomers labels Jan 17, 2022
@paulmowat
Copy link
Author

paulmowat commented Jan 17, 2022

Yes, that's it. I set up branch protection to allow a specific build user to commit and create a personal token for that user.

A option to turn off the protection to avoid it creating the PR would do the job.

Could do detect_protection a boolean variable that is set to true by default so works as it currently does, but gives the option to override it as needed.

Happy to do a PR for the change if your ok with that some point this week 😄

@akhilmhdh
Copy link
Owner

Oh sure. You can raise any concerns regarding this here. I am happy to help anytime.

Just adding a walkthrough here.

  1. In action.yml add the variable with default value true
  2. In index.js get the input variable with getBooleanInput to get it as boolean instead of string
  3. Override isProtection if check in index.js using the input with a logical operation

@akhilmhdh
Copy link
Owner

Hey @paulmowat first of all apologizing early.

Now the reason, I ended up implementing this while releasing for another patch.
Checkout contributors-readme-actionv2.3.4

I thought you may have got busy with work, so thought let me solve it on the fly. If I made you efforts in vain, so sorry

Closing this issue as this will resolve it. If not or if you have any trouble feel free to open the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants