testing pr - Np jw test illumina genotyping arrays #584
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
# This is a github action that will update a file named “pipeline_versions.txt” (or create if it doesn’t exist) with the following content: | |
# tab-delimited with columns “pipeline name”, “version”, “date of last commit”. | |
name: Update Pipeline Versions | |
on: | |
pull_request: | |
# This workflow will run on PR to develop and will update the pipeline_versions.txt file on the source branch (ie. the branch that triggered the PR) | |
branches: | |
- develop | |
workflow_dispatch: | |
jobs: | |
update_versions: | |
runs-on: ubuntu-latest | |
steps: | |
# This step checks out the code - explicitly fetch the history and checkout the branch to enable us to push files back to the repo | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.head_ref }} # This fetches the branch name that triggered the workflow | |
fetch-depth: 0 # This fetches all history for all branches and tags | |
# This step sets up Python environment | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.x | |
# This step updates a a file called "pipeline_versions.txt" with the names, versions, and last commit dates of all the pipelines found in the | |
# "warp/pipelines" directory by parsing the contents of the "*.changelog.md" files. | |
- name: Update Pipeline Versions | |
run: | | |
echo "Current directory: " | |
pwd | |
ls -lht | |
echo -e "Pipeline Name\tVersion\tDate of Last Commit" > pipeline_versions.txt | |
find pipelines -name "*.changelog.md" -type f | while read -r file; do | |
pipeline_name=$(basename "$file" .changelog.md) | |
version=$(head -n 1 "$file" | sed 's/#//') | |
last_commit_date=$(sed -n '2p' "$file" | sed 's/([^)]*)//g') | |
echo -e "$pipeline_name\t$version\t$last_commit_date" >> pipeline_versions.txt | |
done | |
# This step commits and pushes the changes to the repository | |
- name: Commit and push changes | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add pipeline_versions.txt | |
if git diff-index --quiet HEAD --; then | |
echo "No changes to commit" | |
else | |
git commit -m "Updated pipeline_versions.txt with all pipeline version information" | |
git push | |
fi | |