Skip to content

Commit

Permalink
Use keep_a_changelog_file crate and create-github-app-token GHA (#…
Browse files Browse the repository at this point in the history
…874)

* Use `keep_a_changelog_file` crate and `create-github-app-token` GHA

* Fix parameter names which are kebab-case, not snake_case
  • Loading branch information
colincasey authored Jul 3, 2024
1 parent b92fb5f commit 5a5e233
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 19 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/_update-inventory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }}"
Expand All @@ -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 }}"
12 changes: 6 additions & 6 deletions .github/workflows/inventory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}>
Expand All @@ -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:
Expand Down
7 changes: 4 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion common/nodejs-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
4 changes: 2 additions & 2 deletions common/nodejs-utils/src/bin/update_node_inventory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()
))
Expand Down
2 changes: 1 addition & 1 deletion common/nodejs-utils/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use keep_a_changelog as _;
use keep_a_changelog_file as _;
use sha2 as _;

pub mod application;
Expand Down

0 comments on commit 5a5e233

Please sign in to comment.