From 3ceceb7c9d42ffe7a22b9a78cf6181cbf63e418d Mon Sep 17 00:00:00 2001 From: Emily Rockman Date: Fri, 29 Apr 2022 07:31:58 -0500 Subject: [PATCH 01/10] add dependabot specific action --- .github/workflows/dependabot_specific.yml | 114 ++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 .github/workflows/dependabot_specific.yml diff --git a/.github/workflows/dependabot_specific.yml b/.github/workflows/dependabot_specific.yml new file mode 100644 index 00000000..f3f952bc --- /dev/null +++ b/.github/workflows/dependabot_specific.yml @@ -0,0 +1,114 @@ +# **what?** +# When dependabot create a PR, it always adds the `dependencies` label. This +# action will add a corresponding changie yaml file to that PR when that label is added. +# The file is created off a template: +# +# kind: Dependencies +# body: +# time: +# custom: +# Author: dependabot +# Issue: 4904 +# PR: +# +# **why?** +# Automate changelog generation for more visability with automated dependency updates via dependabot. + +# **when?** +# Once a PR is created and it has been correctly labeled with `dependencies`. The intended use +# is for the PRs created by dependabot. You can also manually trigger this by adding the +# `dependencies` label at any time. + +name: Dependency Changelog + +on: + pull_request: + # catch when the PR is opened with the label or when the label is added + types: [opened, labeled] + +permissions: + contents: write + pull-requests: read + +jobs: + dependency_changelog: + if: ${{ github.event.label.name == 'dependencies' }} + runs-on: ubuntu-latest + + steps: + # timestamp changes the order the changelog entries are listed in the final Changelog.md file. Precision is not + # important here. + # The timestamp on the filename and the timestamp in the contents of the file have different expected formats. + - name: Get File Name Timestamp + id: filename_time + uses: nanzm/get-time-action@v1.1 + with: + format: 'YYYYMMDD-HHmmss' + + - name: Get File Content Timestamp + id: file_content_time + uses: nanzm/get-time-action@v1.1 + with: + format: 'YYYY-MM-DDTHH:mm:ss.000000-05:00' + + # changie expects files to be named in a specific pattern. + - name: Generate Filepath + id: fp + run: | + FILEPATH=.changes/unreleased/Dependencies-${{ steps.filename_time.outputs.time }}.yaml + echo "::set-output name=FILEPATH::$FILEPATH" + + - name: Check if changelog file exists already + # if there's already a changelog entry, don't add another one! + # https://github.com/marketplace/actions/paths-changes-filter + # For each filter, it sets output variable named by the filter to the text: + # 'true' - if any of changed files matches any of filter rules + # 'false' - if none of changed files matches any of filter rules + # also, returns: + # `changes` - JSON array with names of all filters matching any of the changed files + uses: dorny/paths-filter@v2 + id: changelog_check + with: + token: ${{ secrets.GITHUB_TOKEN }} + filters: | + exists: + - added: '.changes/unreleased/**.yaml' + + - name: Checkout Branch + if: steps.changelog_check.outputs.exists == 'false' + uses: actions/checkout@v2 + with: + # specifying the ref avoids checking out the repository in a detached state + ref: ${{ github.event.pull_request.head.ref }} + # If this is not set to false, Git push is performed with github.token and not the token + # configured using the env: GITHUB_TOKEN in commit step + persist-credentials: false + + - name: Create file from template + if: steps.changelog_check.outputs.exists == 'false' + run: | + echo kind: Dependencies > "${{ steps.fp.outputs.FILEPATH }}" + echo 'body: "${{ github.event.pull_request.title }}"' >> "${{ steps.fp.outputs.FILEPATH }}" + echo time: "${{ steps.file_content_time.outputs.time }}" >> "${{ steps.fp.outputs.FILEPATH }}" + echo custom: >> "${{ steps.fp.outputs.FILEPATH }}" + echo ' Author: ${{ github.event.pull_request.user.login }}' >> "${{ steps.fp.outputs.FILEPATH }}" + echo ' Issue: "4904"' >> "${{ steps.fp.outputs.FILEPATH }}" # github.event.pull_request.issue for auto id? + echo ' PR: "${{ github.event.pull_request.number }}"' >> "${{ steps.fp.outputs.FILEPATH }}" + + - name: Commit Changelog File + if: steps.changelog_check.outputs.exists == 'false' + uses: gr2m/create-or-update-pull-request-action@v1 + env: + # When using the GITHUB_TOKEN, the resulting commit will not trigger another GitHub Actions + # Workflow run. This is due to limitations set by GitHub. + # See: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow + # When you use the repository's GITHUB_TOKEN to perform tasks on behalf of the GitHub Actions + # app, events triggered by the GITHUB_TOKEN will not create a new workflow run. This prevents + # you from accidentally creating recursive workflow runs. To get around this, use a Personal + # Access Token to commit changes. + GITHUB_TOKEN: ${{ secrets.EMMYOOP_BOT }} + with: + branch: ${{ github.event.pull_request.head.ref }} + # author expected in the format "Lorem J. Ipsum " + author: "emmyoop bot " + commit-message: "Add automated changelog yaml from template" From c5b3fbaa15916841dc3488a40be56e1fbc8fc1e1 Mon Sep 17 00:00:00 2001 From: emmyoop bot Date: Fri, 29 Apr 2022 12:59:03 +0000 Subject: [PATCH 02/10] Add automated changelog yaml from template --- .changes/unreleased/Dependencies-20220429-125901.yaml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changes/unreleased/Dependencies-20220429-125901.yaml diff --git a/.changes/unreleased/Dependencies-20220429-125901.yaml b/.changes/unreleased/Dependencies-20220429-125901.yaml new file mode 100644 index 00000000..204ad7bd --- /dev/null +++ b/.changes/unreleased/Dependencies-20220429-125901.yaml @@ -0,0 +1,7 @@ +kind: Dependencies +body: "add dependabot specific action" +time: 2022-04-29T12:59:01.000000-05:00 +custom: + Author: emmyoop + Issue: "4904" + PR: "4" From d9f2719cf348bad31d82237cf541a2b53497a8f5 Mon Sep 17 00:00:00 2001 From: Emily Rockman Date: Fri, 29 Apr 2022 08:30:29 -0500 Subject: [PATCH 03/10] reduce to just dependabot workflow --- .../Dependencies-20220429-125901.yaml | 7 ---- .github/workflows/.trigger_issue_comments.yml | 21 ------------ .github/workflows/changie_bot_testing.yml | 33 ------------------- 3 files changed, 61 deletions(-) delete mode 100644 .changes/unreleased/Dependencies-20220429-125901.yaml delete mode 100644 .github/workflows/.trigger_issue_comments.yml delete mode 100644 .github/workflows/changie_bot_testing.yml diff --git a/.changes/unreleased/Dependencies-20220429-125901.yaml b/.changes/unreleased/Dependencies-20220429-125901.yaml deleted file mode 100644 index 204ad7bd..00000000 --- a/.changes/unreleased/Dependencies-20220429-125901.yaml +++ /dev/null @@ -1,7 +0,0 @@ -kind: Dependencies -body: "add dependabot specific action" -time: 2022-04-29T12:59:01.000000-05:00 -custom: - Author: emmyoop - Issue: "4904" - PR: "4" diff --git a/.github/workflows/.trigger_issue_comments.yml b/.github/workflows/.trigger_issue_comments.yml deleted file mode 100644 index 890e33d0..00000000 --- a/.github/workflows/.trigger_issue_comments.yml +++ /dev/null @@ -1,21 +0,0 @@ -name: Update Triage Label - -on: issue_comment - -defaults: - run: - shell: bash - -permissions: - issues: write - -jobs: - triage_label: - if: contains(github.event.issue.labels.*.name, 'awaiting_response') - runs-on: ubuntu-latest - steps: - - name: initial labeling - uses: andymckay/labeler@master - with: - add-labels: "triage" - remove-labels: "awaiting_response" diff --git a/.github/workflows/changie_bot_testing.yml b/.github/workflows/changie_bot_testing.yml deleted file mode 100644 index 5f39175e..00000000 --- a/.github/workflows/changie_bot_testing.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: Dependency Changelog - -on: - pull_request: - # catch when the PR is opened with the label or when the label is added - types: [opened, labeled] - -permissions: - contents: write - pull-requests: read - -jobs: - dependency_changelog: - runs-on: ubuntu-latest - name: a job to add a changelog yaml file to this PR - - steps: - - name: Create Custom Multiline String - id: custom_string - run: | - echo -e "custom:\n Field 1: Some String\n Field 2: 1\n Field 3: a\n" >> $GITHUB_ENV - - - name: Create Changelog Commit on PR - id: filename_time - uses: emmyoop/changie_bot_autogenerate@main - with: - bot_PAT: ${{ secrets.EMMYOOP_BOT }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - commit_author: "emmyoop bot " - commit_message: "My custom commit message" - changie_kind: "Bug" - label: "my_custom" - custom_changelog_string: "${{ env.CUSTOM_FIELDS }}" \ No newline at end of file From 30c7513024b44af5112b578a444b3b87fb1a1bd3 Mon Sep 17 00:00:00 2001 From: emmyoop bot Date: Fri, 29 Apr 2022 13:34:40 +0000 Subject: [PATCH 04/10] Add automated changelog yaml from template --- .changes/unreleased/Dependencies-20220429-133438.yaml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changes/unreleased/Dependencies-20220429-133438.yaml diff --git a/.changes/unreleased/Dependencies-20220429-133438.yaml b/.changes/unreleased/Dependencies-20220429-133438.yaml new file mode 100644 index 00000000..94153b93 --- /dev/null +++ b/.changes/unreleased/Dependencies-20220429-133438.yaml @@ -0,0 +1,7 @@ +kind: Dependencies +body: "Test dependabot action" +time: 2022-04-29T13:34:38.000000-05:00 +custom: + Author: emmyoop + Issue: "4904" + PR: "7" From b636dac7fe50414addec006ab9be39089236d85d Mon Sep 17 00:00:00 2001 From: Emily Rockman Date: Fri, 29 Apr 2022 08:43:11 -0500 Subject: [PATCH 05/10] change label check --- .changes/unreleased/Dependencies-20220429-133438.yaml | 7 ------- .github/workflows/dependabot_specific.yml | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) delete mode 100644 .changes/unreleased/Dependencies-20220429-133438.yaml diff --git a/.changes/unreleased/Dependencies-20220429-133438.yaml b/.changes/unreleased/Dependencies-20220429-133438.yaml deleted file mode 100644 index 94153b93..00000000 --- a/.changes/unreleased/Dependencies-20220429-133438.yaml +++ /dev/null @@ -1,7 +0,0 @@ -kind: Dependencies -body: "Test dependabot action" -time: 2022-04-29T13:34:38.000000-05:00 -custom: - Author: emmyoop - Issue: "4904" - PR: "7" diff --git a/.github/workflows/dependabot_specific.yml b/.github/workflows/dependabot_specific.yml index f3f952bc..6d0e7331 100644 --- a/.github/workflows/dependabot_specific.yml +++ b/.github/workflows/dependabot_specific.yml @@ -32,7 +32,7 @@ permissions: jobs: dependency_changelog: - if: ${{ github.event.label.name == 'dependencies' }} + if: "contains(github.event.pull_request.labels.*.name, 'dependencies')" runs-on: ubuntu-latest steps: From dee56eb77d7f16977bc43b68f31831c591afc438 Mon Sep 17 00:00:00 2001 From: emmyoop bot Date: Fri, 29 Apr 2022 13:44:48 +0000 Subject: [PATCH 06/10] Add automated changelog yaml from template --- .changes/unreleased/Dependencies-20220429-134446.yaml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changes/unreleased/Dependencies-20220429-134446.yaml diff --git a/.changes/unreleased/Dependencies-20220429-134446.yaml b/.changes/unreleased/Dependencies-20220429-134446.yaml new file mode 100644 index 00000000..4768d142 --- /dev/null +++ b/.changes/unreleased/Dependencies-20220429-134446.yaml @@ -0,0 +1,7 @@ +kind: Dependencies +body: "Test dependabot action" +time: 2022-04-29T13:44:46.000000-05:00 +custom: + Author: emmyoop + Issue: "4904" + PR: "9" From 5f24d94bdf0a320ed148c05a90c77f544cf1f662 Mon Sep 17 00:00:00 2001 From: emmyoop bot Date: Fri, 29 Apr 2022 13:44:51 +0000 Subject: [PATCH 07/10] Add automated changelog yaml from template --- .changes/unreleased/Dependencies-20220429-134448.yaml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changes/unreleased/Dependencies-20220429-134448.yaml diff --git a/.changes/unreleased/Dependencies-20220429-134448.yaml b/.changes/unreleased/Dependencies-20220429-134448.yaml new file mode 100644 index 00000000..76b2f8f2 --- /dev/null +++ b/.changes/unreleased/Dependencies-20220429-134448.yaml @@ -0,0 +1,7 @@ +kind: Dependencies +body: "Test dependabot action" +time: 2022-04-29T13:44:48.000000-05:00 +custom: + Author: emmyoop + Issue: "4904" + PR: "9" From 46eb3fa2d7002167c1929430fd45962e27d0f406 Mon Sep 17 00:00:00 2001 From: Emily Rockman Date: Fri, 29 Apr 2022 08:51:35 -0500 Subject: [PATCH 08/10] remove changelog files --- .changes/unreleased/Dependencies-20220429-134446.yaml | 7 ------- .changes/unreleased/Dependencies-20220429-134448.yaml | 7 ------- 2 files changed, 14 deletions(-) delete mode 100644 .changes/unreleased/Dependencies-20220429-134446.yaml delete mode 100644 .changes/unreleased/Dependencies-20220429-134448.yaml diff --git a/.changes/unreleased/Dependencies-20220429-134446.yaml b/.changes/unreleased/Dependencies-20220429-134446.yaml deleted file mode 100644 index 4768d142..00000000 --- a/.changes/unreleased/Dependencies-20220429-134446.yaml +++ /dev/null @@ -1,7 +0,0 @@ -kind: Dependencies -body: "Test dependabot action" -time: 2022-04-29T13:44:46.000000-05:00 -custom: - Author: emmyoop - Issue: "4904" - PR: "9" diff --git a/.changes/unreleased/Dependencies-20220429-134448.yaml b/.changes/unreleased/Dependencies-20220429-134448.yaml deleted file mode 100644 index 76b2f8f2..00000000 --- a/.changes/unreleased/Dependencies-20220429-134448.yaml +++ /dev/null @@ -1,7 +0,0 @@ -kind: Dependencies -body: "Test dependabot action" -time: 2022-04-29T13:44:48.000000-05:00 -custom: - Author: emmyoop - Issue: "4904" - PR: "9" From 94202e037dfe5ab692f8a61649bf3fd9cfbaf4d4 Mon Sep 17 00:00:00 2001 From: emmyoop bot Date: Fri, 29 Apr 2022 13:52:19 +0000 Subject: [PATCH 09/10] Add automated changelog yaml from template --- .changes/unreleased/Dependencies-20220429-135218.yaml | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changes/unreleased/Dependencies-20220429-135218.yaml diff --git a/.changes/unreleased/Dependencies-20220429-135218.yaml b/.changes/unreleased/Dependencies-20220429-135218.yaml new file mode 100644 index 00000000..1b543a12 --- /dev/null +++ b/.changes/unreleased/Dependencies-20220429-135218.yaml @@ -0,0 +1,7 @@ +kind: Dependencies +body: "Test dependabot action" +time: 2022-04-29T13:52:18.000000-05:00 +custom: + Author: emmyoop + Issue: "4904" + PR: "10" From 0c6f268f0c902994313f93ac70390031f8c56318 Mon Sep 17 00:00:00 2001 From: Emily Rockman Date: Mon, 2 May 2022 13:21:31 -0500 Subject: [PATCH 10/10] Revert "Add automated changelog yaml from template" This reverts commit 94202e037dfe5ab692f8a61649bf3fd9cfbaf4d4. --- .changes/unreleased/Dependencies-20220429-135218.yaml | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 .changes/unreleased/Dependencies-20220429-135218.yaml diff --git a/.changes/unreleased/Dependencies-20220429-135218.yaml b/.changes/unreleased/Dependencies-20220429-135218.yaml deleted file mode 100644 index 1b543a12..00000000 --- a/.changes/unreleased/Dependencies-20220429-135218.yaml +++ /dev/null @@ -1,7 +0,0 @@ -kind: Dependencies -body: "Test dependabot action" -time: 2022-04-29T13:52:18.000000-05:00 -custom: - Author: emmyoop - Issue: "4904" - PR: "10"