Skip to content

gha(deps): bump styfle/cancel-workflow-action from 0.11.0 to 0.12.0 #28

gha(deps): bump styfle/cancel-workflow-action from 0.11.0 to 0.12.0

gha(deps): bump styfle/cancel-workflow-action from 0.11.0 to 0.12.0 #28

name: Print GitHub event data / repo name
on:
push:
paths:
# Include this workflow
- '.github/workflows/print-events-repo-name.yml'
pull_request:
types: [opened, synchronize, reopened]
paths:
- '.github/workflows/print-events-repo-name.yml'
# manual dispatch
workflow_dispatch:
#defaults:
# run:
# shell: bash
# working-directory:
jobs:
avoid_reduncy:
name: Cancel Previous Pipelines
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Workflows
uses: styfle/cancel-workflow-action@0.12.0
print-cwd:
name: Print CWD
runs-on: ubuntu-latest
steps:
- name: Cwd - Working Directory
uses: actions/github-script@v5
with:
result-encoding: string
script: |
const path = require('path');
console.log("path: ", path.resolve('.'));
console.log("CWD: ", process.cwd());
- name: List CWD folder
run: ls -lAoghi1
print-gh-event:
name: Print GH event
runs-on: ubuntu-latest
steps:
- name: Echo. JSON event data (as env)
# NOTE: `github.event` does not seem to be populated when an action is run `on.schedule`
env:
GH_REPOSITORY: ${{ github.repository }}
GH_JSON_EVENT: ${{ toJSON( github.event ) }}
run: |
echo -e "GITHUB_REPOSITORY> $GITHUB_REPOSITORY"
echo "..."
echo -e "GH_REPOSITORY> $GH_REPOSITORY"
echo "..."
echo -e "$GH_JSON_EVENT"
- name: Echo. JSON event data (as var)
run: |
echo -e "GITHUB_REPOSITORY> ${{ github.repository }}"
echo "..."
echo -e "${{ github.event }}"
#
# use output variables should be the prefered way
#
print-repo-name-so:
name: reponame (via github ctx ::set-output)
runs-on: ubuntu-latest
steps:
- name: Fetch repository name
id: repository-name
run: |
echo "value=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}' | sed -e 's/:refs//')" \
>> $GITHUB_OUTPUT
- name: Print
env:
GH_REPOSITORY_NAME: ${{ steps.repository-name.outputs.value }}
run: |
echo -e "$GH_REPOSITORY_NAME"
echo -e "${{ steps.repository-name.outputs.value }}"
print-repo-name-se:
name: reponame (via GITHUB_* ::set-env)
runs-on: ubuntu-latest
steps:
- name: Fetch repository name
# DEPRECATED!!! https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/
# Error: The `set-env` command is disabled. Please upgrade to using Environment Files or opt into unsecure command execution by setting the `ACTIONS_ALLOW_UNSECURE_COMMANDS` environment variable to `true`.
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: ${{ true }}
run: |
echo "GH_REPOSITORY_NAME=$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e 's/:refs//')" \
>> $GITHUB_ENV
- name: Print
run: |
echo -e "$GH_REPOSITORY_NAME"
echo -e "${{ env.GH_REPOSITORY_NAME }}"
print-repo-name-cre:
name: reponame (via github.* ctx + GITHUB_ENV append)
runs-on: ubuntu-latest
steps:
- name: Fetch repository name
run: |
echo "GH_REPOSITORY_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}' | sed -e 's/:refs//')" \
>> $GITHUB_ENV
# shell: bash
- name: Print
run: |
echo -e "$GH_REPOSITORY_NAME"
echo -e "${{ env.GH_REPOSITORY_NAME }}"