Skip to content

Commit

Permalink
2023.07.03:
Browse files Browse the repository at this point in the history
* changed: action.yml: added `[<workflow-name>][<step-number>]` as a prefix in all step names and duplicated it with the step name in the first comment line in all scripts to identify each step in a common pipeline log
  • Loading branch information
andry81 committed Jul 3, 2023
1 parent 8e4f88d commit ead25b0
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 16 deletions.
45 changes: 29 additions & 16 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,21 @@ inputs:
runs:
using: "composite"
steps:
- name: load `flags` parameter into `GH_WORKFLOW_FLAGS` environment variable
- name: '[accum-inpage-downloads][01] load `flags` parameter into `GH_WORKFLOW_FLAGS` environment variable'
shell: bash
run: |
### [accum-inpage-downloads][01] load `flags` parameter into `GH_WORKFLOW_FLAGS` environment variable
# suppress not zero exit code
{ IFS=$' \t' read -r -d '' GH_WORKFLOW_FLAGS || (( 1 )); } <<::EOF::
${{ inputs.flags }}
::EOF::
GH_WORKFLOW_FLAGS="${GH_WORKFLOW_FLAGS//[$'\n\r']/}" # remove all line returns
echo "GH_WORKFLOW_FLAGS=$GH_WORKFLOW_FLAGS" >> $GITHUB_ENV
- name: print initial environment variables
- name: '[accum-inpage-downloads][02] print initial environment variables'
shell: bash
run: |
### [accum-inpage-downloads][02] print initial environment variables
eval __flags__=($GH_WORKFLOW_FLAGS)
for arg in "${__flags__[@]}"; do
# suppress not zero exit code
Expand All @@ -131,12 +133,13 @@ runs:
done
# step is required to workaround variable expansion in variables
- name: declare dependent variables
- name: '[accum-inpage-downloads][03] declare dependent variables'
shell: bash
run: |
### [accum-inpage-downloads][03] declare dependent variables
echo "GH_WORKFLOW_ROOT=$GITHUB_WORKSPACE/gh-workflow" >> $GITHUB_ENV
- name: checkout gh-workflow@${{ inputs.deps_repo_branch }}
- name: '[accum-inpage-downloads][04] checkout gh-workflow@${{ inputs.deps_repo_branch }}'
uses: andry81-devops/gh-action--git-checkout@master
with:
repository: ${{ inputs.deps_repo_owner }}/gh-workflow
Expand All @@ -147,16 +150,18 @@ runs:
mkdir-p: >-
${{ env.GH_WORKFLOW_ROOT }}
- name: update permissions
- name: '[accum-inpage-downloads][05] update permissions'
shell: bash
run: |
### [accum-inpage-downloads][05] update permissions
chmod ug+x $GH_WORKFLOW_ROOT/bash/_common/update-permissions.sh
$GH_WORKFLOW_ROOT/bash/_common/update-permissions.sh ug+x "$GH_WORKFLOW_ROOT/bash" -iname '*.sh'
# step is required to pass environment variables externally
- name: declare variables from lists
- name: '[accum-inpage-downloads][06] declare variables from lists'
shell: bash
run: |
### [accum-inpage-downloads][06] declare variables from lists
# suppress not zero exit code
{ IFS=$' \t' read -r -d '' INPUT_ENV || (( 1 )); } <<::EOF::
${{ inputs.env }}
Expand All @@ -167,15 +172,17 @@ runs:
"GHWF_GITHUB_ACTIONS_RUN_URL=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
"GHWF_REPO_STATS_COMMITS_URL=https://github.com/${{ github.repository }}/commits?branch=${{ inputs.output_repo_branch }}"
- name: variables validation
- name: '[accum-inpage-downloads][07] variables validation'
shell: bash
run: |
### [accum-inpage-downloads][07] variables validation
$GH_WORKFLOW_ROOT/bash/github/set-env-from-args.sh \
"CHANGELOG_FILE=${CHANGELOG_FILE:-"changelog.txt"}"
- name: declare local variables
- name: '[accum-inpage-downloads][08] declare local variables'
shell: bash
run: |
### [accum-inpage-downloads][08] declare local variables
$GH_WORKFLOW_ROOT/bash/github/set-env-from-args.sh \
"changelog_file=$CHANGELOG_FILE" \
"CHANGELOG_FILE=$GITHUB_WORKSPACE/inpage-downloads/${{ inputs.output_repo_dir }}/$CHANGELOG_FILE" \
Expand All @@ -185,23 +192,25 @@ runs:
"downloads_sed_regexp=${{ inputs.downloads_sed_regexp }}" \
"curl_flags=${{ inputs.curl_flags }}"
- name: declare local variables
- name: '[accum-inpage-downloads][09] declare local variables'
shell: bash
run: |
### [accum-inpage-downloads][09] declare local variables
$GH_WORKFLOW_ROOT/bash/github/set-env-from-args.sh \
"changelog_dir=${CHANGELOG_FILE%/*}"
- name: head annotations
- name: '[accum-inpage-downloads][10] head annotations'
shell: bash
run: |
### [accum-inpage-downloads][10] head annotations
$GH_WORKFLOW_ROOT/bash/github/print-notice.sh \
"query url: ${{ inputs.query_url }}" \
"output repo dir: https://github.com/${{ inputs.output_repo_owner }}/${{ inputs.output_repo }}/tree/${{ inputs.output_repo_branch }}/${{ inputs.output_repo_dir }}"
$GH_WORKFLOW_ROOT/bash/github/print-notice-ln.sh \
"changelog file: https://github.com/${{ inputs.output_repo_owner }}/${{ inputs.output_repo }}/tree/${{ inputs.output_repo_branch }}/${{ inputs.output_repo_dir }}/$changelog_file" \
"env:"$'\n'" GITHUB_RUN_ID=\`$GITHUB_RUN_ID\`"$'\n'" GITHUB_RUN_NUMBER=\`$GITHUB_RUN_NUMBER\`"
- name: checkout inpage-downloads@${{ inputs.output_repo_branch }}
- name: '[accum-inpage-downloads][11] checkout inpage-downloads@${{ inputs.output_repo_branch }}'
uses: andry81-devops/gh-action--git-checkout@master
with:
repository: ${{ inputs.output_repo_owner }}/${{ inputs.output_repo }}
Expand All @@ -213,16 +222,18 @@ runs:
${{ inputs.output_repo_dir }}
${{ env.changelog_dir }}
- name: accumulate inpage-downloads
- name: '[accum-inpage-downloads][12] accumulate inpage-downloads'
id: accum-downloads
shell: bash
run: |
### [accum-inpage-downloads][12] accumulate inpage-downloads
$GH_WORKFLOW_ROOT/bash/inpage/accum-downloads.sh
# caution: no operation after that line if non zero exit code happens above
- name: commit inpage-downloads
- name: '[accum-inpage-downloads][13] commit inpage-downloads'
shell: bash
run: |
### [accum-inpage-downloads][13] commit inpage-downloads
cd $GITHUB_WORKSPACE/inpage-downloads
git add .
git config --global user.name "GitHub Action"
Expand All @@ -237,22 +248,24 @@ runs:
$GH_WORKFLOW_ROOT/bash/github/set-env-from-args.sh \
"HEAD_COMMIT_HASH=$(git rev-parse HEAD)"
- name: push inpage-downloads
- name: '[accum-inpage-downloads][14] push inpage-downloads'
uses: ad-m/github-push-action@master
with:
repository: ${{ inputs.output_repo_owner }}/${{ inputs.output_repo }}
branch: ${{ inputs.output_repo_branch }}
directory: inpage-downloads
github_token: ${{ inputs.output_repo_write_token }}

- name: print commit parameters into pipeline log only
- name: '[accum-inpage-downloads][15] print commit parameters into pipeline log only'
shell: bash
run: |
### [accum-inpage-downloads][15] print commit parameters into pipeline log only
$GH_WORKFLOW_ROOT/bash/github/print-notice.sh \
"commit reference url: https://github.com/${{ inputs.output_repo_owner }}/${{ inputs.output_repo }}/commit/$HEAD_COMMIT_HASH"
- name: flush print annotations
- name: '[accum-inpage-downloads][16] flush print annotations'
if: always()
shell: bash
run: |
### [accum-inpage-downloads][16] flush print annotations
$GH_WORKFLOW_ROOT/bash/github/flush-print-annotations.sh
3 changes: 3 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
2023.07.03:
* changed: action.yml: added `[<workflow-name>][<step-number>]` as a prefix in all step names and duplicated it with the step name in the first comment line in all scripts to identify each step in a common pipeline log

2023.07.03:
* changed: action.yml: added `git status` to dump list of ready to commit statistic output files

Expand Down

0 comments on commit ead25b0

Please sign in to comment.