Skip to content
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

.github: set [no-test] prefix for dependabot PR's #1429

Merged
merged 1 commit into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ updates:
directory: "/"
schedule:
interval: "daily"
commit-message:
prefix: "[no-test]"
labels:
- "node_modules"
- "no-test"
groups:
eslint:
patterns:
Expand Down
33 changes: 16 additions & 17 deletions .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Update node_modules
name: update node_modules
on:
pull_request_target:
types: [opened, reopened, synchronize, labeled]
Expand Down Expand Up @@ -54,28 +54,27 @@ jobs:
ssh-add -D
ssh-agent -k

- name: Clear no-test label
- name: Clear [no-test] prefix from PR title
if: ${{ contains(github.event.pull_request.title, '[no-test]') }}
uses: actions/github-script@v6
env:
TITLE: '${{ github.event.pull_request.title }}'
with:
script: |
try {
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
name: 'no-test'
});
} catch (e) {
if (e.name == 'HttpError' && e.status == 404) {
/* expected: 404 if label is unset */
} else {
throw e;
}
}
const title = process.env['TITLE'].replace(/\[no-test\]\W+ /, '')
await github.rest.pulls.update({
martinpitt marked this conversation as resolved.
Show resolved Hide resolved
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
title,
});

- name: Force push node_modules update
run: |
git commit --amend --no-edit node_modules
# Dependabot prefixes the commit with [no-test] which we don't want to keep in the commit
title=$(git show --pretty="%s" -s | sed -E "s/\[no-test\]\W+ //")
body=$(git show -s --pretty="%b")
git commit --amend -m "${title}" -m "${body}" --no-edit node_modules
eval $(ssh-agent)
ssh-add - <<< '${{ secrets.SELF_DEPLOY_KEY }}'
git push --force '[email protected]:${{ github.repository }}' '${{ github.head_ref }}'
Expand Down
Loading