Skip to content

RUSTSEC-2024-0320: yaml-rust is unmaintained. #585

RUSTSEC-2024-0320: yaml-rust is unmaintained.

RUSTSEC-2024-0320: yaml-rust is unmaintained. #585

name: Auto Bump Versions
on:
issue_comment:
types: [created, edited]
jobs:
add-same-version-label-to-pr:
runs-on: ubuntu-latest
if: github.event.issue.pull_request && contains(github.event.comment.body, '/add-same-version-label')
steps:
- uses: actions/checkout@v3
- name: Add same version label
uses: actions/github-script@v6
if: success()
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['same version']
})
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '👋 Added [same version] label :)!'
})
build:
if: ${{ github.event.issue.pull_request }} && contains(github.event.comment.body, '/version')
runs-on: ubuntu-latest
steps:
- name: Get PR details
uses: actions/github-script@v6
id: get-pr
with:
script: |
const request = {
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number
}
core.info(`Getting PR #${request.pull_number} from ${request.owner}/${request.repo}`)
try {
const result = await github.rest.pulls.get(request)
return result.data
} catch (err) {
core.setFailed(`Request failed with error ${err}`)
}
- name: Checkout PR
uses: actions/checkout@v3
with:
repository: ${{ fromJSON(steps.get-pr.outputs.result).head.repo.full_name }}
ref: ${{ fromJSON(steps.get-pr.outputs.result).head.ref }}
- name: Update version minor
if: contains(github.event.comment.body, '/version minor')
run: |
./version.sh -u -n
echo "BUMP_TYPE=minor" >> $GITHUB_ENV
- name: Update version major
if: contains(github.event.comment.body, '/version major')
run: |
./version.sh -u -m
echo "BUMP_TYPE=major" >> $GITHUB_ENV
- name: Update version patch
if: contains(github.event.comment.body, '/version patch')
run: |
./version.sh -u -p
echo "BUMP_TYPE=patch" >> $GITHUB_ENV
- name: Add labels
uses: actions/github-script@v6
if: ${{ env.BUMP_TYPE }}
with:
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['version/${{ env.BUMP_TYPE }}']
})
- name: Push Changes
if: ${{ env.BUMP_TYPE }}
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
git pull
git add .
git commit -m "Update ${{ env.BUMP_TYPE }} version" --signoff
git push