Skip to content

Bug located in how the Changelog Action interacts with GitHub Environments #626

Closed

Description

@da1910

🔍 Before submitting the issue

  • I have searched among the existing issues
  • I am using a Python virtual environment

🐞 Description of the bug

Our setup for publishing with the trusted publisher workflow leverages environments to secure access to publishing new versions of packages. The intended workflow for environments with approvals is that the person triggering the workflow is not able to approve their own request.

The doc deploy changelog workflow circumvents this security by triggering a follow up workflow run as the pyansys bot, this means a user is then able to approve their own publish. This may be acceptable or it may not, but ideally the follow up run would be triggered as the same user who initially pushed the tag.

📝 Steps to reproduce

Publish a tag on a repository that has trusted publisher enabled with an environment

💻 Which operating system are you using?

Windows

📀 Which ANSYS version are you using?

No response

🐍 Which Python version are you using?

3.9

📦 Installed packages

n/a

Activity

  1. added
    bug
    on Oct 25, 2024
  2. RobPasMue commented on Oct 28, 2024

    @RobPasMue
    Member

    Aha interesting. This would imply that the tag and changelog no longer get committed by the CI bot account, but by whomever initiated the release.

    [Line of thought.... you can skip reading this]
    We should check whether passing the ``${{ github.actor }} and GITHUB_TOKEN approach works. However, I believe it would also imply that we need to grant our workflow file write permissions for creating tags, otherwise the usage of the GITHUB_TOKEN would cause a failure... Lastly, the email is not available through the context... https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#github-context so... this might be an issue (I guess?). However, if you are checking the repo out as "user A" in the workflow, GitHub should have configured everything under "user A" ... which means that we won't need any of the above since it's already configured.. we just need to commit and create the tag (assuming the workflow has permissions to create tags - i.e. write permissions).

    This requires testing but I think it might be a good idea @klmcadams

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions