forked from community-shaders/skyrim-community-shaders
-
Notifications
You must be signed in to change notification settings - Fork 0
ci: reconcile dev after hotfix-staging releases #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+199
−22
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
dd44970
ci: reconcile dev after hotfix-staging releases
alandtse 9c01a4b
ci: use peter-evans/rebase@v3 for auto-rebase
alandtse edcd19a
ci: address CodeRabbit findings on rebase-reconcile
alandtse 324a6c8
ci: trim paraphrase comments in reconcile workflows
alandtse e4cd616
ci: drop past-tense references from reconcile comments
alandtse c5c68ea
ci: nudge CodeQL
alandtse File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| name: "Auto-rebase open PRs" | ||
|
|
||
| # Rebase open PRs against `dev` whenever it moves. Thin wrapper over | ||
| # peter-evans/rebase@v3. | ||
| # | ||
| # Forks: pushing to a fork PR head requires (a) a user PAT belonging to | ||
| # a maintainer of this repo and (b) the PR author having "Allow edits | ||
| # by maintainers" checked. The action silently skips PRs missing either, | ||
| # and skips conflicts. | ||
| # | ||
| # Token: RELEASE_PAT (classic PAT, `repo` + `workflow`). `workflow` is | ||
| # required because rebased PRs may include `.github/workflows/` diffs. | ||
|
|
||
| on: | ||
| push: | ||
| branches: [dev] | ||
| workflow_dispatch: | ||
| inputs: | ||
| pr_number: | ||
| description: "Optional: rebase just this PR number (the action accepts head as `<owner>:<branch>`; we resolve via gh api). Leave empty to rebase all open PRs against dev." | ||
| required: false | ||
| default: "" | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| concurrency: | ||
| # Serialize so two back-to-back pushes to dev don't race and produce | ||
| # interleaved force-pushes on the same PR. | ||
| group: auto-rebase-prs | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| rebase: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 | ||
| token: ${{ secrets.RELEASE_PAT }} | ||
|
|
||
| - name: Resolve single-PR head spec (if pr_number given) | ||
| id: resolve_head | ||
| if: inputs.pr_number != '' | ||
| env: | ||
| GH_TOKEN: ${{ secrets.RELEASE_PAT }} | ||
| PR_NUMBER: ${{ inputs.pr_number }} | ||
| run: | | ||
| set -euo pipefail | ||
| # Guard against rebasing a closed PR or one targeting | ||
| # a non-dev base (e.g. a hotfix staging branch). | ||
| PR_JSON=$(gh pr view "${PR_NUMBER}" --repo '${{ github.repository }}' \ | ||
| --json state,baseRefName,headRepositoryOwner,headRefName) | ||
| PR_STATE=$(echo "${PR_JSON}" | jq -r '.state') | ||
| PR_BASE=$(echo "${PR_JSON}" | jq -r '.baseRefName') | ||
| if [[ "${PR_STATE}" != "OPEN" ]]; then | ||
| echo "::warning::PR #${PR_NUMBER} is ${PR_STATE}, not OPEN — skipping." | ||
| echo "head=" >> "$GITHUB_OUTPUT" | ||
| exit 0 | ||
| fi | ||
| if [[ "${PR_BASE}" != "dev" ]]; then | ||
| echo "::warning::PR #${PR_NUMBER} targets '${PR_BASE}', not 'dev' — skipping to avoid rebasing the wrong base." | ||
| echo "head=" >> "$GITHUB_OUTPUT" | ||
| exit 0 | ||
| fi | ||
| HEAD_REF=$(echo "${PR_JSON}" | jq -r '"\(.headRepositoryOwner.login):\(.headRefName)"') | ||
| echo "head=${HEAD_REF}" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Rebase open PRs against dev | ||
| id: rebase | ||
| # Single-PR dispatches without a valid head fall through to | ||
| # the all-PRs default; this guard keeps that from happening. | ||
| if: inputs.pr_number == '' || steps.resolve_head.outputs.head != '' | ||
| uses: peter-evans/rebase@v3 | ||
| with: | ||
| token: ${{ secrets.RELEASE_PAT }} | ||
| base: dev | ||
| head: ${{ steps.resolve_head.outputs.head }} | ||
| exclude-drafts: true | ||
| exclude-labels: | | ||
| no-auto-rebase | ||
|
|
||
| - name: Summarize | ||
| env: | ||
| REBASED: ${{ steps.rebase.outputs.rebased-count }} | ||
| run: | | ||
| { | ||
| echo "## Auto-rebase summary" | ||
| echo "" | ||
| echo "- PRs rebased: \`${REBASED:-0}\`" | ||
| echo "- Base: \`dev\`" | ||
| if [[ -n '${{ inputs.pr_number }}' ]]; then | ||
| echo "- Targeted single PR: #${{ inputs.pr_number }} (head \`${{ steps.resolve_head.outputs.head }}\`)" | ||
| fi | ||
| echo "" | ||
| echo "PRs not rebased fall into one of three buckets:" | ||
| echo "- Already up-to-date with \`dev\` (no-op)" | ||
| echo "- Draft or labeled \`no-auto-rebase\` (excluded)" | ||
| echo "- Conflict during rebase, OR fork without maintainer-edit access (action silently skips)" | ||
| echo "" | ||
| echo "PRs in the conflict bucket need a manual rebase by the author:" | ||
| echo '```bash' | ||
| echo "git fetch origin && git rebase origin/dev" | ||
| echo "# resolve conflicts, git rebase --continue" | ||
| echo "git push --force-with-lease" | ||
| echo '```' | ||
| } >> "$GITHUB_STEP_SUMMARY" |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.