You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
There is an object being set to None but getting attributes pulled from it.
To Reproduce
Steps to reproduce the behavior:
Run with settings file below
Observe error
Expected behavior
Should run
Screenshots
Traceback (most recent call last):
File "repo_manager/main.py", line 255, in
File "repo_manager/main.py", line 50, in main
File "repo_manager/github/branch_protections.py", line 309, in check_repo_branch_protections
File "github/Branch.py", line 103, in get_protection
File "github/Requester.py", line 400, in requestJsonAndCheck
File "github/Requester.py", line 428, in __customConnection
AttributeError: 'NoneType' object has no attribute 'startswith'
[8] Failed to execute script 'main' due to unhandled exception!
Settings:
settings.yml can live in two places:
1. in the repo itself
2. in a centralized repo
The Action is able to apply settings to any repo that its token can manage
You can run Action from each repo, acting on that repo's settings.yml, or
from a central repo, using a single settings.yml to control many repos.
Which method you choose is up to you. See README.md for more info and example
Branch Protection settings. Leave a value out to leave set at current repo settings
protection:
Require at least one approving review on a pull request, before merging. Set to null to disable.
pr_options:
# The number of approvals required. (1-6)
required_approving_review_count: null
# Dismiss approved reviews automatically when a new commit is pushed.
dismiss_stale_reviews: true
# Blocks merge until code owners have reviewed.
require_code_owner_reviews: false
# Specify which users and teams can dismiss pull request reviews. Pass an empty dismissal_restrictions object to disable. User and team dismissal_restrictions are only available for organization-owned repositories. Omit this parameter for personal repositories.
dismissal_restrictions:
users: []
teams: [tsc]
Require status checks to pass before merging. Set to null to disable
required_status_checks:
# Require branches to be up to date before merging.
strict: true
# The list of status checks to require in order to merge into this branch
checks:
- commit_title
- codeowners
Blocks merge until all conversations on a pull request have been resolved
require_conversation_resolution: true
Enforce all configured restrictions for administrators. Set to true to enforce required status checks for repository administrators. Set to null to disable.
enforce_admins: false
Prevent merge commits from being pushed to matching branches
require_linear_history: false
Permit force pushes for all users with push access.
allow_force_pushes: false
Allow users with push access to delete matching branches.
allow_deletions: false
If set to true, the restrictions branch protection settings which limits who can push will also block pushes which create new branches, unless the push is initiated by a user, team, or app which has the ability to push. Set to true to restrict new branch creation.
block_creations: false
Restrict who can push to this branch. Team and user restrictions are only available for organization-owned repositories. Set to null to disable.
restrictions:
# users: []
# teams: []
secrets:
Manage secrets in your repo. Useful to manage secrets from a central repo for non organizations or to manage secrets org wide
- key: SECRET_KEY
# pull the value from an environment variable. If this variable is not found in the env, throw an error and fail the run
# Set env vars on the github action job from secrets in your repo to sync screts across repos
# env: SECRET_VALUE
# Set a dependabot secret on the repo
- key: SECRET_KEY
env: SECRET_VALUE
type: dependabot
- key: ANOTHER_SECRET
# set a value directly in your yaml, probably not a good idea for things that are actually a secret
value: bar
- key: THIRD_SECRET
# pull the value from an environment variable
env: THIRD_VALUE
# setting a value as not required allows you to not pass in an env var. if THIRD_VALUE is not set in the env, this secret won't be set but no error will be thrown
required: false
- key: DELETED_SECRET
# setting exists to false will delete a secret. A delete that results in "not found" won't fail a run, so you can use this to make sure a secret is always deleted
exists: false
Can copy files from your local context to the repo.
Manipulate files in the target repo
* move files around
* delete files
Changes are automatically commited and pushed to a target branch (default is default branch)
File operations are applied sequentially
files:
copy templates/actions/my_workflow.yml to .github/workflows/my_workflow.yml in your target repo
and commit it with the default commit message and to your repo's default branch.
default commit message is "repo_manager file commit"
- src_file: templates/actions/my_workflow.yml
dest_file: .github/workflows/my_workflow.yml
- src_file: templates/issues/issue_template.md
dest_file: .github/ISSUE_TEMPLATE/issue.md
commit_msg: update issue template
# Update this file in the dev branch. If the dev branch doesn't exist, this will fail the workflow
- src_file: templates/dev/dev.md
dest_file: dev.md
target_branch: dev
This moves README.md to README.rst in the remote. If README.md doesn't exist, the workflow will not fail and will emit a warning.
- src_file: remote://README.md
dest_file: README.rst
move: true
commit_msg: "move readme"
This removes OLDDOC.md in the dev branch. If OLDDOC.md doesn't exist, the workflow will emit a warning
- dest_file: OLDDOC.md
exists: false
branch: dev
commit_msg: "remove OLDDOC.md from dev"
The text was updated successfully, but these errors were encountered:
@andrewthetechie - I am unable to replicate this bug on my side... If I run your package, it gives me this error, but if I debug on my local fork I do not get this issue... Not sure what to do here.
@andrewthetechie - Ok, I finally was able to isolate when this occurs... So basically if the users/teams who can dismiss pull requests are populated in the YAML but the branch protection policy does not have that setting set at all, it tries to get the teams/users from the branch protection when the restrict who can dismiss is null, so it's trying to index into it and you can't get children of an empty node.
Describe the bug
There is an object being set to None but getting attributes pulled from it.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Should run
Screenshots
Traceback (most recent call last):
File "repo_manager/main.py", line 255, in
File "repo_manager/main.py", line 50, in main
File "repo_manager/github/branch_protections.py", line 309, in check_repo_branch_protections
File "github/Branch.py", line 103, in get_protection
File "github/Requester.py", line 400, in requestJsonAndCheck
File "github/Requester.py", line 428, in __customConnection
AttributeError: 'NoneType' object has no attribute 'startswith'
[8] Failed to execute script 'main' due to unhandled exception!
Settings:
settings.yml can live in two places:
1. in the repo itself
2. in a centralized repo
The Action is able to apply settings to any repo that its token can manage
You can run Action from each repo, acting on that repo's settings.yml, or
from a central repo, using a single settings.yml to control many repos.
Which method you choose is up to you. See README.md for more info and example
Workflows to implement these strategies.
settings:
See https://docs.github.com/en/rest/reference/repos#update-a-repository for all available settings.
any of these settings can be ommitted to just leave the repo's current setting
If a setting has a value in settings.yml, it will always overwrite what exists in the repo.
A short description of the repository that will show up on GitHub. Set to an empty string to clear.
description: description of repo #omit; repo owner should manage it
A URL with more information about the repository. Set to an empty string to clear.
homepage: https://example.github.io/
A list of strings to apply as topics on the repo. Set to an empty string to clear topics. Omit or set to null to leave what repo already has
topics:
- gha
- foo
- bar
Either
true
to make the repository private, orfalse
to make it public.private: false
Either
true
to enable issues for this repository,false
to disable them.has_issues: true
Either
true
to enable projects for this repository, orfalse
to disable them.If projects are disabled for the organization, passing
true
will cause an API error.has_projects: false
Either
true
to enable the wiki for this repository,false
to disable it.has_wiki: false
Either
true
to enable downloads for this repository,false
to disable them.has_downloads: true
Set the default branch for this repository.
default_branch: main
Either
true
to allow squash-merging pull requests, orfalse
to preventsquash-merging.
allow_squash_merge: true
Either
true
to allow merging pull requests with a merge commit, orfalse
to prevent merging pull requests with merge commits.
allow_merge_commit: false
Either
true
to allow rebase-merging pull requests, orfalse
to preventrebase-merging.
allow_rebase_merge: false
Either
true
to enable automatic deletion of branches on merge, orfalse
to disabledelete_branch_on_merge: true
Either
true
to enable automated security fixes, orfalse
to disableautomated security fixes.
enable_automated_security_fixes: true
Either
true
to enable vulnerability alerts, orfalse
to disablevulnerability alerts.
enable_vulnerability_alerts: true
Labels: define labels for Issues and Pull Requests
labels:
- name: bug
color: CC0000
description: An issue with the system.
- name: feature
# If including a
#
, make sure to wrap it with quotes!color: "#336699"
description: New functionality.
- name: Help Wanted
new_name: first-timers-only
- name: Old Label
# set exists: false to delete a label. A delete that results in a "not found" will not fail a run
exists: false
branch_protections:
branch protection can only be created for branches that exist.
name: main
https://docs.github.com/en/rest/reference/repos#update-branch-protection
Branch Protection settings. Leave a value out to leave set at current repo settings
protection:
Require at least one approving review on a pull request, before merging. Set to null to disable.
pr_options:
# The number of approvals required. (1-6)
required_approving_review_count: null
# Dismiss approved reviews automatically when a new commit is pushed.
dismiss_stale_reviews: true
# Blocks merge until code owners have reviewed.
require_code_owner_reviews: false
# Specify which users and teams can dismiss pull request reviews. Pass an empty dismissal_restrictions object to disable. User and team dismissal_restrictions are only available for organization-owned repositories. Omit this parameter for personal repositories.
dismissal_restrictions:
users: []
teams: [tsc]
Require status checks to pass before merging. Set to null to disable
required_status_checks:
# Require branches to be up to date before merging.
strict: true
# The list of status checks to require in order to merge into this branch
checks:
- commit_title
- codeowners
Blocks merge until all conversations on a pull request have been resolved
require_conversation_resolution: true
Enforce all configured restrictions for administrators. Set to true to enforce required status checks for repository administrators. Set to null to disable.
enforce_admins: false
Prevent merge commits from being pushed to matching branches
require_linear_history: false
Permit force pushes for all users with push access.
allow_force_pushes: false
Allow users with push access to delete matching branches.
allow_deletions: false
If set to true, the restrictions branch protection settings which limits who can push will also block pushes which create new branches, unless the push is initiated by a user, team, or app which has the ability to push. Set to true to restrict new branch creation.
block_creations: false
Restrict who can push to this branch. Team and user restrictions are only available for organization-owned repositories. Set to null to disable.
restrictions:
secrets:
Manage secrets in your repo. Useful to manage secrets from a central repo for non organizations or to manage secrets org wide
- key: SECRET_KEY
- key: SECRET_KEY
env: SECRET_VALUE
type: dependabot
- key: ANOTHER_SECRET
value: bar
- key: THIRD_SECRET
env: THIRD_VALUE
required: false
- key: DELETED_SECRET
exists: false
Can copy files from your local context to the repo.
Manipulate files in the target repo
* move files around
* delete files
Changes are automatically commited and pushed to a target branch (default is default branch)
File operations are applied sequentially
files:
copy templates/actions/my_workflow.yml to .github/workflows/my_workflow.yml in your target repo
and commit it with the default commit message and to your repo's default branch.
default commit message is "repo_manager file commit"
- src_file: templates/actions/my_workflow.yml
dest_file: .github/workflows/my_workflow.yml
- src_file: templates/issues/issue_template.md
dest_file: .github/ISSUE_TEMPLATE/issue.md
commit_msg: update issue template
- src_file: templates/dev/dev.md
dest_file: dev.md
target_branch: dev
This moves README.md to README.rst in the remote. If README.md doesn't exist, the workflow will not fail and will emit a warning.
- src_file: remote://README.md
dest_file: README.rst
move: true
commit_msg: "move readme"
This removes OLDDOC.md in the dev branch. If OLDDOC.md doesn't exist, the workflow will emit a warning
- dest_file: OLDDOC.md
exists: false
branch: dev
commit_msg: "remove OLDDOC.md from dev"
The text was updated successfully, but these errors were encountered: