Skip to content

Commit

Permalink
Merge pull request #75 from EOSC-synergy/feature/set_refs_script
Browse files Browse the repository at this point in the history
Use script to set refs according to the target branch
  • Loading branch information
orviz authored Dec 11, 2023
2 parents f848f56 + 0ef0ad4 commit dee6beb
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/references.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,21 @@ jobs:
- uses: actions/checkout@v2
with:
persist-credentials: false
- run: find . -type f \( -name \*.md -o -name \*.rst -o -name \*.toml -o -name \*.html -o -name \*.cff \) -exec sed -i 's/IFCA-Advanced-Computing\/FAIR_eva/eosc-synergy\/FAIR_eva/g' {} +
# extract branch name (either on push or pull_request)
- name: Extract branch name
if: github.event_name != 'pull_request'
shell: bash
run: echo "BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})" >> "$GITHUB_ENV"
id: extract_branch
- name: Print branch name
if: github.event_name == 'pull_request'
run: echo "BRANCH_NAME=$(echo ${GITHUB_HEAD_REF})" >> "$GITHUB_ENV"
- run: bash -x ./.github/workflows/scripts/set_refs.sh $BRANCH_NAME
- run: git status
- uses: gr2m/create-or-update-pull-request-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
branch: "merge/repo-sync"
author: "Pablo Orviz <[email protected]>"
commit-message: "Update references to eosc-synergy/FAIR_eva"
commit-message: "Update references"
17 changes: 17 additions & 0 deletions .github/workflows/scripts/set_refs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

BRANCH_NAME=$1
ORG_LOCAL=eosc-synergy
ORG_UPSTREAM=IFCA-Advanced-Computing

[[ -z $BRANCH_NAME ]] && echo "Ignoring: no branch name provided" && exit -1

if [[ $BRANCH_NAME == "merge/repo-sync" ]]; then
echo "Setting references to eosc-synergy"
find . -type f \( -name \*.md -o -name \*.rst -o -name \*.toml -o -name \*.html -o -name \*.cff \) -exec sed -i "s/${ORG_UPSTREAM}\/FAIR_eva/${ORG_LOCAL}\/FAIR_eva/g" {} +
elif [[ $BRANCH_NAME == "merge/upstream" ]]; then
echo "Setting references to IFCA-Advanced-Computing"
find . -type f \( -name \*.md -o -name \*.rst -o -name \*.toml -o -name \*.html -o -name \*.cff \) -exec sed -i "s/${ORG_LOCAL}\/FAIR_eva/${ORG_UPSTREAM}\/FAIR_eva/g" {} +
else
echo "Ignoring: branch name <$BRANCH_NAME> is not in [merge/repo-sync, merge/upstream]"
fi

0 comments on commit dee6beb

Please sign in to comment.