Skip to content

Commit

Permalink
Create automated PR with token
Browse files Browse the repository at this point in the history
Generates a token from a GitHub app that can be used in automation tasks that create pull requests.
  • Loading branch information
colincasey authored Jun 19, 2023
1 parent 562a3fc commit 56a3fd0
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/inventory.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,27 @@ jobs:
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/## main\s+/## main\n\n{}/' CHANGELOG.md
- 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: Create Pull Request
id: pr
uses: peter-evans/[email protected]
with:
token: ${{ steps.generate-token.outputs.app_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
labels: "automation"
body: "Automated pull-request to update heroku/nodejs engine inventory:\n\n${{ steps.set-diff-msg.outputs.msg }}"
- name: Configure PR
if: steps.pr.outputs.pull-request-operation == 'created'
run: gh pr merge --auto "${{ steps.pr.outputs.pull-request-number }}"
env:
GH_TOKEN: ${{ steps.generate-token.outputs.app_token }}

update-yarn-inventory:
name: Update Node.js Yarn Inventory
runs-on: pub-hk-ubuntu-22.04-small
Expand All @@ -52,11 +65,23 @@ jobs:
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/## main\s+/## main\n\n{}/' CHANGELOG.md
- 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: Create Pull Request
id: pr
uses: peter-evans/[email protected]
with:
token: ${{ steps.generate-token.outputs.app_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
labels: "automation"
body: "Automated pull-request to update heroku/nodejs yarn inventory:\n\n${{ steps.set-diff-msg.outputs.msg }}"
- name: Configure PR
if: steps.pr.outputs.pull-request-operation == 'created'
run: gh pr merge --auto "${{ steps.pr.outputs.pull-request-number }}"
env:
GH_TOKEN: ${{ steps.generate-token.outputs.app_token }}

0 comments on commit 56a3fd0

Please sign in to comment.