Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
be405f8
refactor: replace GH_TOKEN with GitHub App token in workflow
BarkinKctp Mar 2, 2026
0710577
refactor: replace GH_TOKEN with GitHub App token in workflows
BarkinKctp Mar 14, 2026
79606b5
refactor: update GitHub App token variable name in workflows
BarkinKctp Mar 14, 2026
237d179
refactor: update GitHub App token usage for authentication in workflows
BarkinKctp Mar 14, 2026
a571e9b
refactor: update workflows and scripts to use GitHub App token for a…
BarkinKctp Mar 17, 2026
b1a0934
refactor: update build_packages to use GitHub App token for authentic…
BarkinKctp Apr 6, 2026
954e80f
testing with refactored branch
BarkinKctp Apr 6, 2026
9af51bf
testing with updated tools branch
BarkinKctp Apr 6, 2026
7c2b120
refactor: update scripts
BarkinKctp Apr 6, 2026
a112df9
Revert Changes
BarkinKctp Apr 17, 2026
59f119b
Checking token format
BarkinKctp Apr 17, 2026
a697215
update authorization header format to use Bearer token
BarkinKctp Apr 21, 2026
659838c
finding gitmodules
BarkinKctp Apr 21, 2026
c30c52b
feat: add debug logging for GITHUB_TOKEN and commit verification
BarkinKctp Apr 22, 2026
3a4cfe5
update GitHub API request to be compatible with app token
BarkinKctp Apr 22, 2026
4459c2d
change token type after changes
BarkinKctp Apr 22, 2026
38200a6
update GitHub API requests
BarkinKctp Apr 22, 2026
8a69115
add debug logging
BarkinKctp Apr 22, 2026
3ebd594
refactor: update GitHub token handling in workflows and scripts
BarkinKctp May 12, 2026
3e92f4a
resolve workflow conflicts: keep local versions
BarkinKctp May 12, 2026
a33ee0d
fix: update tools branch to use brk-test for cloning
BarkinKctp May 14, 2026
f72da81
refactor: streamline email and name determination logic in scripts
BarkinKctp May 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions .github/workflows/build-citus-community-nightlies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ env:
PACKAGE_CLOUD_API_TOKEN: ${{ secrets.PACKAGE_CLOUD_API_TOKEN }}
PACKAGING_PASSPHRASE: ${{ secrets.PACKAGING_PASSPHRASE }}
PACKAGING_SECRET_KEY: ${{ secrets.PACKAGING_SECRET_KEY }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
DOCKERHUB_USER_NAME: ${{ secrets.DOCKERHUB_USER_NAME }}
DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }}
on:
Expand Down Expand Up @@ -37,8 +36,25 @@ jobs:
- ubuntu/noble

steps:

- name: Create GitHub App token
id: app
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_KEY }}
owner: ${{ github.repository_owner }}

- name: Set GH_TOKEN for all steps
run: echo "GH_TOKEN=${{ steps.app.outputs.token }}" >> $GITHUB_ENV

- name: Checkout repository
uses: actions/checkout@v6
with:
token: ${{ steps.app.outputs.token }}

- name: Configure git with x-access-token
run: git config --global url."https://x-access-token:${{ steps.app.outputs.token }}@github.com/".insteadOf "https://github.com/"

# This step is to fetch the images unanonymously to have higher bandwidth
- name: Login to Docker Hub
Expand All @@ -48,7 +64,7 @@ jobs:
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Clone tools branch
run: git clone -b v0.8.35 --depth=1 https://github.com/citusdata/tools.git tools
run: git clone -b brk-test --depth=1 https://github.com/citusdata/tools.git tools

- name: Clone build branch
run: git clone -b "${MAIN_BRANCH}" --depth=1 https://github.com/citusdata/packaging.git packaging
Expand Down
46 changes: 27 additions & 19 deletions scripts/determine_email
Original file line number Diff line number Diff line change
@@ -1,29 +1,37 @@
#!/bin/bash

# make bash behave
set -uo pipefail
IFS=$'\n\t'

# constants
success=0
failure=1

# fallback to public email
email=$(curl -sf https://api.github.com/user | jq -r '.email // empty')
success=0; failure=1
email=""

# first try to find Microsoft email, if fails, then it must be the
# case that bots@citusdata.com is building nightly packages for us
jqfilter='map(select(.verified and (.email | test("@microsoft.com$|^bots@citusdata.com$")))) | first | .email // empty'
citusemail=$(curl -sf https://api.github.com/user/emails | jq -r "${jqfilter}")

if [ -n "${citusemail}" ]; then
email="${citusemail}"
# Primary: Build noreply address from workflow context (always available, no API call)
if [ -n "${GITHUB_ACTOR_ID:-}" ] && [ -n "${GITHUB_ACTOR:-}" ]; then
email="${GITHUB_ACTOR_ID}+${GITHUB_ACTOR}@users.noreply.github.com"
elif [ -n "${GITHUB_ACTOR:-}" ]; then
# Fallback if no ACTOR_ID: use actor login alone
email="${GITHUB_ACTOR}@users.noreply.github.com"
fi

if [ -z "${email}" ]; then
echo "$0: could not determine email" >&2
exit $failure
# Last resort: Try API if workflow context missing (shouldn't happen)
if [ -z "${email}" ] && [ -n "${GITHUB_TOKEN:-}" ] && [ -n "${GITHUB_ACTOR:-}" ]; then
user_json=$(curl -sf \
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
"https://api.github.com/users/${GITHUB_ACTOR}")

if [ -n "${user_json}" ]; then
# Try public profile email first
email=$(echo "${user_json}" | jq -r '.email // empty')
# If no public email, build noreply from API response
if [ -z "${email}" ]; then
actor_id=$(echo "${user_json}" | jq -r '.id // empty')
if [ -n "${actor_id}" ]; then
email="${actor_id}+${GITHUB_ACTOR}@users.noreply.github.com"
fi
fi
fi
fi

[ -z "${email}" ] && { echo "$0: could not determine email" >&2; exit $failure; }
echo "${email}"
exit $success
exit $success
25 changes: 15 additions & 10 deletions scripts/determine_name
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
#!/bin/bash

# make bash behave
set -euo pipefail
IFS=$'\n\t'

# constants
success=0
failure=1
success=0; failure=1
fullname=""

fullname=$(curl -sf https://api.github.com/user | jq -r '.name // empty')
# Primary: Use GITHUB_ACTOR directly (always available in GitHub Actions)
if [ -n "${GITHUB_ACTOR:-}" ]; then
fullname="${GITHUB_ACTOR}"
fi

if [ -z "${fullname}" ]; then
echo "$0: could not determine user name" >&2
exit $failure
# Fallback: Try API if GITHUB_ACTOR somehow unavailable (edge case)
if [ -z "${fullname}" ] && [ -n "${GITHUB_TOKEN:-}" ]; then
# This shouldn't happen in normal Actions, but keep for safety
actor="${GITHUB_ACTOR:-unknown}"
fullname=$(curl -sf \
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
"https://api.github.com/users/${actor}" | jq -r '.name // empty') || true
fi

[ -z "${fullname}" ] && { echo "$0: could not determine user name" >&2; exit $failure; }
echo "${fullname}"
exit $success
exit $success
Loading