Update Inventory #438
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update Inventory | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '00 4 * * 1-5' | |
jobs: | |
update-nodejs-inventory: | |
name: Update Node.js Engine Inventory | |
runs-on: pub-hk-ubuntu-24.04-ip | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Install Rust Toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Install Rust Inventory Binaries | |
run: cargo install heroku-nodejs-utils --bin diff_versions --bin generate_inventory --git https://github.com/heroku/buildpacks-nodejs | |
- id: set-diff-msg | |
name: Set Diff Message | |
run: | | |
delimiter="$(openssl rand -hex 8)" | |
{ | |
echo "msg<<${delimiter}" | |
diff_versions node inventory/node.toml | |
echo "${delimiter}" | |
} >> $GITHUB_OUTPUT | |
- name: Rebuild Inventory | |
run: "generate_inventory node > inventory/node.toml" | |
- name: Update Changelog | |
run: echo "${{ steps.set-diff-msg.outputs.msg }}" | xargs -r -I '{}' perl -i -p -e 's/## \[Unreleased\]\s+/## \[Unreleased\]\n\n{}/' CHANGELOG.md | |
- 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 }} | |
- name: Create Pull Request | |
id: pr | |
uses: peter-evans/create-pull-request@v7.0.5 | |
with: | |
token: ${{ steps.generate-token.outputs.token }} | |
title: "Update Node.js Engine Inventory" | |
commit-message: "Update Inventory for heroku/nodejs engine\n\n${{ steps.set-diff-msg.outputs.msg }}" | |
branch: update-nodejs-inventory | |
body: "Automated pull-request to update heroku/nodejs engine inventory:\n\n${{ steps.set-diff-msg.outputs.msg }}" | |
committer: ${{ vars.LINGUIST_GH_APP_USERNAME }} <${{ vars.LINGUIST_GH_APP_EMAIL }}> | |
author: ${{ vars.LINGUIST_GH_APP_USERNAME }} <${{ vars.LINGUIST_GH_APP_EMAIL }}> | |
- name: Configure PR | |
if: steps.pr.outputs.pull-request-operation == 'created' | |
run: gh pr merge --squash --auto "${{ steps.pr.outputs.pull-request-number }}" | |
env: | |
GH_TOKEN: ${{ steps.generate-token.outputs.token }} | |
update-yarn-inventory: | |
name: Update Node.js Yarn Inventory | |
runs-on: pub-hk-ubuntu-24.04-ip | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- id: install-rust-toolchain | |
name: Install Rust Toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Install Rust Inventory Binaries | |
run: cargo install heroku-nodejs-utils --bin diff_versions --bin generate_inventory --git https://github.com/heroku/buildpacks-nodejs | |
- id: set-diff-msg | |
name: Set Diff Message | |
run: | | |
delimiter="$(openssl rand -hex 8)" | |
{ | |
echo "msg<<${delimiter}" | |
diff_versions yarn inventory/yarn.toml | |
echo "${delimiter}" | |
} >> $GITHUB_OUTPUT | |
- name: Rebuild Inventory | |
run: "generate_inventory yarn > inventory/yarn.toml" | |
- name: Update Changelog | |
run: echo "${{ steps.set-diff-msg.outputs.msg }}" | xargs -r -I '{}' perl -i -p -e 's/## \[Unreleased\]\s+/## \[Unreleased\]\n\n{}/' CHANGELOG.md | |
- 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 }} | |
- name: Create Pull Request | |
id: pr | |
uses: peter-evans/create-pull-request@v7.0.5 | |
with: | |
token: ${{ steps.generate-token.outputs.token }} | |
title: "Update Node.js Yarn Inventory" | |
commit-message: "Update Inventory for heroku/nodejs yarn\n\n${{ steps.set-diff-msg.outputs.msg }}" | |
branch: update-yarn-inventory | |
body: "Automated pull-request to update heroku/nodejs yarn inventory:\n\n${{ steps.set-diff-msg.outputs.msg }}" | |
committer: ${{ vars.LINGUIST_GH_APP_USERNAME }} <${{ vars.LINGUIST_GH_APP_EMAIL }}> | |
author: ${{ vars.LINGUIST_GH_APP_USERNAME }} <${{ vars.LINGUIST_GH_APP_EMAIL }}> | |
- name: Configure PR | |
if: steps.pr.outputs.pull-request-operation == 'created' | |
run: gh pr merge --squash --auto "${{ steps.pr.outputs.pull-request-number }}" | |
env: | |
GH_TOKEN: ${{ steps.generate-token.outputs.token }} |