Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 0 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ jobs:
with:
key: ${{ matrix.build.target }}
save-if: false
- name: Configure git auth
run: git config --global url."https://x-access-token:${{ secrets.GH_PAT }}@github.com/".insteadOf "https://github.com/"
- name: Build release binary
run: cargo build --locked --release --target ${{ matrix.build.target }} -p ${{ env.PACKAGE }}
- run: strip target/${{ matrix.build.target }}/release/${{ env.PACKAGE }}
Expand Down Expand Up @@ -201,8 +199,6 @@ jobs:
TAG="${RELEASE_TAG}"
gh release upload "$TAG" artifacts/* --clobber

- name: Configure git auth
run: git config --global url."https://x-access-token:${{ secrets.GH_PAT }}@github.com/".insteadOf "https://github.com/"
- name: Build release signer
run: cargo build --release -p tempo-sign

Expand Down
38 changes: 28 additions & 10 deletions .github/workflows/changelog-generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ on:

concurrency: ${{ github.workflow }}-${{ github.event.number }}

permissions:
contents: write
pull-requests: write
permissions: {}

jobs:
generate:
if: startsWith(github.event.label.name, 'changelog:')
runs-on: ubuntu-latest
environment: release
permissions: {}
steps:
- name: Determine PR source
id: source
Expand Down Expand Up @@ -45,13 +45,26 @@ jobs:
fi
echo "ref=$REF" >> "$GITHUB_OUTPUT"

- name: Mint scoped app token
if: steps.source.outputs.same_repo == 'true'
id: app-token
uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
with:
app-id: ${{ secrets.RELEASE_BOT_APP_ID }}
private-key: ${{ secrets.RELEASE_BOT_PRIVATE_KEY }}
owner: tempoxyz
repositories: wallet
permission-contents: write
permission-pull-requests: write
permission-metadata: read

- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
if: steps.source.outputs.same_repo == 'true'
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
token: ${{ secrets.GH_PAT }}
token: ${{ steps.app-token.outputs.token }}
persist-credentials: false

- name: Fetch base branch for diff comparison
Expand All @@ -61,10 +74,6 @@ jobs:
run: |
git fetch origin "$BASE_REF"

- name: Configure git credentials for private dependencies
if: steps.source.outputs.same_repo == 'true'
run: git config --global url."https://x-access-token:${{ secrets.GH_PAT }}@github.com/".insteadOf "https://github.com/"

- name: Check for existing changelog
if: steps.source.outputs.same_repo == 'true'
id: existing
Expand Down Expand Up @@ -140,16 +149,25 @@ jobs:
if: steps.source.outputs.same_repo == 'true' && steps.existing.outputs.found == 'false'
env:
VALIDATED_REF: ${{ steps.ref.outputs.ref }}
APP_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add .changelog/
git commit -m "chore: add changelog"
git push origin "HEAD:${VALIDATED_REF}"
git push "https://x-access-token:${APP_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" "HEAD:${VALIDATED_REF}"

pr-feedback:
name: PR feedback
needs: generate
if: always() && startsWith(github.event.label.name, 'changelog:')
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Comment for fork PRs
if: steps.source.outputs.same_repo != 'true'
if: github.event.pull_request.head.repo.full_name != github.repository
env:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ github.event.number }}
Expand Down
28 changes: 18 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,43 @@ env:
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
environment: release
permissions: {}
steps:
- name: Mint scoped app token
id: app-token
uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1
with:
app-id: ${{ secrets.RELEASE_BOT_APP_ID }}
private-key: ${{ secrets.RELEASE_BOT_PRIVATE_KEY }}
owner: tempoxyz
repositories: wallet
permission-contents: write
permission-pull-requests: write
permission-metadata: read

- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
token: ${{ secrets.GH_PAT }}
token: ${{ steps.app-token.outputs.token }}
persist-credentials: false

- name: Configure git auth
run: git config --global url."https://x-access-token:${{ secrets.GH_PAT }}@github.com/".insteadOf "https://github.com/"

- uses: tempoxyz/changelogs@54f693643e1bd8469293bdfcbfb647bceb559490 # changelogs@0.6.3 + unified PR title + install from source
id: changelogs
with:
conventional-commit: true
github-token: ${{ github.token }}
github-token: ${{ steps.app-token.outputs.token }}

- name: Update Cargo.lock on release PR
if: steps.changelogs.outputs.pullRequestNumber != ''
env:
GH_TOKEN: ${{ secrets.GH_PAT }}
APP_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
git fetch origin changelog-release/main
git checkout changelog-release/main
cargo update --workspace
if ! git diff --quiet Cargo.lock; then
git add Cargo.lock
git commit -m "chore: update Cargo.lock"
git push origin changelog-release/main
git push "https://x-access-token:${APP_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" HEAD:changelog-release/main
fi
4 changes: 3 additions & 1 deletion .github/workflows/workflow-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ jobs:
echo "Checking pull_request_target hardening..."
grep -n "pull_request_target:" .github/workflows/changelog-generate.yml >/dev/null
grep -n "if: steps.source.outputs.same_repo == 'true'" .github/workflows/changelog-generate.yml >/dev/null
grep -n "git push origin \"HEAD:" .github/workflows/changelog-generate.yml >/dev/null
# The push must go to the validated branch ref via an authenticated URL
# (App-token), since persist-credentials=false on the checkout step.
grep -n "git push \"https://x-access-token:\${APP_TOKEN}@github.com/\${GITHUB_REPOSITORY}.git\" \"HEAD:" .github/workflows/changelog-generate.yml >/dev/null
if grep -n "git checkout -b \$\{\{ github.event.pull_request.head.ref \}\}" .github/workflows/changelog-generate.yml; then
echo "::error::Unsafe branch checkout pattern detected in changelog generation workflow."
exit 1
Expand Down
Loading