Skip to content

Check Ruby Version and Open New Issue on Change #318

Check Ruby Version and Open New Issue on Change

Check Ruby Version and Open New Issue on Change #318

name: Check Ruby Version and Open New Issue on Change
on:
workflow_run:
workflows: ["Check Github Pages Gem Version and Open New Issue on Change"]
types:
- completed
workflow_dispatch:
jobs:
check-ruby-version:
runs-on: ubuntu-latest
steps:
- name: Check out Daniel Ridge repo
uses: actions/checkout@v4
- name: Set ENV variable for current Ruby version number
run: echo "RUBY_CURRENT_VERSION=$(cat release-versions/ruby.txt)" >> $GITHUB_ENV
- name: Fetch Ruby release version and save in ENV variable
run: echo "RUBY_RELEASE_VERSION=$(curl -sL https://pages.github.com/versions.json | jq -r '."ruby"')" >> $GITHUB_ENV
- name: Write release version to text file
run: |
echo ${{ env.RUBY_RELEASE_VERSION }} > release-versions/ruby.txt
- name: Check for modified files
id: git-check
run: |
if [ -z "$(git status --porcelain)" ]; then
echo "modified=false" >> $GITHUB_ENV
else
echo "modified=true" >> $GITHUB_ENV
fi
- name: Commit latest Ruby release version
if: env.modified == 'true'
run: |
git config --global user.name 'Daniel Ridge'
git config --global user.email '[email protected]'
git commit -am "New release version"
git push
- name: Create issue to update Ruby
if: env.modified == 'true'
run: 'gh issue create
--repo github.com/hackforla/ops
--title "GHPAGES-DOCKER needs to be updated"
--body "GitHub Pages is now using **v${{ env.RUBY_RELEASE_VERSION }}** of Ruby. You are using **v${{ env.RUBY_CURRENT_VERSION }}**. Please refer to the [ghpages-docker Wiki](https://github.com/hackforla/ghpages-docker/wiki#how-do-you-update-ghpages-docker) for instructions on how to update."
--label "feature: maintenance,feature: docker,role: Site Reliability Engineer,size: 0.5pt"'
env:
GH_TOKEN: ${{ secrets.DR_PAT }}