Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions .github/workflows/dependabot-changeset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,24 @@ jobs:
echo "ref=$PR_REF_FROM_EVENT" >> "$GITHUB_OUTPUT"
fi

# Checkout the base branch to get the trusted version of the script,
# then checkout the PR branch on top to get the package.json changes.
- name: Checkout base branch
uses: actions/checkout@v4
with:
ref: main
token: ${{ secrets.KNOCK_ENG_BOT_GITHUB_TOKEN }}
path: base

# Checkout the PR branch for package.json analysis and committing.
- name: Checkout PR branch
uses: actions/checkout@v4
with:
ref: ${{ steps.pr.outputs.ref }}
token: ${{ secrets.KNOCK_ENG_BOT_GITHUB_TOKEN }}
fetch-depth: 2

# Checkout the trusted script from main into a subdirectory.
# This ensures we never execute code from an untrusted PR branch
# when triggered via workflow_dispatch.
- name: Checkout trusted script from main
uses: actions/checkout@v4
with:
ref: main
sparse-checkout: .github/scripts
path: .trusted

- name: Setup Node.js
uses: actions/setup-node@v4
with:
Expand All @@ -65,7 +67,7 @@ jobs:
env:
PR_TITLE: ${{ steps.pr.outputs.title }}
PR_NUMBER: ${{ steps.pr.outputs.number }}
run: node base/.github/scripts/dependabot-changeset.js
run: node .trusted/.github/scripts/dependabot-changeset.js

- name: Commit and push changeset
if: steps.changeset.outputs.created == 'true'
Expand Down
Loading