Skip to content

Commit

Permalink
Set env variables outside composite action
Browse files Browse the repository at this point in the history
  • Loading branch information
arash77 committed Jun 14, 2024
1 parent 46a704f commit 7c81004
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 56 deletions.
42 changes: 3 additions & 39 deletions .github/actions/galaxy-social/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,12 @@ inputs:
description: "Whether to create a preview or not"
default: "false"

GITHUB_TOKEN:
description: "GitHub token"
required: true

PR_NUMBER:
description: "Pull Request number"
required: true

MASTODON_ACCESS_TOKEN:
description: "Mastodon access token"

BLUESKY_PASSWORD:
description: "Bluesky password"

MATRIX_ACCESS_TOKEN:
description: "Matrix access token"

SLACK_ACCESS_TOKEN:
description: "Slack access token"

MASTODON_EU_FR_TOKEN:
description: "Mastodon EU FR token"

runs:
using: "composite"
steps:
- name: checkout #This is needed to avoid error on post action
uses: actions/checkout@v4

- name: Get changed files in posts folder
id: get_changed_files
uses: tj-actions/changed-files@v44
Expand Down Expand Up @@ -73,19 +53,6 @@ runs:
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Create env variables
if: steps.get_changed_files.outputs.any_changed == 'true'
shell: bash
run: |
echo "CHANGED_FILES=${{ steps.get_changed_files.outputs.all_changed_files }}" >> $GITHUB_ENV
echo "MASTODON_ACCESS_TOKEN=${{ inputs.MASTODON_ACCESS_TOKEN }}" >> $GITHUB_ENV
echo "BLUESKY_PASSWORD=${{ inputs.BLUESKY_PASSWORD }}" >> $GITHUB_ENV
echo "MATRIX_ACCESS_TOKEN=${{ inputs.MATRIX_ACCESS_TOKEN }}" >> $GITHUB_ENV
echo "SLACK_ACCESS_TOKEN=${{ inputs.SLACK_ACCESS_TOKEN }}" >> $GITHUB_ENV
echo "MASTODON_EU_FR_TOKEN=${{ inputs.MASTODON_EU_FR_TOKEN }}" >> $GITHUB_ENV
echo "GITHUB_TOKEN=${{ inputs.GITHUB_TOKEN }}" >> $GITHUB_ENV
echo "PR_NUMBER=${{ inputs.PR_NUMBER }}" >> $GITHUB_ENV
- name: Run script to create preview
if: steps.get_changed_files.outputs.any_changed == 'true' && inputs.preview == 'true'
shell: bash
Expand All @@ -102,6 +69,3 @@ runs:
with:
file_pattern: "processed_files.json"
branch: "processed_files"

- name: checkout main
uses: actions/checkout@v4
18 changes: 10 additions & 8 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,17 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Set environment variables
run: |
echo "PR_NUMBER=${{ github.event.number }}" >> $GITHUB_ENV
echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
echo "MASTODON_ACCESS_TOKEN=${{ secrets.MASTODON_ACCESS_TOKEN }}" >> $GITHUB_ENV
echo "BLUESKY_PASSWORD=${{ secrets.BLUESKY_PASSWORD }}" >> $GITHUB_ENV
echo "MATRIX_ACCESS_TOKEN=${{ secrets.MATRIX_ACCESS_TOKEN }}" >> $GITHUB_ENV
echo "SLACK_ACCESS_TOKEN=${{ secrets.SLACK_ACCESS_TOKEN }}" >> $GITHUB_ENV
echo "MASTODON_EU_FR_TOKEN=${{ secrets.MASTODON_EU_FR_TOKEN }}" >> $GITHUB_ENV
- name: Run composite action
id: composite_action
uses: ./.github/actions/galaxy-social
with:
preview: "true"
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.number }}
MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }}
BLUESKY_PASSWORD: ${{ secrets.BLUESKY_PASSWORD }}
MATRIX_ACCESS_TOKEN: ${{ secrets.MATRIX_ACCESS_TOKEN }}
SLACK_ACCESS_TOKEN: ${{ secrets.SLACK_ACCESS_TOKEN }}
MASTODON_EU_FR_TOKEN: ${{ secrets.MASTODON_EU_FR_TOKEN }}
19 changes: 10 additions & 9 deletions .github/workflows/publish_content.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Set environment variables
run: |
echo "PR_NUMBER=${{ github.event.number }}" >> $GITHUB_ENV
echo "GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}" >> $GITHUB_ENV
echo "MASTODON_ACCESS_TOKEN=${{ secrets.MASTODON_ACCESS_TOKEN }}" >> $GITHUB_ENV
echo "BLUESKY_PASSWORD=${{ secrets.BLUESKY_PASSWORD }}" >> $GITHUB_ENV
echo "MATRIX_ACCESS_TOKEN=${{ secrets.MATRIX_ACCESS_TOKEN }}" >> $GITHUB_ENV
echo "SLACK_ACCESS_TOKEN=${{ secrets.SLACK_ACCESS_TOKEN }}" >> $GITHUB_ENV
echo "MASTODON_EU_FR_TOKEN=${{ secrets.MASTODON_EU_FR_TOKEN }}" >> $GITHUB_ENV
- name: Run composite action
id: composite_action
uses: ./.github/actions/galaxy-social
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.number }}
MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }}
BLUESKY_PASSWORD: ${{ secrets.BLUESKY_PASSWORD }}
MATRIX_ACCESS_TOKEN: ${{ secrets.MATRIX_ACCESS_TOKEN }}
SLACK_ACCESS_TOKEN: ${{ secrets.SLACK_ACCESS_TOKEN }}
MASTODON_EU_FR_TOKEN: ${{ secrets.MASTODON_EU_FR_TOKEN }}

0 comments on commit 7c81004

Please sign in to comment.