testing issue 2214 #115
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
# Below are the full description for the shorten job names: | |
# | |
# ce - cactus-example | |
# cp - cactus-plugin | |
# cpk - cactus-plugin-keychain | |
# cpl - cactus-plugin-ledger | |
# cplc - cactus-plugin-ledger-connector | |
# plc - plugin-ledger-connector | |
# cpp - cactus-plugin-persistence | |
# ct - cactus-test | |
# ctp - cactus-test-plugin | |
--- | |
env: | |
NODEJS_VERSION: v18.18.2 | |
RUN_TRIVY_SCAN: true | |
PR_BODY: ${{ github.event.pull_request.body }} | |
BEFORE_REF: ${{ github.event.before }} | |
AFTER_REF: ${{ github.event.after }} | |
#COMMIT_MSG: ${{ github.event.pull_request.base.sha }} | |
jobs: | |
PR-desc-and-commit-msg-checker: | |
runs-on: ubuntu-22.04 | |
permissions: | |
# this permission should be set to be able use secrets.GITHUB_TOKEN | |
id-token: write | |
# not sure if this permission is necessary, just didn't try to remove it when testing | |
contents: read | |
# this permission should be set to be able get commits data by curl request | |
pull-requests: read | |
steps: | |
- name: Get commits | |
env: | |
# github URL to list commits | |
COMMITS_URL: ${{ github.event.pull_request.commits_url }} | |
run: | | |
if [ "${COMMITS_URL}x" != "x" ]; then | |
# get commits list and pick up last one by jq | |
# caution: only 100 commits will be taken by curl | |
# if your PR has more than 100 commits | |
# you have to set page query parameter | |
# and request last page commits | |
# API URL details: https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#list-commits-on-a-pull-request | |
LAST_MSG=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "${COMMITS_URL}?per_page=100" | jq -r .[-1].commit.message) | |
# set environment variable | |
echo "LAST_MSG=${LAST_MSG}" >> "${GITHUB_ENV}" | |
else | |
echo 'LAST_MSG=' >> "${GITHUB_ENV}" | |
fi | |
echo "PR desc: ${PR_BODY}" | |
name: Cactus_CI | |
'on': | |
pull_request: | |
branches: | |
- main | |
- dev | |
- petermetz/** | |
types: | |
- edited | |
- opened | |
- synchronize | |
push: | |
branches: | |
- main | |
- dev |