Skip to content

fix(workflows/sync-upstream): fix nix command return status checking #15

fix(workflows/sync-upstream): fix nix command return status checking

fix(workflows/sync-upstream): fix nix command return status checking #15

name: Sync changes to remote child branches
on:
pull_request:
branches: [ main ]
types: [ closed ]
paths-ignore:
- 'dae/metadata.json'
- 'daed/metadata.json'
env:
PR_TEAM_REVIEWERS: |
nix
jobs:
sync-changes:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
strategy:
matrix:
include:
- branch: unstable
labels: |
branch/unstable
automerge
- branch: experiment
labels: |
branch/experiment
automerge
fail-fast: false
steps:
- name: Generate GitHub Auth Token
# https://github.com/tibdex/github-app-token
id: generate_token
uses: tibdex/[email protected]
with:
app_id: ${{ secrets.GH_APP_ID }}
private_key: ${{ secrets.GH_APP_PRIVATE_KEY }}
- uses: actions/checkout@main
with:
ref: ${{ github.event.repository.default_branch }}
fetch-depth: 0
- name: Set short git commit SHA
id: vars
run: |
SHA=$(git rev-parse --short ${{ github.event.pull_request.merge_commit_sha }})
echo "COMMIT_SHORT_SHA=$SHA" >> $GITHUB_ENV
- name: Confirm git commit SHA output
run: echo ${{ env.COMMIT_SHORT_SHA }}
- name: Cherry pick changes into target branch
# https://github.com/carloscastrojumo/github-cherry-pick-action
uses: carloscastrojumo/github-cherry-pick-action@main
id: cherrypick_pr
with:
branch: ${{ matrix.branch }}
labels: |
git/cherry-pick
${{ matrix.labels }}
team-reviewers: ${{ env.PR_TEAM_REVIEWERS }}
title: '[cherry-pick] {old_title}'
body: 'ci: cherry picking #{old_pull_request_id} onto ${{ matrix.branch }}'
cherry-pick-branch: cherrypick-${{ env.COMMIT_SHORT_SHA }}-${{ matrix.branch }}
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
- name: Trigger downstream workflow
uses: convictional/[email protected]
with:
owner: ${{ github.repository_owner }}
repo: flake.nix
github_token: ${{ steps.generate_token.outputs.token }}
workflow_file_name: automerge-sync-pr.yml
ref: ${{ github.event.repository.default_branch }}
client_payload: '{"pr_number":"${{ steps.cherrypick_pr.outputs.number }}"}'
trigger_workflow: true
propagate_failure: false
wait_workflow: false