Merging latest changes into main #35
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: Branch URL Update Action | |
on: | |
push: | |
branches-ignore: | |
- 'main' | |
- 'master' | |
pull_request: | |
branches: | |
- 'main' | |
- 'master' | |
# And any other protected branches here too | |
jobs: | |
branch_url_update_action: | |
runs-on: ubuntu-latest | |
name: Update branch URLs to use the current branch | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v3.2.0 | |
- name: Extract target/current branch name | |
shell: bash | |
run: | | |
if [ ! -z "$GITHUB_BASE_REF" ]; then | |
echo "##[set-output name=branch;]$(echo $GITHUB_BASE_REF)" | |
elif [ ! -z "$GITHUB_REF_NAME" ]; then | |
echo "##[set-output name=branch;]$(echo $GITHUB_REF_NAME)" | |
else | |
return 1 | |
fi | |
id: extract_branch | |
- name: Update branch URLs to use the current branch | |
id: update | |
uses: naschorr/branch-url-update-action@v1 | |
with: | |
target-branch: ${{ steps.extract_branch.outputs.branch }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Commit changes back into repository | |
if: "${{ success() && steps.update.outputs.updated-files != '' }}" | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: "Updated repository branch names" | |
- name: Get the updated file paths | |
run: echo "Files ${{ steps.update.outputs.updated-files }}" |