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

Publishing charms from release branches check the branch-protections of the main branch #290

Open
addyess opened this issue May 1, 2024 · 0 comments

Comments

@addyess
Copy link
Contributor

addyess commented May 1, 2024

The publish-charm workflow only ever checks the main branch for the branch protection rules, and ignores release branches. The workflow should at least accept an alternate branch or use the branch based on the workflow event which is triggering this job:

  branch-up-to-date-check-enabled:
    runs-on: ubuntu-22.04
    steps:
      - uses: octokit/[email protected]
        id: get-branch-protection
        env:
          GITHUB_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
        with:
          route: GET /repos/{owner}/{repo}/branches/{branch}/protection/required_status_checks
          repo: ${{ github.event.repository.name }}
          owner: ${{ github.event.repository.owner.login }}
          branch: main       # <---------- fixed to the main branch
      - run: |
          if [ ${{ fromJson(steps.get-branch-protection.outputs.data).strict }} != "true" ]; then
            echo "::error::Strict checks are not enabled for this repository"
            exit 1
          fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant