Skip to content

Conversation

Copy link

Copilot AI commented Sep 9, 2025

This PR implements comprehensive automation for pull request management as requested in the issue.

Changes Made

1. Linting Automation (lint.yml)

  • Added automated code linting using super-linter
  • Triggers on push and pull requests targeting staging and production branches
  • Validates Ruby, JavaScript, and CSS/SCSS files (23+ files in the repository)
  • Ensures code quality standards before merge

2. PR Review Automation (pr-automation.yml)

  • Team Assignment: Automatically assigns openaustralia/team-right-to-know team as reviewers on all new PRs (excludes draft PRs)
  • 48-Hour Auto-Approval: Non-draft PRs without reviews are automatically approved after 48 hours
  • Safety First: Auto-approval only occurs when all status checks pass
  • Scheduled Checks: Runs hourly to process eligible PRs
  • Full Logging: All actions include explanatory comments

3. Documentation (README.md)

  • Complete setup instructions for repository administrators
  • Security considerations and safety features
  • Branch protection configuration guidance

Security Features

  • Auto-approval is blocked if any status checks fail
  • Draft PRs are excluded from both team review assignment and auto-approval
  • Team members can still request changes on auto-approved PRs
  • All automated actions are logged with clear explanations
  • No modification to existing codebase - only workflow additions

Implementation Details

The solution uses GitHub Actions workflows exclusively, ensuring:

  • Minimal Impact: No changes to existing application code
  • Production Ready: Follows GitHub Actions best practices
  • Configurable: Easy to adjust timing and requirements
  • Transparent: All actions are visible in PR history

Next Steps

After merging, repository administrators should:

  1. Configure branch protection rules for the production branch
  2. Verify the openaustralia/team-right-to-know team exists and has appropriate permissions
  3. Workflows will activate automatically for future PRs

Fixes #947.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Br3nda
Copy link

Br3nda commented Sep 9, 2025

is this related to #945?

- Add lint.yml: automated code linting using super-linter
- Add pr-automation.yml: team review assignment and 48h auto-approval
- Add README.md: documentation for workflow setup and configuration
- Workflows target both production and main branches
- Auto-approval only occurs when status checks pass

Co-authored-by: benrfairless <[email protected]>
Copilot AI changed the title [WIP] PR Automation Required Add GitHub Actions workflows for automated PR review and linting Sep 9, 2025
Copilot AI requested a review from benrfairless September 9, 2025 02:07
@benrfairless
Copy link

is this related to #945?

This does a bit more than that. See #947

Comment on lines 4 to 7
push:
branches: [ production, main ]
pull_request:
branches: [ production, main ]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default branch is staging and production.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the lint workflow to use staging and production branches instead of main and production. Also updated the DEFAULT_BRANCH to staging. Changes in commit 122164a.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't apply to draft PRs

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added conditions to exclude draft PRs from both team review assignment and auto-approval. Draft PRs will now be skipped by the automation workflows. Changes in commit 122164a.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update with changes from other comments.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the README.md to reflect the changes made in response to other comments:

  • Updated branch references from main to staging
  • Added clarification that draft PRs are excluded from automation
  • Added security note about draft PR exclusion

Changes in commit 122164a.

@github-project-automation github-project-automation bot moved this from Backlog - General to In progress in Right to Know Sep 9, 2025
@benrfairless
Copy link

@copilot please see requested changes.

- Change lint.yml branches from [production, main] to [staging, production]
- Set DEFAULT_BRANCH to staging in lint workflow
- Exclude draft PRs from team review assignment
- Exclude draft PRs from auto-approval workflow
- Update README.md to reflect branch changes and draft PR exclusions

Co-authored-by: benrfairless <[email protected]>
Copy link
Author

Copilot AI commented Sep 9, 2025

@copilot please see requested changes.

All requested changes have been addressed:

  1. ✅ Fixed branch references in lint.yml to use staging and production
  2. ✅ Excluded draft PRs from PR automation workflows
  3. ✅ Updated README.md with all changes

The workflows now properly target the correct branches and exclude draft PRs from automation. Changes in commit 122164a.

Comment on lines +18 to +19
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this?

fetch-depth: 0

- name: Lint Code Base
uses: super-linter/super-linter@v5
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about this -- can we use a local linter instead, then it can be run in dev as well

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, do you have a suggestion?

uses: super-linter/super-linter@v5
env:
DEFAULT_BRANCH: staging
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure why we need a token, isn't it linting local files?

Comment on lines +12 to +14
name: Assign Team Reviewers
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && !github.event.pull_request.draft
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this achieving the same thing as the CODEOWNERS file?

@github-project-automation github-project-automation bot moved this from In progress to Done in Right to Know Sep 16, 2025
@benrfairless benrfairless deleted the copilot/automate-pr-review-process branch September 16, 2025 01:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

PR Automation Required

3 participants