Opened 7 months ago
Closed 5 months ago
#62416 closed enhancement (fixed)
Switch to using local references for reusable workflows
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.8 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Build/Test Tools | Keywords: | has-patch |
Focuses: | Cc: |
Description
Reusable workflows used within GitHub Actions are currently referenced using their remote syntax, eg:
uses: WordPress/wordpress-develop/{workflow}.yml@trunk
As these workflows are actually local files, their references can be updated to local ones:
uses: ./{workflow}.yml
The benefit of this is that when PRs are made to make changes to a reusable workflow, the references doesn't need to be updated to point to the fork in order for the changed workflow to run.
@desrosj flagged there might be a security concern with such a change. I don't believe there is, but it's worth double checking.
Change History (9)
This ticket was mentioned in PR #7796 on WordPress/wordpress-develop by @johnbillion.
7 months ago
#1
- Keywords has-patch added
@johnbillion commented on PR #7796:
7 months ago
#2
7 months ago
#3
Ah, yes. This is absolutely a feature. We only need to update the workflow file once this way. See https://core.trac.wordpress.org/ticket/61213. Otherwise, we need to periodically backport fixes to all supported branches, and this is a large undertaking.
7 months ago
#4
One way around this could be that after branching a release, we update all workflows to use the @trunk
syntax instead. That allows trunk
to use the local references for easier testing, but ensures the same benefits for older branches.
@johnbillion commented on PR #7796:
7 months ago
#5
That sounds reasonable. Would need to be added to the post release checklist.
@johnbillion commented on PR #7796:
5 months ago
#6
@desrosj I've added a command which converts all the local workflow references to remote ones. It can be run after trunk branches to the release branch to update all the references. What do you think?
npm run grunt replace:workflow-references-local-to-remote
5 months ago
#7
@desrosj I've added a command which converts all the local workflow references to remote ones. It can be run after trunk branches to the release branch to update all the references. What do you think?
npm run grunt replace:workflow-references-local-to-remote
Good idea! Hadn't thought of that. I like it.
Would it be worth adding a step to each workflow that confirms the correct reference format based on the branch initiating the workflow run?
@johnbillion commented on PR #7796:
5 months ago
#8
Would it be worth adding a step to each workflow that confirms the correct reference format based on the branch initiating the workflow run?
Maybe! I think there's a few options for enforcing the remote reference in the release branches. Let's get this in and then it can be discussed in another ticket or PR.
@desrosj Another consideration. The current syntax means that workflows in older branches will always use the latest reusable workflow from the trunk branch. For example, the 6.4 branch uses the current workflow from trunk, not the workflow as it was at 6.4.
Is this a feature or a bug?