Skip to content

Commit

Permalink
gh: tests: use linked tag instead of branch in notif
Browse files Browse the repository at this point in the history
To be able to save the cache, we need to use branches instead of tags.
But for the notif, it might be better to use the tag
(export/20240308T121027), not just the branch (export).

While at it, use the full check of the ref (just in case 'export' or
'export-net' tags are used), and put the URL at the end on IRC (not nice
output when the URL got a preview).

Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
  • Loading branch information
matttbe committed Mar 8, 2024
1 parent 1a40f97 commit 5b925de
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,19 +159,34 @@ jobs:
done
echo "url=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> ${GITHUB_OUTPUT}
- name: get linked tag
if: github.ref == 'refs/heads/export' || github.ref == 'refs/heads/export-net'
id: tag
run: |
TAG=$(curl ${CURL_OPT} -H "${CURL_ACC}" -H "${CURL_AUTH}" "${URL}" | jq -r ".[] | select(.object.sha == \"${SHA}\").ref" | tail -n1)
echo "Found: ${TAG} (${SHA} - ${BRANCH})"
TAG="${TAG:10}"
echo "tag=${TAG:-${BRANCH}}" >> ${GITHUB_OUTPUT}
env:
CURL_AUTH: "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}"
URL: "${{ env.URI }}/repos/${{ github.repository }}/git/matching-refs/tags/"
SHA: "${{ github.sha }}"
BRANCH: "${{ github.ref_name }}"

- name: irc tests
if: github.ref_name == 'export' || github.ref_name == 'export-net'
if: github.ref == 'refs/heads/export' || github.ref == 'refs/heads/export-net'
uses: rectalogic/notify-irc@v2
with:
server: irc.libera.chat
channel: "#mptcp-ci"
nickname: gh-tests-bot
verbose: true
message: |-
New GH Actions Tests job validating ${{ github.ref_name }} (by ${{ github.actor }}) just ended: ${{ steps.test.outputs.url }}
New GH Actions Tests job validating ${{ steps.tag.outputs.tag }} (by ${{ github.actor }}) just ended:
- ${{ steps.test.outputs.ccl_normal }}
- ${{ steps.test.outputs.ccl_debug }}
- ${{ steps.test.outputs.ccl_btf }}
- Task: ${{ steps.test.outputs.url }}
- name: get commit info
id: commit
Expand Down

0 comments on commit 5b925de

Please sign in to comment.