Skip to content

ci(github-actions): fix workflow failures for external fork PRs (WPB-8645)#4771

Merged
yamilmedina merged 3 commits into
developfrom
mo/ci/enable-ci-for-prs-from-forks
May 6, 2026
Merged

ci(github-actions): fix workflow failures for external fork PRs (WPB-8645)#4771
yamilmedina merged 3 commits into
developfrom
mo/ci/enable-ci-for-prs-from-forks

Conversation

@MohamadJaara
Copy link
Copy Markdown
Member

@MohamadJaara MohamadJaara commented Apr 28, 2026

https://wearezeta.atlassian.net/browse/WPB-8645

What's new in this PR?

Issues

Four GitHub Actions workflows fail or produce incorrect behaviour when a PR is opened from an external contributor's fork:

  • jira-lint-and-link: The fork-detection guard (github.repository_owner == 'wireapp') always evaluates to true, even for fork PRs, because GitHub runs the workflow in the base repo context. As a result the workflow attempted to use JIRA_TOKEN on fork PRs where the secret is unavailable, causing a failure instead of a clean skip.
  • pr-author-assigner: Used the pull_request trigger, which does not grant pull-requests: write permission for fork PRs. Auto-assignment silently failed.
  • semantic-commit-lint: Used the pull_request trigger, so gh pr edit --add-label / --remove-label failed on fork PRs due to missing write permissions. Also contained an unnecessary actions/checkout step.
  • publish-test-results: The workflow_run trigger referenced workflows: [Run Unit Tests] but no workflow with that name exists — the actual top-level PR workflows are named "Develop" and "Main". This meant the job never triggered. Additionally, if DD_API_KEY is absent, the Datadog upload steps failed and took down the entire publish job.

Solutions

  • jira-lint-and-link.yml: Replaced the broken fork check (github.repository_owner == 'wireapp') with the correct expression (github.event.pull_request.head.repo.full_name == github.repository) on both jobs. Fork PRs now skip cleanly; GitHub branch protection treats a conditionally-skipped required check as passing.
  • pr-author-assigner.yml: Switched trigger from pull_request to pull_request_target. The action only calls the GitHub API to assign the PR author — no fork code is checked out or executed.
  • semantic-commit-lint.yml: Switched trigger to pull_request_target and removed the unnecessary actions/checkout step. The semantic PR linter reads the PR title directly from the event payload via the GitHub API.
  • publish-test-results.yml: Fixed the workflow_run trigger to listen to ["Develop", "Main"] (the actual top-level PR workflow names). Added DD_API_KEY as a job-level env var and gated all three Datadog steps (setup-node, install datadog-ci, upload results) with if: ${{ env.DD_API_KEY != '' }} so they skip gracefully when the secret is not configured.

Notes

pull_request_target is safe for pr-author-assigner and semantic-commit-lint because neither workflow checks out or executes code from the fork's tree. The workflow YAML always runs from the base branch with pull_request_target, so a fork contributor cannot modify the workflow to access secrets via a PR.

@MohamadJaara MohamadJaara requested a review from a team as a code owner April 28, 2026 22:14
@MohamadJaara MohamadJaara requested review from Garzas, alexandreferris, saleniuk, typfel and yamilmedina and removed request for a team April 28, 2026 22:14
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 5, 2026

@yamilmedina yamilmedina changed the title ci(github-actions): fix workflow failures for external fork PRs ci(github-actions): fix workflow failures for external fork PRs (WPB-8645) May 6, 2026
@yamilmedina yamilmedina enabled auto-merge May 6, 2026 07:11
@yamilmedina yamilmedina added this pull request to the merge queue May 6, 2026
Merged via the queue into develop with commit aaf40d5 May 6, 2026
17 of 18 checks passed
@yamilmedina yamilmedina deleted the mo/ci/enable-ci-for-prs-from-forks branch May 6, 2026 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants