Skip to content

Commit f5ae60a

Browse files
committed
add takT support - resolves #1
4b473df: update ready flow - #1 e5d4a77: flows actions and other settings - #1
1 parent 0549813 commit f5ae60a

File tree

10 files changed

+375
-7
lines changed

10 files changed

+375
-7
lines changed

.devcontainer/.gh_alias.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
workon: '!gh tt workon "$@"'
2+
wrapup: '!gh tt wrapup "$@"'
3+
deliver: '!gh tt deliver "$@"'
4+
responsibles: '!gh tt responsibles "$@"'
5+
semver: '!gh tt semver "$@"'

.devcontainer/devcontainer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
// "forwardPorts": [],
2828

2929
// Use 'postCreateCommand' to run commands after the container is created.
30-
// "postCreateCommand": "uname -a",
30+
"postCreateCommand": "./.devcontainer/postCreateCommand.sh",
3131

3232
// Configure tool-specific properties.
3333
"customizations": {
@@ -42,8 +42,10 @@
4242
"GitHub.copilot-chat"
4343
]
4444
}
45+
},
46+
"remoteEnv": {
47+
"GH_TOKEN": "${localEnv:GH_TOKEN}"
4548
}
46-
4749
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
4850
// "remoteUser": "root"
4951
}

.devcontainer/postCreateCommand.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,23 @@ set -eou pipefail
55
PREFIX="🍰 "
66
echo "$PREFIX Running $(basename $0)"
77

8+
# GitHub CLI Dependencies
9+
set +e
10+
gh auth status >/dev/null 2>&1
11+
AUTH_OK=$?
12+
set -e
13+
if [ $AUTH_OK -ne 0 ]; then
14+
echo "$PREFIX ⚠️ Not logged into GitHub CLI"
15+
echo "$PREFIX This is not looking good — we want GitHub CLI to work!"
16+
else
17+
echo "$PREFIX ✅ GitHub Authentication is working smooth!"
18+
gh extension install devx-cafe/gh-tt
19+
echo "$PREFIX ✅ Installed the TakT gh cli extension from devx-cafe/gh-tt "
20+
gh alias import .devcontainer/.gh_alias.yml --clobber
21+
echo "$PREFIX ✅ Installed the gh shorthand aliases"
22+
23+
fi
24+
825
git config --global --add safe.directory $(pwd)
926
echo "$PREFIX ✅ Setting up safe git repository to prevent dubious ownership errors"
1027

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Prep-runner
2+
description: Sets the GitHub workflow to do what we need
3+
4+
inputs:
5+
verify:
6+
description: Script to run to verify the environment is set up correctly. If not provided, no verification will be done.
7+
required: false
8+
9+
runs:
10+
using: composite
11+
steps:
12+
- name: Set up Node.js
13+
uses: actions/setup-node@v4
14+
with:
15+
node-version: "20"
16+
17+
# Install npm packages required by .githooks/pre-commit
18+
- name: Install linting and checker tools
19+
shell: bash
20+
run: npm install -g cspell markdownlint-cli2 @cspell/dict-da-dk prettier
21+
22+
- name: Verify environment
23+
if: ${{ inputs.verify }}
24+
shell: bash
25+
run: ${{ inputs.verify }}
26+

.github/workflows/ready.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Ready
2+
# This workflow is triggered by 'ready' branches
3+
4+
on:
5+
workflow_dispatch:
6+
push:
7+
branches:
8+
- "ready/**"
9+
10+
jobs:
11+
trunk-worthy:
12+
name: Check trunk worthyness
13+
runs-on: ubuntu-latest
14+
env:
15+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16+
permissions:
17+
contents: read
18+
statuses: write
19+
20+
steps:
21+
- name: Checkout
22+
uses: actions/checkout@v6
23+
24+
- name: Mark pending
25+
run: ./.scripts/trunk-worthy mark-pending
26+
27+
- name: Set up runner environment
28+
uses: ./.github/actions/prep-runner
29+
with:
30+
verify: ./.scripts/trunk-worthy
31+
32+
# At this point we only duplicated the wrapup flow.
33+
# Add all additional jobs you want to run on the ready branch before the merge-to-trunk job
34+
# and make merge-to-trunk depend on them (like it depends on trunk-worthy) to ensure they run before the merge.
35+
36+
37+
merge-to-trunk:
38+
name: Merge to trunk
39+
runs-on: ubuntu-latest
40+
needs: trunk-worthy
41+
env:
42+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
permissions:
44+
pull-requests: write
45+
issues: write
46+
contents: write
47+
48+
steps:
49+
50+
# Not sue what goes on here? Whre did the secret come from?
51+
# check *./docs/ready-pusher.md' for more details on how to set up and use this workflow
52+
- uses: actions/checkout@v6
53+
with:
54+
fetch-depth: 0 # Fetch full history to ensure we can merge and push
55+
token: ${{ secrets.READY_PUSHER }} # PAT with content:write (can not use secrets.GITHUB_TOKEN as it is a special case, it does not trigger other workflows on push)
56+
57+
- uses: devx-cafe/takt-actions/ready-to-trunk@v1
58+
# with: #Uncomment if you want to override any of the default inputs
59+
# target_branch: #default is main
60+
# user_name: #default is "Ready Pusher Bot"
61+
# user_email: #default is "ready-pusher@${{ github.repository_owner }}.github.com"
62+
# delete_dev_branch: false # default is true
63+
# delete_ready_branch: false # default is true
64+
# close_pr: false # default is true
65+
# close_issue: false # default is true

