Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use script to set refs according to the target branch #75

Merged
merged 2 commits into from
Dec 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading