Skip to content

Commit

Permalink
Allow for a control issue to let us know when CI's failing (#86)
Browse files Browse the repository at this point in the history
* Allow for a control issue to let us know when CI's failing

* Act on self-review: simplify review
  • Loading branch information
paulo-ferraz-oliveira committed Mar 9, 2024
1 parent 6a3789c commit 551eb81
Showing 1 changed file with 31 additions and 13 deletions.
44 changes: 31 additions & 13 deletions .github/workflows/up_ex_doc_version.yml
Expand Up @@ -11,22 +11,29 @@ jobs:
name: Update ex_doc version
runs-on: ubuntu-latest
strategy:
strategy:
max-parallel: 1
matrix:
pair:
triplet:
- otp: '24'
elixir: '1.13'
rebar3: '3.22'
- otp: '25'
elixir: '1.14'
rebar3: '3.22'
- otp: '26'
elixir: '1.15'
rebar3: '3.22'
- otp: '27.0-rc1'
elixir: '1.16'
rebar3: '3.22'
steps:
- uses: actions/checkout@v4
- uses: erlef/setup-beam@v1
with:
otp-version: ${{matrix.pair.otp}}
elixir-version: ${{matrix.pair.elixir}}
otp-version: ${{matrix.triplet.otp}}
elixir-version: ${{matrix.triplet.elixir}}
rebar3-version: ${{matrix.triplet.rebar3}}
- run: |
CURR=$(curl -s https://hex.pm/api/packages/ex_doc | jq -r '.latest_stable_version')
TITLE="[automation] Update \`ex_doc\` to ${CURR}"
Expand Down Expand Up @@ -56,17 +63,28 @@ jobs:
mix deps.unlock ex_doc
mix deps.get
if ! git diff --exit-code 1> /dev/null ; then
echo "There's stuff to push. Creating a pull request..."
git add .
git commit -m "${TITLE}"
git push origin "$BRANCH"
gh pr create --fill \
--title "${TITLE}" \
--body "This is an automated action to update \`ex_doc\` to version ${CURR}"
set +e
rebar3 do dialyzer, ct
UP_EX_DOC_VERSION_CONTROL_ISSUE=85
if [ $? -ne 0 ]; then
gh issue reopen "${UP_EX_DOC_VERSION_CONTROL_ISSUE}" || true
gh issue edit "${UP_EX_DOC_VERSION_CONTROL_ISSUE}" -t "[automation] Workflow \`up_ex_doc_version\` failed" -b "Something's wrong with workflow \`up_ex_doc_version\`. Check [this](/${GITHUB_REPOSITORY}/actions/workflows/up_ex_doc_version.yml)."
exit 1
else
echo "Nothing to push. Is \`ex_doc\` already at version ${CURR}?"
set -e
gh issue close "${UP_EX_DOC_VERSION_CONTROL_ISSUE}" || true
if ! git diff --exit-code 1> /dev/null ; then
echo "There's stuff to push. Creating a pull request..."
git add .
git commit -m "${TITLE}"
git push origin "$BRANCH"
gh pr create --fill \
--title "${TITLE}" \
--body "This is an automated action to update \`ex_doc\` to version ${CURR}"
else
echo "Nothing to push. Is \`ex_doc\` already at version ${CURR}?"
fi
fi
else
echo " ... found! Bailing out..."
Expand Down

0 comments on commit 551eb81

Please sign in to comment.