.github/workflows/release.yml

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '[0-9]+.[0-9]+.[0-9]+' # Matches Core SemVer versions - without a prefix: 0.9.0, 1.2.3
7+
- '[a-zA-Z]+[0-9]+.[0-9]+.[0-9]+' # Matches Core SemVer versions - with a prefix: v1.0.0, ver1.0.0, RC1.0.0
8+
- '[0-9]+.[0-9]+.[0-9]+*' # Matches Build and Prerelease SemVer versions - without a prefix: 0.9.0+1.03ed4d1, 0.9.0-alpha1, 0.9.0-alpha1+1.03ed4d1
9+
- '[a-zA-Z]+[0-9]+.[0-9]+.[0-9]+*' # Matches Build and Prerelease SemVer versions - with a prefix: v0.9.0+1.03ed4d1, ver0.9.0-alpha1, RC0.9.0-alpha1+1.03ed4d1
10+
11+
workflow_dispatch:
12+
inputs:
13+
tag:
14+
description: "Tag to release (e.g., v1.0.0 or 1.0.0)"
15+
required: true
16+
type: string
17+
18+
jobs:
19+
release:
20+
runs-on: ubuntu-latest
21+
permissions:
22+
contents: write
23+
24+
steps:
25+
- uses: actions/checkout@v6
26+
with:
27+
ref: ${{ github.event.inputs.tag || github.ref }}
28+
fetch-depth: 0 # Fetch full history (needed for release notes generation)
29+
fetch-tags: true # Ensure tags are fetched (needed for release notes generation)
30+
31+
- name: Determine release type
32+
id: release_type
33+
run: |
34+
TAG="${{ github.event.inputs.tag || github.ref_name }}"
35+
# Check if tag contains prerelease markers (- or +) after SemVer core
36+
# Lines 5-6 in trigger: [0-9]+.[0-9]+.[0-9]+* and [a-zA-Z]+[0-9]+.[0-9]+.[0-9]+*
37+
if [[ $TAG =~ ^[a-zA-Z]*[0-9]+\.[0-9]+\.[0-9]+([-]) ]]; then
38+
echo "is_prerelease=true" >> $GITHUB_OUTPUT
39+
echo "is_draft=false" >> $GITHUB_OUTPUT
40+
echo "Release type: PRERELEASE"
41+
elif [[ $TAG =~ ^[a-zA-Z]*[0-9]+\.[0-9]+\.[0-9]+([+]) ]]; then
42+
echo "is_prerelease=false" >> $GITHUB_OUTPUT
43+
echo "is_draft=true" >> $GITHUB_OUTPUT
44+
echo "Release type: DRAFT"
45+
else
46+
echo "is_prerelease=false" >> $GITHUB_OUTPUT
47+
echo "is_draft=false" >> $GITHUB_OUTPUT
48+
echo "Release type: STABLE"
49+
fi
50+
51+
- name: Create release notes
52+
id: release_notes
53+
env:
54+
GITHUB_TOKEN: ${{ github.token }}
55+
run: |
56+
gh ext install devx-cafe/gh-tt
57+
mkdir -p .tmp/release
58+
gh tt semver note --filename .tmp/release/RELEASENOTES.md
59+
echo "Generating release notes..."
60+
cat .tmp/release/RELEASENOTES.md >> $GITHUB_STEP_SUMMARY
61+
62+
63+
# Build the release assets - and collects the "packkage". to release
64+
- name: collect artifacts
65+
run: |
66+
mkdir -p .tmp/release
67+
cp ./README.md .tmp/release/
68+
69+
# Nice to have a version.txt in the release assets, so we know what commit and tag the release was built from
70+
- name: version.txt
71+
run: |
72+
mkdir -p .tmp/release
73+
echo "Build from ${{ github.repository }}" > .tmp/release/version.txt
74+
echo "Tag: ${{ github.ref_name }}" >> .tmp/release/version.txt
75+
echo "Commit: ${{ github.sha }}" >> .tmp/release/version.txt
76+
77+
# Package the release assets - in this case we just tar.gz the release folder,
78+
# but you should design it to any packaging needed for the specific project
79+
- name: Package release assets
80+
run: |
81+
mkdir -p .tmp/release
82+
TAG="${{ github.event.inputs.tag || github.ref_name }}"
83+
tar -czf ".tmp/takt-actions-${TAG}.tar.gz" -C .tmp/release .
84+
85+
# This files are "flattend" in the release, so If you need to keep the folder structure,
86+
# you should create an archive (tar ball) ...wi did that in the previous step, so now we just need
87+
# to upload the archive as the release asset
88+
- name: Create Release
89+
uses: softprops/action-gh-release@v1
90+
with:
91+
tag_name: ${{ github.event.inputs.tag || github.ref_name }}
92+
files: |
93+
./.tmp/takt-actions-${{ github.event.inputs.tag || github.ref_name }}.tar.gz
94+
./.tmp/release/version.txt
95+
body_path: .tmp/release/RELEASENOTES.md
96+
draft: ${{ steps.release_type.outputs.is_draft }}
97+
prerelease: ${{ steps.release_type.outputs.is_prerelease }}
98+
token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/stage.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Stage
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
stage-deploy:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v6
13+
14+
- name: Mark the spot for stage deployment
15+
run: |
16+
echo "Stage deployment placeholder - ready for implementation"
17+
echo "Stage deployment placeholder - ready for implementation" >> $GITHUB_STEP_SUMMARY
18+
echo "go to \`.github/workflows/stage.yml\` and fill in the blanks..." >> .stage_deploy_placeholder
19+
20+
# A blank sheet!
21+
# Excited to see what yopu come up with!

