release: season 6 and mining pass decay #88
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: Auto PR | |
on: | |
push: | |
branches: | |
- staging | |
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 title = '[Auto] Staging to main'; | |
const {data:openPRs} = await await github.rest.pulls.list({ | |
owner, | |
repo | |
}); | |
const previouslyOpenedAutoPR = openPRs.filter(({title:_title}) => _title.includes(title)); | |
if(previouslyOpenedAutoPR.length === 1) { | |
const pull_number = previouslyOpenedAutoPR[0].number; | |
await github.rest.pulls.update({ | |
title, | |
owner, | |
repo, | |
pull_number, | |
head: '${{ github.ref_name }}', | |
base: 'main', | |
body: [ | |
'This PR is auto-generated and updated by', | |
'[actions/github-script](https://github.com/actions/github-script).' | |
].join('\n') | |
}); | |
return; | |
} | |
const result = await github.rest.pulls.create({ | |
title, | |
owner, | |
repo, | |
head: '${{ github.ref_name }}', | |
base: 'main', | |
body: [ | |
'This PR is auto-generated by', | |
'[actions/github-script](https://github.com/actions/github-script).' | |
].join('\n') | |
}); | |
github.rest.issues.addLabels({ | |
owner, | |
repo, | |
issue_number: result.data.number, | |
labels: ['automated'] | |
}); |