Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Dependabot changelog: don't require a changelog in lints
Browse files Browse the repository at this point in the history
  • Loading branch information
David Robertson committed Oct 3, 2022
1 parent 0c9c159 commit 92ae90a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
21 changes: 6 additions & 15 deletions .github/workflows/dependabot_changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ permissions:
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#enable-auto-merge-on-a-pull-request
# for a similar example
contents: write
# We need `actions-write` in order to create a `workflow_dispatch` event. See
# https://docs.github.com/en/rest/actions/workflows#create-a-workflow-dispatch-event
actions: write

jobs:
add-changelog:
Expand All @@ -31,7 +28,7 @@ jobs:
git commit -m "Changelog"
git push
shell: bash
# We have to explicitly start CI.
# The `git push` above does not trigger CI on the dependabot PR.
#
# By default, workflows can't trigger other workflows when they're just using the
# default `GITHUB_TOKEN` access token. (This is intended to stop you from writing
Expand All @@ -40,16 +37,10 @@ jobs:
# make your changes (i.e. the `git push` above) using a personal access token.
# See
# https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow
- name: Trigger CI
# Note: we use $GITHUB_REF here to run PR against the merge of this change with
# develop; use github.event.pull_request.head.ref above to commit to the PR
# branch.
run: |
gh workflow run "tests.yml" --ref "${{ github.event.pull_request.head.ref }}"
gh workflow run "release-artifacts.yml" --ref "${{ github.event.pull_request.head.ref }}"
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
#
# I have tried and failed to find a way to trigger CI on the "merge ref" of the PR.

This comment has been minimized.

Copy link
@realtyem

realtyem Oct 6, 2022

Contributor

Would adding a "dependabot/*" to the on.push.branches of tests.yml help?

This comment has been minimized.

Copy link
@realtyem

realtyem Oct 6, 2022

Contributor

This comment has been minimized.

Copy link
@DMRobertson

DMRobertson Oct 7, 2022

Contributor

I don't think so, because

  • The changelog commit made by this action doesn't trigger other workflows, see comment above
  • GITHUB_REF for the push event is the the updated ref---not the merge ref created by github as part of a PR

This comment has been minimized.

Copy link
@realtyem

realtyem Oct 7, 2022

Contributor

Maybe I didn't follow what you were trying to trigger. You wanted to trigger the workflow for (at least) tests.yml AFTER the changelog was created? Or after the pull request was successfully merged?

This comment has been minimized.

Copy link
@DMRobertson

DMRobertson Oct 7, 2022

Contributor

You wanted to trigger the workflow for (at least) tests.yml AFTER the changelog was created?

Correct. But I want the workflow to checkout and run on the result of merging the branch into develop (which is what CI checks on PRs do), not directly on the branch itself.

This comment has been minimized.

Copy link
@realtyem

realtyem Oct 7, 2022

Contributor

I feel embarrassed that it's taken me this long to comprehend this. I think I understand now. And I think we are still talking about the same thing. Why does it work on mine, but not yours?

-edit: You want to show the test results on the dependabot PR page itself?

This comment has been minimized.

Copy link
@DMRobertson

DMRobertson Oct 7, 2022

Contributor

-edit: You want to show the test results on the dependabot PR page itself?

Yep!

Edit: so that the tests-done job complete and the PR is marked a being ready (or not) for merging

This comment has been minimized.

Copy link
@realtyem

realtyem Oct 7, 2022

Contributor

Ok. I will ponder on this. Would a link to the test results be sufficient, if not as pretty? Or perhaps the changelog being written after the tests complete?

This comment has been minimized.

Copy link
@DMRobertson

DMRobertson Oct 10, 2022

Contributor

Would a link to the test results be sufficient, if not as pretty?

This essentially exists already---one can scroll up to the commit by dependabot and see a green tick or red cross next to the commit.

Or perhaps the changelog being written after the tests complete?

I think that'll exhibit the same problem (waiting forever for tests-done that won't run), but feel free to try it out on a fork if you like.

# See git commit history for previous attempts. If anyone desperately wants to try
# again in the future, make a matrix-bot account and use its access token to git push.

# THIS WORKFLOW HAS VARIOUS WRITE PERMISSIONS---do not add other jobs here unless they
# THIS WORKFLOW HAS WRITE PERMISSIONS---do not add other jobs here unless they
# are sufficiently locked down to dependabot only as above.
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
run: scripts-dev/check_line_terminators.sh

lint-newsfile:
if: ${{ github.base_ref == 'develop' || contains(github.base_ref, 'release-') }}
if: ${{ (github.base_ref == 'develop' || contains(github.base_ref, 'release-')) && github.actor != 'dependabot[bot]' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand Down

0 comments on commit 92ae90a

Please sign in to comment.