.github/workflows/wrapup.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: wrapup
2+
on:
3+
workflow_dispatch:
4+
5+
push:
6+
branches:
7+
- "[0-9]*" # Isue branches
8+
- "copilot/*" # Copilot running in Agentic mode pushes branches with this prefix as default
9+
10+
concurrency:
11+
group: "wrapup"
12+
cancel-in-progress: false
13+
14+
15+
jobs:
16+
trunk-worthy:
17+
name: Check trunk worthyness
18+
runs-on: ubuntu-latest
19+
env:
20+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21+
permissions:
22+
contents: read
23+
statuses: write
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v6
28+
29+
- name: Mark pending
30+
run: ./.scripts/trunk-worthy mark-pending
31+
32+
- name: Set up runner environment
33+
uses: ./.github/actions/prep-runner
34+
35+
- name: Test trunk worthyness - mark statusses
36+
run: ./.scripts/trunk-worthy

.scripts/trunk-worthy

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ get_display_name() {
8484

8585
# Function to mark all checks as pending in GitHub Actions
8686
mark_pending_statuses() {
87-
gh extension install lakruzz/gh-set-status
87+
gh ext list | grep "lakruzz/gh-set-status" || gh extension install lakruzz/gh-set-status > /dev/null 2>&1 || true
8888

8989
for check in "${CHECK_NAMES[@]}"; do
9090
gh set-status pending "$(get_display_name $check) check" "$check"
@@ -130,12 +130,14 @@ print_status() {
130130

131131
# Be more verbose in GitHub Actions and set the status for each check
132132
if [ "$GITHUB_ACTION_RUN" -eq 1 ]; then
133+
gh ext list | grep "lakruzz/gh-set-status" || gh extension install lakruzz/gh-set-status > /dev/null 2>&1 || true
134+
133135
if [ "${CHECK_STATUS[$name]}" -eq 0 ]; then
134136
gh set-status success "$(get_display_name $name) check passed" "$name"
135-
echo " $(get_display_name $name) check passed" >> $GITHUB_STEP_SUMMARY
137+
echo " $(get_display_name $name) check passed" >> $GITHUB_STEP_SUMMARY
136138
else
137139
gh set-status failure "$(get_display_name $name) check failed" "$name"
138-
echo " $(get_display_name $name) check failed" >> $GITHUB_STEP_SUMMARY
140+
echo " $(get_display_name $name) check failed" >> $GITHUB_STEP_SUMMARY
139141
fi
140142
fi
141143
}
@@ -152,7 +154,7 @@ show_error() {
152154
# Be more verbose in GitHub Actions and show check output in summary
153155
if [ "$GITHUB_ACTION_RUN" -eq 1 ]; then
154156
if [ "${CHECK_STATUS[$name]}" -ne 0 ]; then
155-
echo " $(get_display_name $name) check output:" >> $GITHUB_STEP_SUMMARY
157+
echo " $(get_display_name $name) check output:" >> $GITHUB_STEP_SUMMARY
156158
cat "${CHECK_OUT[$name]}" >> $GITHUB_STEP_SUMMARY
157159
fi
158160
fi
@@ -297,4 +299,4 @@ else
297299
echo "👉 Fix the issues above before committing."
298300
echo "💡 You can run the same checks manually with: '.githooks/pre-commit'"
299301
exit 1
300-
fi
302+
fi

0 commit comments

Comments
 (0)