Skip to content

Commit

Permalink
Update GitHub action for new inventory
Browse files Browse the repository at this point in the history
  • Loading branch information
runesoerensen committed Apr 23, 2024
1 parent 535eb5f commit f0879eb
Showing 1 changed file with 48 additions and 8 deletions.
56 changes: 48 additions & 8 deletions .github/workflows/inventory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,54 @@ on:

jobs:
update-nodejs-inventory:
name: Node.js
uses: ./.github/workflows/_update-inventory.yml
with:
name: Node.js
distribution: node
buildpack_id: heroku/nodejs-engine
buildpack_path: buildpacks/nodejs-engine
secrets: inherit
name: Update Node.js Inventory
runs-on: pub-hk-ubuntu-22.04-small
steps:
- uses: heroku/use-app-token-action@main
id: generate-token
with:
app_id: ${{ vars.LINGUIST_GH_APP_ID }}
private_key: ${{ secrets.LINGUIST_GH_PRIVATE_KEY }}

- name: Checkout Repo
uses: actions/checkout@v4

- id: install-rust-toolchain
name: Install Rust Toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable

- name: Rebuild Inventory
id: rebuild-inventory
run: |
delimiter="$(openssl rand -hex 8)"
{
echo "msg<<${delimiter}"
cargo run --bin update_node_inventory buildpacks/nodejs-engine/inventory.toml
echo "${delimiter}"
} >> $GITHUB_OUTPUT
- name: Update Changelog
run: echo "${{ steps.rebuild-inventory.outputs.msg }}" | xargs -r -I '{}' perl -i -p -e 's/\[Unreleased\]\s+/[Unreleased]\n\n- {}/' buildpacks/nodejs-engine/CHANGELOG.md

- name: Create Pull Request
id: pr
uses: peter-evans/create-pull-request@v6
with:
token: ${{ steps.generate-token.outputs.app_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 }}>
author: ${{ vars.LINGUIST_GH_APP_USERNAME }} <${{ vars.LINGUIST_GH_APP_EMAIL }}>
branch: update-nodejs-inventory
body: "Automated pull-request to update heroku/nodejs inventory:\n\n${{ steps.rebuild-inventory.outputs.msg }}"

- name: Configure PR
if: steps.pr.outputs.pull-request-operation == 'created'
env:
GH_TOKEN: ${{ steps.generate-token.outputs.app_token }}
run: gh pr merge --squash --auto "${{ steps.pr.outputs.pull-request-number }}"

update-yarn-inventory:
name: Yarn
Expand Down

0 comments on commit f0879eb

Please sign in to comment.