October 2024 dependency updates #1
Workflow file for this run
This file contains 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
name: Update PR Title | |
on: | |
pull_request: | |
types: [opened, labeled] | |
jobs: | |
update-pr: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check and update PR title | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const author = context.payload.pull_request.user.login; | |
const labels = context.payload.pull_request.labels.map(label => label.name); | |
const isDependabot = author === 'erinesullivan'; | |
// const isDependabot = author === 'dependabot[bot]' || author === 'dependabot-preview[bot]'; | |
const hasInvalidLabel = labels.includes('invalid'); | |
if (isDependabot && hasInvalidLabel) { | |
const monthNames = [ | |
"January", "February", "March", "April", "May", "June", | |
"July", "August", "September", "October", "November", "December" | |
]; | |
const now = new Date(); | |
const month = monthNames[now.getMonth()]; | |
const year = now.getFullYear(); | |
const title = `${month} ${year} dependency updates.`; | |
await github.pulls.update({ | |
owner: context.repo.owner, | |
pull_number: context.payload.pull_request.number, | |
repo: context.repo.repo, | |
title: title | |
}); | |
} else { | |
console.log("Conditions not met for title update."); | |
} |