-
Notifications
You must be signed in to change notification settings - Fork 0
fix: work around Dependabot not supporting pnpm lockfileVersion 9.0 #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
47bf131
fix: work around Dependabot not supporting pnpm lockfileVersion 9.0
MidnightDesign 6683688
fix: address review feedback on Dependabot workaround workflows
MidnightDesign c4aebac
fix: use PR author check and fix issue body indentation
MidnightDesign 57034db
fix: use unauthenticated request for cross-repo issue check
MidnightDesign 229b77e
fix: use explicit push target and skip push when no changes
MidnightDesign 169cf94
fix: add strict mode to upstream issue check script
MidnightDesign File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| # Checks weekly whether the upstream Dependabot issue for pnpm lockfileVersion | ||
| # 9.0 support has been resolved. Creates a repo issue (assigned to @MidnightDesign) | ||
| # when it detects the fix, so we remember to remove the workaround. | ||
| # | ||
| # Related: https://github.com/dependabot/dependabot-core/issues/13920 | ||
| # Remove this workflow together with dependabot-lockfile.yml once the issue is resolved. | ||
|
|
||
| name: Check Dependabot pnpm Fix | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: "0 9 * * 1" # Every Monday at 9:00 UTC | ||
|
|
||
| permissions: | ||
| issues: write | ||
|
|
||
| jobs: | ||
| check: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check if upstream issue is resolved | ||
| env: | ||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: | | ||
| set -euo pipefail | ||
| state=$(GH_TOKEN= gh issue view 13920 --repo dependabot/dependabot-core --json state --jq '.state') | ||
| if [ "$state" = "OPEN" ]; then | ||
| echo "Upstream issue is still open, nothing to do." | ||
| exit 0 | ||
| fi | ||
MidnightDesign marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| echo "Upstream issue is no longer open (state: $state)." | ||
|
|
||
| existing=$(gh issue list --repo "${{ github.repository }}" --state open --search "Remove Dependabot lockfile workaround" --json number --jq 'length') | ||
| if [ "$existing" != "0" ]; then | ||
| echo "Reminder issue already exists, skipping." | ||
| exit 0 | ||
| fi | ||
|
|
||
| body_file=$(mktemp) | ||
| printf '%s\n' \ | ||
| 'dependabot/dependabot-core#13920 has been resolved.' \ | ||
| '' \ | ||
| 'The lockfile regeneration workaround is no longer needed. Remove:' \ | ||
| '- `.github/workflows/dependabot-lockfile.yml`' \ | ||
| '- `.github/workflows/check-dependabot-fix.yml`' \ | ||
| '' \ | ||
| 'Then verify that Dependabot PRs correctly update `pnpm-lock.yaml` on their own.' \ | ||
| > "$body_file" | ||
|
|
||
| gh issue create --repo "${{ github.repository }}" \ | ||
| --assignee MidnightDesign \ | ||
| --title "Remove Dependabot lockfile workaround" \ | ||
MidnightDesign marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| --body-file "$body_file" | ||
|
|
||
MidnightDesign marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| echo "Created reminder issue." | ||
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| # Workaround for https://github.com/dependabot/dependabot-core/issues/13920 | ||
| # Dependabot can't parse pnpm lockfileVersion 9.0, so it updates package.json | ||
| # but not pnpm-lock.yaml. This workflow regenerates the lockfile and commits it. | ||
| # | ||
| # Remove this workflow once the upstream issue is resolved. | ||
|
|
||
| name: Fix Dependabot Lockfile | ||
|
|
||
| on: | ||
| pull_request: | ||
MidnightDesign marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| branches: [master] | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| jobs: | ||
| fix-lockfile: | ||
| if: github.event.pull_request.user.login == 'dependabot[bot]' | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| ref: ${{ github.head_ref }} | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - uses: pnpm/action-setup@v5 | ||
| with: | ||
| version: 9 | ||
|
|
||
| - uses: actions/setup-node@v6 | ||
| with: | ||
| node-version: "20" | ||
| cache: pnpm | ||
|
|
||
| - run: pnpm install --lockfile-only --no-frozen-lockfile | ||
|
|
||
| - name: Commit updated lockfile | ||
| run: | | ||
| git config user.name "github-actions[bot]" | ||
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||
| git add pnpm-lock.yaml | ||
| if ! git diff --cached --quiet; then | ||
| git commit -m "chore: update pnpm-lock.yaml" | ||
| git push origin HEAD:${{ github.head_ref }} | ||
| fi | ||
MidnightDesign marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.