Skip to content

Commit

Permalink
Update workflow to use debug mode by choice, not required. Update act…
Browse files Browse the repository at this point in the history
…ion to include use of dry-run. Change test Yaml to point to special repository for testing
  • Loading branch information
devops committed Feb 13, 2024
1 parent 7f8b273 commit e91699b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ jobs:
org: 'runtimeverification'
repo: ${{ matrix.value }}
token: ${{ secrets.JENKINS_GITHUB_PAT }}
debug: true
6 changes: 5 additions & 1 deletion action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ inputs:
token:
description: 'Access token to be able to write to the repository'
required: true
debug:
description: 'Debug mode'
required: false
default: 'false'
outputs:
merged:
value: ${{ steps.automerge.outputs.merged }}
Expand Down Expand Up @@ -49,5 +53,5 @@ runs:
env:
GITHUB_TOKEN: ${{ inputs.token }}
working-directory: tmp-${{ inputs.repo }}
run: python3 ${{ github.action_path }}/src/automerge.py --org ${{ inputs.org }} --repo ${{ inputs.repo }}
run: python3 ${{ github.action_path }}/src/automerge.py --org ${{ inputs.org }} --repo ${{ inputs.repo }} --dry-run ${{ inputs.debug }}

4 changes: 2 additions & 2 deletions src/automerge.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ def run_git_command(command_args: str) -> subprocess.CompletedProcess:
# - Approved, and
# - Up-to-date.
# If so, merge
if automerge_up_to_date_prs:
while automerge_up_to_date_prs:
pr = automerge_up_to_date_prs[0]
_LOGGER.info(f' Merging PR:\n{pr_to_display_string(pr)}\n')
if args.dry_run:
_LOGGER.info(f'Would have merged PR:\n{pr_to_display_string(pr)}\n')
else:
pr.merge(merge_method='squash')
pr.merge(merge_method='squash', merge_title=f'Auto Mergerge: {pr.number}', merge_message='Title: {pr.title}\nURL: {pr.html_url}\n')
automerge_up_to_date_prs.pop(0)

# 5. Get PRs that are:
Expand Down
2 changes: 1 addition & 1 deletion test/automerge.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[
"devops-actions"
"automerger-test"
]

0 comments on commit e91699b

Please sign in to comment.