Fix/hit test #195
Workflow file for this run
This file contains 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: pr number | |
permissions: | |
contents: write | |
pull-requests: write | |
on: | |
pull_request_target: | |
types: [opened, synchronize, reopened] | |
branches: | |
- master | |
paths: | |
- "CHANGELOG.md" | |
jobs: | |
replace-pr-number: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/github-script@v7 | |
continue-on-error: true | |
with: | |
github-token: ${{ secrets.RIBIR_RELEASE }} | |
script: | | |
github.rest.issues.removeLabel({ | |
issue_number: context.payload.pull_request.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
name: ['B-test'] | |
}) | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
fetch-depth: 0 | |
- name: Replace pr number in CHANGELOG.md | |
run: | | |
sed -i '/^##/,$ {s/#pr/#${{ github.event.pull_request.number }}/g}' ./CHANGELOG.md | |
if [ $(git status --porcelain | wc -l) -eq 0 ]; then | |
echo "No changes to commit." | |
exit 0 | |
fi | |
git config user.name "RChangelog[bot]" | |
git config user.email 155627257+RChangelog[bot]@users.noreply.github.com | |
git add . | |
git commit --amend --no-edit | |
git push -f | |
# Wait 3 seconds before adding label to trigger push event | |
- run: sleep 3s | |
- uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.RIBIR_RELEASE }} | |
script: | | |
github.rest.issues.addLabels({ | |
issue_number: context.payload.pull_request.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
labels: ['B-test'] | |
}) |