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: add dependabot integration #1414

Merged
merged 1 commit into from
Sep 28, 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
22 changes: 22 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
labels:
- "node_modules"
- "no-test"
groups:
eslint:
patterns:
- "eslint*"
esbuild:
patterns:
- "esbuild*"
stylelint:
patterns:
- "stylelint*"
patternfly:
patterns:
- "@patternfly*"
83 changes: 83 additions & 0 deletions .github/workflows/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Update node_modules
on:
pull_request_target:
types: [opened, reopened, synchronize, labeled]
martinpitt marked this conversation as resolved.
Show resolved Hide resolved

jobs:
dependabot:
environment: npm-update
permissions:
contents: read
pull-requests: write
timeout-minutes: 5
# 22.04's podman has issues with piping and causes tar errors
runs-on: ubuntu-20.04
if: ${{ contains(github.event.pull_request.labels.*.name, 'node_modules') }}

steps:
- name: Clone repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
fetch-depth: 0

- name: Clear node_modules label
uses: actions/github-script@v6
with:
script: |
try {
await github.rest.issues.removeLabel({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
name: 'node_modules'
});
} catch (e) {
if (e.name == 'HttpError' && e.status == 404) {
/* expected: 404 if label is unset */
} else {
throw e;
}
}

- name: Update node_modules for package.json changes
run: |
make tools/node-modules
git config --global user.name "GitHub Workflow"
git config --global user.email "[email protected]"
eval $(ssh-agent)
ssh-add - <<< '${{ secrets.NODE_CACHE_DEPLOY_KEY }}'
./tools/node-modules install
./tools/node-modules push
git add node_modules
ssh-add -D
ssh-agent -k

- name: Clear no-test label
martinpitt marked this conversation as resolved.
Show resolved Hide resolved
uses: actions/github-script@v6
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;
}
}

- name: Force push node_modules update
run: |
git commit --amend --no-edit node_modules
eval $(ssh-agent)
ssh-add - <<< '${{ secrets.SELF_DEPLOY_KEY }}'
git push --force '[email protected]:${{ github.repository }}' '${{ github.head_ref }}'
ssh-add -D
ssh-agent -k
Loading