File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11name : Create Android Release
22
33on :
4- pull_request :
4+ # Use the trusted base ref so release/production environment policies evaluate
5+ # this post-merge run as master rather than refs/pull/<number>/merge.
6+ pull_request_target :
57 branches : [master]
68 types : [closed]
79 workflow_dispatch :
4749 - name : Fetch stable history and tags
4850 run : git fetch origin master --tags
4951 - name : Require successful protected pull-request checks
50- if : github.event_name == 'pull_request '
52+ if : github.event_name == 'pull_request_target '
5153 env :
5254 GH_TOKEN : ${{ github.token }}
5355 PR_NUMBER : ${{ github.event.pull_request.number }}
Original file line number Diff line number Diff line change @@ -22,11 +22,17 @@ def test_release_pr_is_read_only_and_has_no_protected_secrets(self):
2222
2323 def test_orchestrator_only_accepts_merged_release_candidates (self ):
2424 workflow = self .read ("create-release.yml" )
25- self .assertIn ("pull_request:" , workflow )
25+ self .assertIn ("pull_request_target:" , workflow )
26+ self .assertNotRegex (workflow , r"(?m)^ pull_request:$" )
2627 self .assertIn ("types: [closed]" , workflow )
2728 self .assertIn ("github.event.pull_request.merged == true" , workflow )
2829 self .assertIn ("startsWith(github.event.pull_request.head.ref, 'release/')" , workflow )
2930 self .assertIn ("startsWith(github.event.pull_request.head.ref, 'hotfix/')" , workflow )
31+ self .assertIn ("if: github.event_name == 'pull_request_target'" , workflow )
32+ self .assertIn (
33+ "ref: ${{ github.event.pull_request.merge_commit_sha || inputs.commit_sha }}" ,
34+ workflow ,
35+ )
3036 self .assertIn ("scripts/release_tool.py candidate" , workflow )
3137 self .assertIn ('gh pr checks "$PR_NUMBER" --required' , workflow )
3238 self .assertIn ("--check-play" , workflow )
You can’t perform that action at this time.
0 commit comments