Land #16448, Add in dependency updates PR action
This commit is contained in:
commit
a977d48508
|
@ -21,9 +21,10 @@ on:
|
|||
branches-ignore:
|
||||
- gh-pages
|
||||
- metakitty
|
||||
- weekly-dependency-updates
|
||||
pull_request:
|
||||
branches:
|
||||
- '*'
|
||||
branches-ignore:
|
||||
- weekly-dependency-updates
|
||||
|
||||
jobs:
|
||||
msftidy:
|
||||
|
|
|
@ -21,9 +21,10 @@ on:
|
|||
branches-ignore:
|
||||
- gh-pages
|
||||
- metakitty
|
||||
- weekly-dependency-updates
|
||||
pull_request:
|
||||
branches:
|
||||
- '*'
|
||||
branches-ignore:
|
||||
- weekly-dependency-updates
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
|
|
@ -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']
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue