From 5a5e2337d7f08223708bea3e3c1248af2a2023f5 Mon Sep 17 00:00:00 2001 From: Colin Casey Date: Wed, 3 Jul 2024 11:18:30 -0300 Subject: [PATCH] Use `keep_a_changelog_file` crate and `create-github-app-token` GHA (#874) * Use `keep_a_changelog_file` crate and `create-github-app-token` GHA * Fix parameter names which are kebab-case, not snake_case --- .github/workflows/_update-inventory.yml | 12 ++++++------ .github/workflows/inventory.yml | 12 ++++++------ Cargo.lock | 7 ++++--- common/nodejs-utils/Cargo.toml | 2 +- common/nodejs-utils/src/bin/update_node_inventory.rs | 4 ++-- common/nodejs-utils/src/lib.rs | 2 +- 6 files changed, 20 insertions(+), 19 deletions(-) diff --git a/.github/workflows/_update-inventory.yml b/.github/workflows/_update-inventory.yml index b85d08ca..ced5d764 100644 --- a/.github/workflows/_update-inventory.yml +++ b/.github/workflows/_update-inventory.yml @@ -27,16 +27,16 @@ jobs: name: Update Inventory runs-on: pub-hk-ubuntu-22.04-small steps: - - uses: heroku/use-app-token-action@main + - uses: actions/create-github-app-token@v1 id: generate-token with: - app_id: ${{ vars.LINGUIST_GH_APP_ID }} - private_key: ${{ secrets.LINGUIST_GH_PRIVATE_KEY }} + app-id: ${{ vars.LINGUIST_GH_APP_ID }} + private-key: ${{ secrets.LINGUIST_GH_PRIVATE_KEY }} - name: Checkout Repo uses: actions/checkout@v4 with: - token: ${{ steps.generate-token.outputs.app_token }} + token: ${{ steps.generate-token.outputs.token }} - name: Update Rust toolchain run: rustup update @@ -64,7 +64,7 @@ jobs: id: pr uses: peter-evans/create-pull-request@v6 with: - token: ${{ steps.generate-token.outputs.app_token }} + token: ${{ steps.generate-token.outputs.token }} title: Update Inventory - ${{ inputs.name }} branch: update-${{ inputs.distribution }}-inventory commit-message: "Update Inventory for ${{ inputs.buildpack_id }}\n\n${{ steps.set-diff-msg.outputs.msg }}" @@ -75,5 +75,5 @@ jobs: - name: Configure PR if: steps.pr.outputs.pull-request-operation == 'created' env: - GH_TOKEN: ${{ steps.generate-token.outputs.app_token }} + GH_TOKEN: ${{ steps.generate-token.outputs.token }} run: gh pr merge --squash --auto "${{ steps.pr.outputs.pull-request-number }}" diff --git a/.github/workflows/inventory.yml b/.github/workflows/inventory.yml index 99b6d326..f5557a7a 100644 --- a/.github/workflows/inventory.yml +++ b/.github/workflows/inventory.yml @@ -10,11 +10,11 @@ jobs: name: Update Node.js Inventory runs-on: pub-hk-ubuntu-22.04-small steps: - - uses: heroku/use-app-token-action@main + - uses: actions/create-github-app-token@v1 id: generate-token with: - app_id: ${{ vars.LINGUIST_GH_APP_ID }} - private_key: ${{ secrets.LINGUIST_GH_PRIVATE_KEY }} + app-id: ${{ vars.LINGUIST_GH_APP_ID }} + private-key: ${{ secrets.LINGUIST_GH_PRIVATE_KEY }} - name: Checkout Repo uses: actions/checkout@v4 @@ -34,12 +34,12 @@ jobs: cargo run --bin update_node_inventory buildpacks/nodejs-engine/inventory.toml buildpacks/nodejs-engine/CHANGELOG.md echo "${delimiter}" } >> $GITHUB_OUTPUT - + - name: Create Pull Request id: pr uses: peter-evans/create-pull-request@v6 with: - token: ${{ steps.generate-token.outputs.app_token }} + token: ${{ steps.generate-token.outputs.token }} title: "Update Node.js Inventory" commit-message: "Update Inventory for heroku/nodejs\n\n${{ steps.rebuild-inventory.outputs.msg }}" committer: ${{ vars.LINGUIST_GH_APP_USERNAME }} <${{ vars.LINGUIST_GH_APP_EMAIL }}> @@ -50,7 +50,7 @@ jobs: - name: Configure PR if: steps.pr.outputs.pull-request-operation == 'created' env: - GH_TOKEN: ${{ steps.generate-token.outputs.app_token }} + GH_TOKEN: ${{ steps.generate-token.outputs.token }} run: gh pr merge --squash --auto "${{ steps.pr.outputs.pull-request-number }}" update-yarn-inventory: diff --git a/Cargo.lock b/Cargo.lock index 2f770d56..d5936552 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -641,7 +641,7 @@ dependencies = [ "commons", "heroku-inventory-utils", "indoc", - "keep_a_changelog", + "keep_a_changelog_file", "node-semver", "opentelemetry 0.23.0", "opentelemetry-stdout 0.4.0", @@ -813,9 +813,10 @@ dependencies = [ ] [[package]] -name = "keep_a_changelog" +name = "keep_a_changelog_file" version = "0.1.0" -source = "git+https://github.com/heroku/keep_a_changelog?branch=main#f92ec48c9257ff8d67df1eb8e942a2c25cf2ba91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "516dcf9845c0228e8accdc2c61de18e68a701fcbe045085d96db097bad19d1cc" dependencies = [ "chrono", "indexmap", diff --git a/common/nodejs-utils/Cargo.toml b/common/nodejs-utils/Cargo.toml index f7bef617..617f7fb2 100644 --- a/common/nodejs-utils/Cargo.toml +++ b/common/nodejs-utils/Cargo.toml @@ -12,7 +12,7 @@ chrono = { version = "0.4", default-features = false, features = ["serde"] } commons = { git = "https://github.com/heroku/buildpacks-ruby", branch = "main" } heroku-inventory-utils = { git = "https://github.com/heroku/buildpacks-go/", rev = "2a86fae18332b9bd495eb29422c13ac3fcb2d0dc" } indoc = "2" -keep_a_changelog = { git = "https://github.com/heroku/keep_a_changelog", branch = "main" } +keep_a_changelog_file = "0.1.0" node-semver = "2" opentelemetry = "0.23" opentelemetry_sdk = { version = "0.23", features = ["trace"] } diff --git a/common/nodejs-utils/src/bin/update_node_inventory.rs b/common/nodejs-utils/src/bin/update_node_inventory.rs index 6fb3ec56..ab1d3a69 100644 --- a/common/nodejs-utils/src/bin/update_node_inventory.rs +++ b/common/nodejs-utils/src/bin/update_node_inventory.rs @@ -6,7 +6,7 @@ use heroku_inventory_utils::{ checksum::Checksum, inv::{read_inventory_file, Arch, Artifact, Inventory, Os}, }; -use keep_a_changelog::ChangeGroup; +use keep_a_changelog_file::{ChangeGroup, Changelog}; use node_semver::Version; use serde::Deserialize; use sha2::Sha256; @@ -78,7 +78,7 @@ fn write_changelog( let mut changelog = fs::read_to_string(&changelog_path) .context("Reading changelog") .and_then(|contents| { - keep_a_changelog::Changelog::from_str(&contents).context(format!( + Changelog::from_str(&contents).context(format!( "Error parsing changelog at '{}'", changelog_path.display() )) diff --git a/common/nodejs-utils/src/lib.rs b/common/nodejs-utils/src/lib.rs index 3e5a06ef..8da8b31e 100644 --- a/common/nodejs-utils/src/lib.rs +++ b/common/nodejs-utils/src/lib.rs @@ -1,4 +1,4 @@ -use keep_a_changelog as _; +use keep_a_changelog_file as _; use sha2 as _; pub mod application;