Skip to content

bugfix: max number of PRs #82

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

Merged
merged 7 commits into from
Apr 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/test-positive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
github-access-token: ${{ secrets.GITHUB_TOKEN }}
dry-run: 'true'
log-level: 'DEBUG'
max-number-of-prs: '1'

outputs:
affected: "${{ steps.current.outputs.affected }}"
Expand All @@ -44,7 +45,7 @@ jobs:
steps:
- uses: nick-fields/assert-action@v1
with:
expected: "[\"account\"]"
expected: "[\"account-3\"]"
actual: "${{ needs.test.outputs.affected }}"

teardown:
Expand Down
26 changes: 26 additions & 0 deletions components/terraform/account-2/component.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 'account' component vendoring config

# 'component.yaml' in the component folder is processed by the 'atmos' commands
# 'atmos vendor pull -c account' or 'atmos vendor pull --component account'

apiVersion: atmos/v1
kind: ComponentVendorConfig
spec:
source:
# 'uri' supports all protocols (local files, Git, Mercurial, HTTP, HTTPS, Amazon S3, Google GCP),
# and all URL and archive formats as described in https://github.com/hashicorp/go-getter
# In 'uri', Golang templates are supported https://pkg.go.dev/text/template
# If 'version' is provided, {{ .Version }} will be replaced with the 'version' value before pulling the files from 'uri'
uri: github.com/cloudposse/terraform-aws-components.git//modules/account?ref={{ .Version }}
version: 1.107.0
# Only include the files that match the 'included_paths' patterns
# If 'included_paths' is not specified, all files will be matched except those that match the patterns from 'excluded_paths'
# 'included_paths' support POSIX-style Globs for file names/paths (double-star `**` is supported)
# https://en.wikipedia.org/wiki/Glob_(programming)
# https://github.com/bmatcuk/doublestar#patterns
included_paths:
- "**/**"
# Exclude the files that match any of the 'excluded_paths' patterns
# Note that we are excluding 'context.tf' since a newer version of it will be downloaded using 'mixins'
# 'excluded_paths' support POSIX-style Globs for file names/paths (double-star `**` is supported)
excluded_paths: []
7 changes: 7 additions & 0 deletions components/terraform/account-2/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
provider "null" {}

resource "null_resource\" \"hello_world" {
provisioner "local-exec" {
command = "echo Hello, World!"
}
}
26 changes: 26 additions & 0 deletions components/terraform/account-3/component.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# 'account' component vendoring config

# 'component.yaml' in the component folder is processed by the 'atmos' commands
# 'atmos vendor pull -c account' or 'atmos vendor pull --component account'

apiVersion: atmos/v1
kind: ComponentVendorConfig
spec:
source:
# 'uri' supports all protocols (local files, Git, Mercurial, HTTP, HTTPS, Amazon S3, Google GCP),
# and all URL and archive formats as described in https://github.com/hashicorp/go-getter
# In 'uri', Golang templates are supported https://pkg.go.dev/text/template
# If 'version' is provided, {{ .Version }} will be replaced with the 'version' value before pulling the files from 'uri'
uri: github.com/cloudposse/terraform-aws-components.git//modules/account?ref={{ .Version }}
version: 1.107.0
# Only include the files that match the 'included_paths' patterns
# If 'included_paths' is not specified, all files will be matched except those that match the patterns from 'excluded_paths'
# 'included_paths' support POSIX-style Globs for file names/paths (double-star `**` is supported)
# https://en.wikipedia.org/wiki/Glob_(programming)
# https://github.com/bmatcuk/doublestar#patterns
included_paths:
- "**/**"
# Exclude the files that match any of the 'excluded_paths' patterns
# Note that we are excluding 'context.tf' since a newer version of it will be downloaded using 'mixins'
# 'excluded_paths' support POSIX-style Globs for file names/paths (double-star `**` is supported)
excluded_paths: []
7 changes: 7 additions & 0 deletions components/terraform/account-3/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
provider "null" {}

resource "null_resource\" \"hello_world" {
provisioner "local-exec" {
command = "echo Hello, World!"
}
}
2 changes: 1 addition & 1 deletion src/component_updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def __init__(self,
self.__infra_terraform_dirs = infra_terraform_dirs
self.__config = config
self.__tools_manager = tools_manager
self.__num_pr_created = 0
self.__num_pr_created = len(github_provider.get_open_prs_for_component(""))

def update(self) -> List[ComponentUpdaterResponse]:
responses = []
Expand Down
6 changes: 4 additions & 2 deletions src/github_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,10 @@ def get_open_prs_for_component(self, component_name: str):

for pull_request in self.__pull_requests:
pr_branch_name = pull_request.head.ref

if pr_branch_name.startswith(f'{BRANCH_PREFIX}/{component_name}/'):
branch_prefixs = list(filter(None, [ BRANCH_PREFIX, component_name]))
branch_prefix = '/'.join(branch_prefixs) + '/'
# e.g. component-update/component-name/
if pr_branch_name.startswith(branch_prefix):
open_prs.append(pull_request)

return open_prs
Expand Down