This repository has been archived by the owner on Jun 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5ad944a
commit db23d89
Showing
8 changed files
with
249 additions
and
126 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
# .github/scripts/changelog.sh | ||
# Generates a changelog based off the diff between $TAG and the previous sequential tag. | ||
|
||
# TAG: The new git tag the changelog is being generated for. | ||
|
||
# CI only script | ||
|
||
set -eo pipefail | ||
|
||
main() { | ||
|
||
echo "{}" > package.json | ||
TAG="$(git tag | sort --version-sort | tail -n 2 | head -n 1)" | ||
CHANGE_LOG_CONTENT="$(npx -q generate-changelog -f - -t "${TAG}")" | ||
|
||
{ | ||
echo "CHANGE_LOG_CONTENT<<EOF" | ||
echo "${CHANGE_LOG_CONTENT}" | ||
echo "EOF" | ||
} >> "$GITHUB_ENV" | ||
|
||
rm package.json | ||
|
||
} | ||
|
||
main "$@" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,19 @@ | ||
#!/bin/bash | ||
|
||
# Takes two text arguments | ||
# Message Format: <ARG1>: <ARG2> | ||
# .github/scripts/notifications.sh | ||
# Sends a notification to slack. | ||
|
||
[[ -z ${WEBHOOK_URL} ]] && exit 0 | ||
curl -X POST -H 'Content-type: application/json' --data "{\"text\":\"${1}: ${2}\"}" "${WEBHOOK_URL}" | ||
# 1: The branch information to display. | ||
# 2: The notification message to send. | ||
# WEBHOOK_URL: The slack webhook url to use. | ||
|
||
# CI only script. | ||
|
||
main() { | ||
|
||
[[ -z ${WEBHOOK_URL} ]] && exit 0 | ||
curl -X POST -H 'Content-type: application/json' --data "{\"text\":\"${1}: ${2}\"}" "${WEBHOOK_URL}" | ||
|
||
} | ||
|
||
main "$@" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
# .github/scripts/pushed_commit_range.sh | ||
# Retrieves the range of the commits in a push, and sets the PUSHED_COMMIT_RANGE environment variables. | ||
|
||
# GITHUB_CONTEXT: The github action context object as an environment variable. | ||
|
||
# CI only script | ||
|
||
set -eo pipefail | ||
|
||
|
||
get_all_commits() { | ||
git rev-list --max-parents=0 HEAD | ||
} | ||
|
||
|
||
main() { | ||
|
||
PUSHED_COMMIT_RANGE="HEAD~$(echo "$GITHUB_CONTEXT" | jq '.event.commits | length')" | ||
|
||
if [[ "${PUSHED_COMMIT_RANGE}" == "HEAD~0" ]]; then | ||
PUSHED_COMMIT_RANGE="$(get_all_commits)" | ||
fi | ||
|
||
set +e | ||
if ! git rev-parse "${PUSHED_COMMIT_RANGE}"; then | ||
PUSHED_COMMIT_RANGE="$(get_all_commits)" | ||
fi | ||
set -e | ||
|
||
{ | ||
echo "PUSHED_COMMIT_RANGE<<EOF" | ||
echo "${PUSHED_COMMIT_RANGE}" | ||
echo "EOF" | ||
} >> "$GITHUB_ENV" | ||
|
||
} | ||
|
||
main "$@" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,23 @@ | ||
#!/bin/bash | ||
|
||
# shellcheck disable=SC2129 | ||
# .github/scripts/setup.sh | ||
# Configures environment variables for Github Actions. | ||
|
||
# CI only script. | ||
|
||
set -eo pipefail | ||
|
||
main() { | ||
BRANCH_OR_TAG="$(echo "${GITHUB_REF}" | sed 's/refs\/heads\///g' | sed 's/refs\/tags\///g')" | ||
WORKFLOW_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" | ||
echo "BRANCH_OR_TAG=${BRANCH_OR_TAG}" >> "$GITHUB_ENV" | ||
echo "WEBHOOK_URL=${WEBHOOK_URL}" >> "$GITHUB_ENV" | ||
echo "NOTIFICATION=${PROJECT_NAME} [<${WORKFLOW_URL}|${BRANCH_OR_TAG}>]" >> "$GITHUB_ENV" | ||
|
||
{ | ||
echo "ANSIBLE_ROLES_PATH=.." | ||
echo "BRANCH_OR_TAG=${BRANCH_OR_TAG}" | ||
echo "WEBHOOK_URL=${WEBHOOK_URL}" | ||
echo "NOTIFICATION=${PROJECT_NAME} [<${WORKFLOW_URL}|${BRANCH_OR_TAG}>]" | ||
} >> "$GITHUB_ENV" | ||
|
||
} | ||
|
||
main | ||
main "$@" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
# .github/scripts/version.sh | ||
# Ensures the 'pyproject.toml' version matches the current Git Tag. | ||
|
||
# BRANCH_OR_TAG: The name of the current Git Branch or Tag. | ||
|
||
# CI only script. | ||
|
||
set -eo pipefail | ||
|
||
main() { | ||
pip install poetry | ||
|
||
if [[ "v$(poetry version -s)" != "${BRANCH_OR_TAG}" ]]; then | ||
echo "The 'pyproject.toml' file does not match the version tag!" | ||
exit 127 | ||
fi | ||
} | ||
|
||
main "$@" |
Oops, something went wrong.