Land #16448, Add in dependency updates PR action

This commit is contained in:
Grant Willcox 2022-04-15 17:08:03 -05:00
commit a977d48508
No known key found for this signature in database
GPG Key ID: D35E05C0F2B81E83
3 changed files with 65 additions and 4 deletions

View File

@ -21,9 +21,10 @@ on:
branches-ignore:
- gh-pages
- metakitty
- weekly-dependency-updates
pull_request:
branches:
- '*'
branches-ignore:
- weekly-dependency-updates
jobs:
msftidy:

View File

@ -21,9 +21,10 @@ on:
branches-ignore:
- gh-pages
- metakitty
- weekly-dependency-updates
pull_request:
branches:
- '*'
branches-ignore:
- weekly-dependency-updates
jobs:
build:

View File

@ -0,0 +1,59 @@
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
permissions:
actions: none
checks: none
contents: none
deployments: none
id-token: none
# This action can update/close issues
issues: write
discussions: none
packages: none
pages: none
pull-requests: write
repository-projects: none
security-events: none
statuses: none
on:
push:
branches:
- weekly-dependency-updates
paths:
- 'Gemfile.lock'
name: Weekly dependency PR workflow
jobs:
create-pull-request:
runs-on: ubuntu-latest
steps:
- name: Create Pull Request
uses: actions/github-script@v6
with:
script: |
const { repo, owner } = context.repo;
const hasPR = await github.rest.pulls.list({
owner,
repo,
head: '${{ github.ref_name }}'
});
if (Array.isArray(hasPR.data) && !hasPR.data.length) {
const result = await github.rest.pulls.create({
title: 'Weekly dependency updates',
owner,
repo,
head: '${{ github.ref_name }}',
base: 'master',
body: [
'This PR is auto-generated by [actions/github-script](https://github.com/actions/github-script). ',
'`bundle update` revealed the following gems have new version to be evaluated for update.'
].join('\n')
});
github.rest.issues.addLabels({
owner,
repo,
issue_number: result.data.number,
labels: ['automation', 'rn-no-release-notes']
});
}