Update Konflux references #53
Workflow file for this run
This file contains hidden or 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
| name: gh_pr_sync | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| types: [opened, reopened] | |
| jobs: | |
| gh_pr_sync: | |
| runs-on: ubuntu-latest | |
| # Only sync PRs from the konflux-fedora bot | |
| if: github.event.pull_request.user.login == 'konflux-fedora[bot]' || github.event_name == 'workflow_dispatch' | |
| steps: | |
| - name: Verify PR author | |
| run: | | |
| echo "PR opened by: ${{ github.event.pull_request.user.login }}" | |
| echo "This workflow only processes PRs from konflux-fedora bot" | |
| - name: Set git identity | |
| run: | | |
| git config --global user.name "konflux-gh-forgejo-sync" | |
| git config --global user.email "konflux-gh-forgejo-sync@noarealdomain.org" | |
| - name: Push PR branch to Codeberg | |
| run: | | |
| echo "Processing GitHub PR #${{ github.event.pull_request.number }}: ${{ github.event.pull_request.title }}" | |
| echo "PR branch: ${{ github.event.pull_request.head.ref }}" | |
| echo "PR head SHA: ${{ github.event.pull_request.head.sha }}" | |
| echo "PR head repo: ${{ github.event.pull_request.head.repo.clone_url }}" | |
| # Clone the Codeberg repo | |
| git clone https://${{ secrets.FORGEJO_GIT_TOKEN }}@codeberg.org/fedora/oci-image-definitions.git | |
| cd oci-image-definitions | |
| # Add the PR's fork as a remote and fetch the PR branch | |
| git remote add pr-fork ${{ github.event.pull_request.head.repo.clone_url }} | |
| git fetch pr-fork ${{ github.event.pull_request.head.ref }} | |
| # Create a new branch for the PR | |
| git checkout -b ${{ github.event.pull_request.head.ref }} FETCH_HEAD | |
| # Push the branch to Codeberg | |
| echo "Pushing branch to Codeberg" | |
| git push origin ${{ github.event.pull_request.head.ref }} --force | |
| - name: Create PR on Codeberg | |
| env: | |
| PR_TITLE: ${{ github.event.pull_request.title }} | |
| PR_BODY: ${{ github.event.pull_request.body }} | |
| PR_NUMBER: ${{ github.event.pull_request.number }} | |
| PR_URL: ${{ github.event.pull_request.html_url }} | |
| PR_BRANCH: ${{ github.event.pull_request.head.ref }} | |
| run: | | |
| # Create the PR body text | |
| cat > pr_body.txt << EOF | |
| Synced from GitHub PR #${PR_NUMBER} | |
| Original PR: ${PR_URL} | |
| --- | |
| ${PR_BODY} | |
| EOF | |
| # Create JSON payload with proper escaping | |
| jq -n \ | |
| --arg title "$PR_TITLE" \ | |
| --arg head "$PR_BRANCH" \ | |
| --arg base "main" \ | |
| --arg body "$(cat pr_body.txt)" \ | |
| '{title: $title, head: $head, base: $base, body: $body}' > pr_payload.json | |
| # Create PR using Forgejo API | |
| curl -X POST \ | |
| -H "Authorization: token ${{ secrets.FORGEJO_GIT_TOKEN }}" \ | |
| -H "Content-Type: application/json" \ | |
| https://codeberg.org/api/v1/repos/fedora/oci-image-definitions/pulls \ | |
| -d @pr_payload.json | |