Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add auto-plugin build in Premium repo #2380

Closed
bfintal opened this issue Aug 12, 2022 · 1 comment
Closed

Add auto-plugin build in Premium repo #2380

bfintal opened this issue Aug 12, 2022 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@bfintal
Copy link
Contributor

bfintal commented Aug 12, 2022

We've added https://github.com/gambitph/Stackable/blob/develop/.github/workflows/plugin-build.yml that builds the plugin per pull request.

We need to do the same with the Premium repo. We have some build code already present in the premium workflow, but the develop branch is always checked out for the free repo. This works in most cases, but if we have a more complex PR that spans both the free and premium repos, the plugin will not be built correctly.

Unhandled scenario: premium repo branch is fix/1234-some-bug that also has code adjustments in an identically named free repo branch fix/1234-some-bug

To address this, we need to check the existence of the identical branch name in the free repo, then if that's present, use that, but if not, we fall back to using develop.

We'll need to replace the current checkout logic in premium to (untested):

    - name: Determine free repo branch
      id: determine-branches
      shell: sh +e {0}
      run: |
        branch=develop
        git ls-remote --exit-code --heads \
          "https://github.com/gambitph/Stackable" "$GITHUB_HEAD_REF" \
          > /dev/null
        if [ $? -eq 0 ]; then
          branch="$GITHUB_HEAD_REF"
        fi
        echo "::set-output name=free_branch::$branch"

    - uses: actions/checkout@v2
      with:
        repository: 'gambitph/Stackable'
        ref: ${{ steps.determine-branches.outputs.free_branch }}

Thanks to actions/checkout#512 (comment) for the inspiration.

@bfintal bfintal self-assigned this Aug 12, 2022
@bfintal
Copy link
Contributor Author

bfintal commented Aug 15, 2022

@bfintal bfintal closed this as completed Aug 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant