Skip to content

Conversation

chmouel
Copy link
Member

@chmouel chmouel commented Oct 10, 2025

The permission check script in the E2E workflow was updated. It now verifies if the pull request author is a public member of the openshift-pipelines organization.

This check is performed in addition to the existing checks for trusted bots and collaborators with repository write access. This allows organization members to run E2E tests on their pull requests without requiring direct write permissions on the repository.

Additionally, renovate[bot] was added to the list of trusted bots.

📝 Description of the Change

👨🏻‍ Linked Jira

🔗 Linked GitHub Issue

Fixes #

🚀 Type of Change

  • 🐛 Bug fix (fix:)
  • ✨ New feature (feat:)
  • 💥 Breaking change (feat!:, fix!:)
  • 📚 Documentation update (docs:)
  • ⚙️ Chore (chore:)
  • 💅 Refactor (refactor:)
  • 🔧 Enhancement (enhance:)
  • 📦 Dependency update (deps:)

🧪 Testing Strategy

  • Unit tests
  • Integration tests
  • End-to-end tests
  • Manual testing
  • Not Applicable

🤖 AI Assistance

  • I have not used any AI assistance for this PR.
  • I have used AI assistance for this PR.

If you have used AI assistance, please provide the following details:

Which LLM was used?

  • GitHub Copilot
  • ChatGPT (OpenAI)
  • Claude (Anthropic)
  • Cursor
  • Gemini (Google)
  • Other: ____________

Extent of AI Assistance:

  • Everything
  • Documentation and research only
  • Unit tests or E2E tests only
  • Code generation (parts of the code)
  • Full code generation (most of the PR)
  • PR description and comments
  • Commit message(s)

Important

If the majority of the code in this PR was generated by an AI, please add a Co-authored-by trailer to your commit message.
For example:

Co-authored-by: Gemini [email protected]
Co-authored-by: ChatGPT [email protected]
Co-authored-by: Claude [email protected]
Co-authored-by: Cursor [email protected]
Co-authored-by: Copilot [email protected]

**💡You can use the script ./hack/add-llm-coauthor.sh to automatically add
these co-author trailers to your commits.

✅ Submitter Checklist

  • 📝 My commit messages are clear, informative, and follow the project's How to write a git commit message guide. The Gitlint linter ensures in CI it's properly validated
  • ✨ I have ensured my commit message prefix (e.g., fix:, feat:) matches the "Type of Change" I selected above.
  • ♽ I have run make test and make lint locally to check for and fix any
    issues. For an efficient workflow, I have considered installing
    pre-commit and running pre-commit install to
    automate these checks.
  • 📖 I have added or updated documentation for any user-facing changes.
  • 🧪 I have added sufficient unit tests for my code changes.
  • 🎁 I have added end-to-end tests where feasible. See README for more details.
  • 🔎 I have addressed any CI test flakiness or provided a clear reason to bypass it.
  • If adding a provider feature, I have filled in the following and updated the provider documentation:
    • GitHub App
    • GitHub Webhook
    • Gitea/Forgejo
    • GitLab
    • Bitbucket Cloud
    • Bitbucket Data Center

Closes #2286

@Copilot Copilot AI review requested due to automatic review settings October 10, 2025 18:27
Copy link

Note

Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported.

@pipelines-as-code pipelines-as-code bot added ci enhancement New feature or request testing labels Oct 10, 2025
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances the E2E workflow permission checking system to allow public members of the openshift-pipelines organization to trigger E2E tests. The changes implement a multi-condition permission check that evaluates trusted bots, organization membership, and repository collaborator permissions in sequence.

  • Restructured permission checking into three sequential conditions for better organization
  • Added public organization membership check for openshift-pipelines organization
  • Included renovate[bot] in the list of trusted bots

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@chmouel
Copy link
Member Author

chmouel commented Oct 10, 2025

/issue-create

Copy link

✅ GitHub Issue Created

AI-generated issue has been created and linked to this PR

📋 Created Issue

#2286 - Enhancement: Allow organization members to trigger E2E tests on their PRs

🔗 Relationship

This pull request resolves the issue described above. The issue was automatically generated based on the PR content to represent the underlying problem being solved.

📝 Issue Content Preview

Click to view the generated issue content

Problem Description

Currently, only repository collaborators with write access can trigger E2E tests on pull requests. This limitation prevents members of the openshift-pipelines organization from being able to easily test their changes via E2E workflows on their own pull requests, even if they are members of the organization.

Current Behavior

E2E tests can only be initiated by a limited set of users, specifically those with repository write permissions or trusted bots. Organization members who do not have direct write access to the repository are unable to trigger these crucial tests on their pull requests.

Expected Behavior

We should enable members of the openshift-pipelines organization to trigger E2E tests on their pull requests. This would allow for broader participation in testing and validation of contributions without requiring direct write access to the repository. Additionally, it would be beneficial to ensure that automated bots like renovate[bot] are recognized and trusted to trigger workflows.

Additional Context

This change aims to streamline the contribution and testing process for organization members, fostering a more collaborative environment and ensuring that changes are adequately tested before merging. It specifically addresses the scenario where organization members want to validate their work through E2E testing without needing explicit repository write permissions.


🤖 Issue created automatically using /issue-create command

// Condition 2: Check for public membership in the target organization.
core.info(`User @${actor} is not a trusted bot. Checking for membership in '${targetOrg}'...`);
try {
await github.rest.orgs.checkMembershipForUser({
Copy link
Contributor

Choose a reason for hiding this comment

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

this checks for public and private both membership if you only wanna check public membership then three is another function for that checkPublicMembershipForUser.
Note: see this docs and search for function name "checkPublicMembershipForUser"

Copy link
Contributor

@zakisk zakisk Oct 13, 2025

Choose a reason for hiding this comment

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

or you can use getMembershipForUserInOrg func to check permission of a user in a team for an org

github.rest.teams.getMembershipForUserInOrg({
  org,
  team_slug,
  username,
});

@zakisk
Copy link
Contributor

zakisk commented Oct 14, 2025

I think we should finalize this first as it is happening for Abhishek as well
https://github.com/openshift-pipelines/pipelines-as-code/actions/runs/18494697705/job/52696111842?pr=2291

Refactored the GitHub script used in the E2E workflow for checking pull
request submitter permissions. The logic was expanded to check for
trusted bots, organization team membership, organization membership, and
finally repository collaborator permissions, allowing for a more robust
set of conditions to permit workflow execution. Additionally, removed
legacy steps related to logging test failures and Slack reporting that
are now handled elsewhere or implicitly by the job status. The step was
also simplified to rely on the standard test runner output.

Co-authored-by: Claude <[email protected]>
Signed-off-by: Chmouel Boudjnah <[email protected]>
@chmouel chmouel force-pushed the fix-github-script-client branch from 6c646e4 to 2f1afa0 Compare October 16, 2025 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci enhancement New feature or request testing

Development

Successfully merging this pull request may close these issues.

Enhancement: Allow organization members to trigger E2E tests on their PRs

2 participants