mirror of
https://github.com/Youzini-afk/ST-Bionic-Memory-Ecology.git
synced 2026-05-15 22:30:38 +08:00
ci: skip manifest bump on merged PR pushes
This commit is contained in:
26
.github/workflows/bump-manifest-version.yml
vendored
26
.github/workflows/bump-manifest-version.yml
vendored
@@ -8,6 +8,7 @@ on:
|
|||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
pull-requests: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
bump-manifest-version:
|
bump-manifest-version:
|
||||||
@@ -15,20 +16,45 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- name: Detect merged pull request push
|
||||||
|
id: pr-check
|
||||||
|
uses: actions/github-script@v7
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const { owner, repo } = context.repo;
|
||||||
|
const sha = context.sha;
|
||||||
|
const response = await github.rest.repos.listPullRequestsAssociatedWithCommit({
|
||||||
|
owner,
|
||||||
|
repo,
|
||||||
|
commit_sha: sha,
|
||||||
|
});
|
||||||
|
const mergedPr = (response.data || []).find(
|
||||||
|
(pr) => pr?.merged_at && pr?.base?.ref === context.ref.replace('refs/heads/', ''),
|
||||||
|
);
|
||||||
|
const shouldSkip = Boolean(mergedPr);
|
||||||
|
core.setOutput('skip', shouldSkip ? 'true' : 'false');
|
||||||
|
if (mergedPr) {
|
||||||
|
core.notice(`Skip manifest bump for merged PR #${mergedPr.number}: ${mergedPr.title}`);
|
||||||
|
}
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
|
if: ${{ steps.pr-check.outputs.skip != 'true' }}
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
|
if: ${{ steps.pr-check.outputs.skip != 'true' }}
|
||||||
uses: actions/setup-node@v4
|
uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 20
|
node-version: 20
|
||||||
|
|
||||||
- name: Bump manifest version
|
- name: Bump manifest version
|
||||||
|
if: ${{ steps.pr-check.outputs.skip != 'true' }}
|
||||||
run: node scripts/bump-manifest-version.mjs
|
run: node scripts/bump-manifest-version.mjs
|
||||||
|
|
||||||
- name: Commit version bump
|
- name: Commit version bump
|
||||||
|
if: ${{ steps.pr-check.outputs.skip != 'true' }}
|
||||||
run: |
|
run: |
|
||||||
if git diff --quiet -- manifest.json; then
|
if git diff --quiet -- manifest.json; then
|
||||||
echo "manifest.json version did not change."
|
echo "manifest.json version did not change."
|
||||||
|
|||||||
Reference in New Issue
Block a user