Skip to content
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
18 changes: 12 additions & 6 deletions .github/workflows/check-outdated-content.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ jobs:
steps:
- name: Set up environment variables for the target L10n team
shell: bash
env:
BASE_REF: ${{ github.base_ref }}
run: |

# Set L10n branch
L10N_BRANCH="${{github.base_ref}}"
L10N_BRANCH="${BASE_REF}"
echo "(DEBUG) L10N Branch: ${L10N_BRANCH}"

# Set output direcory
Expand Down Expand Up @@ -74,6 +76,10 @@ jobs:
- name: Check outdated
id: checker
shell: bash
env:
REF: ${{ github.ref }}
HEAD_REF: ${{ github.head_ref }}
BASE_REF: ${{ github.base_ref }}
run: |
##### DEBUG section, this will be removed later ###########
ls -al
Expand All @@ -85,9 +91,9 @@ jobs:
echo "Extract branch: ${GITHUB_REF#refs/}"

# `github` context information
echo "(DEBUG) github.ref: ${{github.ref}}"
echo "(DEBUG) github.head_ref: ${{github.head_ref}}"
echo "(DEBUG) github.base_ref: ${{github.base_ref}}"
echo "(DEBUG) github.ref: ${REF}"
echo "(DEBUG) github.head_ref: ${HEAD_REF}"
echo "(DEBUG) github.base_ref: ${BASE_REF}"
echo "(DEBUG) L10N_DIR: ${L10N_DIR}"
echo "(DEBUG) L10N_DIR: ${{ env.L10N_DIR }}"
#####################################################
Expand All @@ -99,7 +105,7 @@ jobs:

# Get the old branch from 'github.base_ref'
# The old branch can be 'upstream/dev-ko'
OLD_BRANCH="origin/${{github.base_ref}}"
OLD_BRANCH="origin/${BASE_REF}"
echo "(DEBUG) OLD_BRANCH: ${OLD_BRANCH}"

L10N_INFO_JSON=$(cat <<EOF
Expand Down
57 changes: 36 additions & 21 deletions .github/workflows/post-outdated-content-report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,44 @@ jobs:
steps:
- name: Show the github context
shell: bash
env:
GH_CONTEXT: ${{ toJSON(github) }}
ACTION: ${{ github.action }}
ACTION_PATH: ${{ github.action_path }}
ACTOR: ${{ github.actor }}
BASE_REF: ${{ github.base_ref }}
EVENT_NAME: ${{ github.event_name }}
EVENT_PATH: ${{ github.event_path }}
HEAD_REF: ${{ github.head_ref }}
JOB: ${{ github.job }}
REF: ${{ github.ref }}
REPOSITORY: ${{ github.repository }}
REPOSITORY_OWNER: ${{ github.repository_owner }}
RUN_ID: ${{ github.run_id }}
RUN_NUMBER: ${{ github.run_number }}
SHA: ${{ github.sha }}
WORKFLOW: ${{ github.workflow }}
WORKSPACE: ${{ github.workspace }}
run: |
echo "(DEBUG) ParsedBranch: ${GITHUB_REF#refs/heads/}"
echo "(DEBUG) github: ${{ github }}"
echo "(DEBUG) toJSON(github):"
echo '${{ toJSON(github) }}'
echo "(DEBUG) github.action: ${{ github.action }}"
echo "(DEBUG) github.action_path: ${{ github.action_path }}"
echo "(DEBUG) github.actor: ${{ github.actor }}"
echo "(DEBUG) github.base_ref: ${{ github.base_ref }}"
echo "(DEBUG) github.event: ${{ github.event }}"
echo "(DEBUG) github.event_name: ${{ github.event_name }}"
echo "(DEBUG) github.event_path: ${{ github.event_path }}"
echo "(DEBUG) github.head_ref: ${{ github.head_ref }}"
echo "(DEBUG) github.job: ${{ github.job }}"
echo "(DEBUG) github.ref: ${{ github.ref }}"
echo "(DEBUG) github.repository: ${{ github.repository }}"
echo "(DEBUG) github.repository_owner: ${{ github.repository_owner }}"
echo "(DEBUG) github.run_id: ${{ github.run_id }}"
echo "(DEBUG) github.run_number: ${{ github.run_number }}"
echo "(DEBUG) github.sha: ${{ github.sha }}"
echo "(DEBUG) github.token: ${{ github.token }}"
echo "(DEBUG) github.workflow: ${{ github.workflow }}"
echo "(DEBUG) github.workspace: ${{ github.workspace }}"
echo "(DEBUG) toJSON(github):"
echo "${GH_CONTEXT}"
echo "(DEBUG) github.action: ${ACTION}"
echo "(DEBUG) github.action_path: ${ACTION_PATH}"
echo "(DEBUG) github.actor: ${ACTOR}"
echo "(DEBUG) github.base_ref: ${BASE_REF}"
echo "(DEBUG) github.event_name: ${EVENT_NAME}"
echo "(DEBUG) github.event_path: ${EVENT_PATH}"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue: The run block directly uses ${{ }} template expressions for github.token, github.workflow, github.repository, github.repository_owner, github.run_id, github.run_number, github.sha, and github.workspace. All of these should be assigned to environment variables at the step or job level and referenced via $ENV_VAR syntax. The github.token value should NEVER be echoed in logs under any circumstances. Remove the echo for github.token entirely and move all remaining ${{ }} references to the env block.

Recommended Code Changes:

env:
  REPOSITORY: ${{ github.repository }}
  REPOSITORY_OWNER: ${{ github.repository_owner }}
  RUN_ID: ${{ github.run_id }}
  RUN_NUMBER: ${{ github.run_number }}
  SHA: ${{ github.sha }}
  WORKFLOW: ${{ github.workflow }}
  WORKSPACE: ${{ github.workspace }}
run: |
  echo "(DEBUG) github.repository: ${REPOSITORY}"
  echo "(DEBUG) github.repository_owner: ${REPOSITORY_OWNER}"
  echo "(DEBUG) github.run_id: ${RUN_ID}"
  echo "(DEBUG) github.run_number: ${RUN_NUMBER}"
  echo "(DEBUG) github.sha: ${SHA}"
  echo "(DEBUG) github.workflow: ${WORKFLOW}"
  echo "(DEBUG) github.workspace: ${WORKSPACE}"
  # Remove the github.token echo entirely - never log tokens

echo "(DEBUG) github.head_ref: ${HEAD_REF}"
echo "(DEBUG) github.job: ${JOB}"
echo "(DEBUG) github.ref: ${REF}"
echo "(DEBUG) github.repository: ${REPOSITORY}"
echo "(DEBUG) github.repository_owner: ${REPOSITORY_OWNER}"
echo "(DEBUG) github.run_id: ${RUN_ID}"
echo "(DEBUG) github.run_number: ${RUN_NUMBER}"
echo "(DEBUG) github.sha: ${SHA}"
echo "(DEBUG) github.workflow: ${WORKFLOW}"
echo "(DEBUG) github.workspace: ${WORKSPACE}"

# NOTE - "actions/download-artifact" is not working for sharing data between workflows.
# - name: Download output
Expand Down