Skip to content

Changelog action does not play nicely with dependabot #485

Closed

Description

@da1910

I don't know that there is actually a nice solution for this, but its worth flagging up.

Dependabot will only update its own PRs if nobody else has touched them (for example if a later version of a package becomes available). This means that if you use the docs/changelog action (which is marvellous and we should definitely use), then dependabot will see that someone (the pyansys-ci-bot) has edited its PR and refuse to maintain it.

This isn't a dealbreaker most of the time, as it's not especially common for a package to receive multiple releases in a short time, but it is annoying. Additionally it's worth thinking about whether it makes sense to document every separate bump to a package version. Or does it make more sense to add the package bumps in an aggregated form at release time?

Activity

  1. germa89 commented on Aug 5, 2024

    @germa89
    Contributor

    Hi @da1910

    I stumbled upon this issue by chance, so sorry for the delay.

    The simplest option will be to modify the commit message to include [dependabot skip] as per documentation.
    In theory, that commit then won't avoid dependabot rebases. So it should keep mantaining it.

    Other option (more complex) is to make dependabot to commit his own commits.

        # Update towncrier commits
        - name: "Create and commit towncrier fragment"
          env:
            PR_BRANCH: ${{ github.event.pull_request.head.ref }}
            PR_NUMBER: ${{ github.event.number }}
          shell: bash
          run: |
            # Changelog fragment file in the following format
            # For example, 20.added.md
            fragment="${{ env.PR_NUMBER }}.${{ env.CHANGELOG_SECTION }}.md"
    
            # Create changelog fragment with towncrier
            # Fragment file contains the title of the PR
            towncrier create -c "${{ env.CLEAN_TITLE }}" $fragment
    
            if [[ ${{ github.actor }}" == "dependabot[bot]"" ]]; then
                echo "It is a dependabot PR"
                export DEPENDABOT_PR="true"  #if later is needed.
            else
                echo "It is NOT a dependabot PR"
                export DEPENDABOT_PR="false"
                # Configure git username & email
                git config user.name 'pyansys-ci-bot'
                git config user.email '[email protected]'
            fi;
    
            # Add towncrier fragment
            git add .
    
            # Check if file was modified
            modified=`git diff HEAD --name-only`
    
            # If the file was modified, commit & push it to the branch
            if [ ! -z "$modified" ]; then
              echo "modified: $modified"
              # Commit and push fragment
              git commit -m "chore: adding changelog file $fragment"
              git push
            fi

    Maybe the workflow permissions need to be upgrade to include "contents: write" and "pull-requests: write" permissions, which is probably not nice because the full workflow will have those permissions instead of only this action.

    I think I would go for the simplest option.

    References:

  2. germa89 commented on Aug 5, 2024

    @germa89
    Contributor

    Pinging @klmcadams for feedback. Also, should the email of pyansysbot be hidden? Just in case. Not sure if it can be a secret.

  3. RobPasMue commented on Aug 6, 2024

    @RobPasMue
    Member

    Pinging @klmcadams for feedback. Also, should the email of pyansysbot be hidden? Just in case. Not sure if it can be a secret.

    Reusable actions like this one can't use secrets. They need to be passed as args. I would avoid it. Plus, it is a private email autogenerated by GH.

  4. RobPasMue commented on Aug 6, 2024

    @RobPasMue
    Member

    The simplest option will be to modify the commit message to include [dependabot skip] as per documentation. In theory, that commit then won't avoid dependabot rebases. So it should keep mantaining it.

    I like this approach - @klmcadams please plan working on this if possible. It is very annoying that dependabot can't autoupdate them.

  5. germa89 commented on Aug 6, 2024

    @germa89
    Contributor

    Pinging @klmcadams for feedback. Also, should the email of pyansysbot be hidden? Just in case. Not sure if it can be a secret.

    Reusable actions like this one can't use secrets. They need to be passed as args. I would avoid it. Plus, it is a private email autogenerated by GH.

    In that case, we should probably provide that email as a secret (and argument). I do not think it is a good idea to have it exposed. Not sure what are the implications, but it might facilitate impersonate the bot.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions