Skip to content

Commit 314e3f4

Browse files
committed
✏️ fix PR and add delete to auto-update branch
1 parent a4350b3 commit 314e3f4

File tree

1 file changed

+13
-29
lines changed

1 file changed

+13
-29
lines changed

.github/workflows/python-publish.yml

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -44,40 +44,18 @@ jobs:
4444
mkdir -p metadata
4545
poetry run python -c "from ontolearner import OntoLearnerMetadataExporter; OntoLearnerMetadataExporter().export('metadata/ontolearner-metadata.rdf')"
4646
47-
# Commit metadata back via a branch + PR
48-
- name: Commit and push metadata
49-
env:
50-
REPO_PUSH_TOKEN: ${{ secrets.REPO_PUSH_TOKEN }}
51-
run: |
52-
git config --global user.name "github-actions[bot]"
53-
git config --global user.email "[email protected]"
54-
55-
# Create/update temporary branch for metadata
56-
git checkout -B auto-update
57-
ls -a
58-
ls metadata/
59-
# Add metadata files
60-
git add metadata/ontolearner-metadata.rdf
61-
62-
# Commit only if changes exist
63-
if ! git diff --cached --quiet; then
64-
git commit -m ":bookmark: Update metadata after release"
65-
git remote set-url origin https://x-access-token:${REPO_PUSH_TOKEN}@github.com/sciknoworg/OntoLearner.git
66-
git push origin auto-update
67-
else
68-
echo "No changes to commit"
69-
fi
70-
71-
# Create or update PR for metadata
72-
- name: Create or update Pull Request
47+
- name: Create and update Pull Request
7348
id: cpr
7449
uses: peter-evans/create-pull-request@v7
7550
with:
76-
commit-message: ":bookmark: Update metadata after release"
77-
title: "🤖 Automated metadata update"
51+
token: ${{ secrets.REPO_PUSH_TOKEN }}
7852
branch: auto-update
7953
base: main
80-
54+
commit-message: ":bookmark: Update metadata after release"
55+
title: "🤖 Automated metadata update"
56+
body: "This PR updates the Dublin Core metadata after release."
57+
add-paths: |
58+
metadata/ontolearner-metadata.rdf
8159
8260
# Automatically merge the PR if possible
8361
- name: Auto-merge PR
@@ -88,6 +66,12 @@ jobs:
8866
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
8967
merge-method: squash
9068

69+
- name: Delete auto-update branch
70+
if: steps.cpr.outputs.pull-request-operation == 'created'
71+
run: git push origin --delete auto-update
72+
env:
73+
GITHUB_TOKEN: ${{ secrets.REPO_PUSH_TOKEN }}
74+
9175
- name: Configure Poetry for PyPI
9276
run: |
9377
poetry config pypi-token.pypi ${{ secrets.TWINE_API_TOKEN }}

0 commit comments

Comments
 (0)