Prevent Postprocess workflow from running again #102
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
name: Postprocess | ||
on: | ||
push: | ||
branches: ["master"] | ||
workflow_dispatch: | ||
concurrency: | ||
group: "postprocess" | ||
cancel-in-progress: false | ||
jobs: | ||
postprocess: | ||
name: Postprocess | ||
runs-on: ubuntu-latest | ||
# if: github.repository == 'octo-org/octo-repo-prod' | ||
steps: | ||
- name: Test | ||
run: | | ||
Check failure on line 20 in .github/workflows/postprocess.yaml GitHub Actions / PostprocessInvalid workflow file
|
||
echo ${{ toJson(github.event)["head_commit"]["committer"]["username"] }} | ||
- name: Dump GitHub context | ||
env: | ||
GITHUB_CONTEXT: ${{ toJson(github) }} | ||
run: echo "$GITHUB_CONTEXT" | ||
- name: Dump job context | ||
env: | ||
JOB_CONTEXT: ${{ toJson(job) }} | ||
run: echo "$JOB_CONTEXT" | ||
- name: Dump steps context | ||
env: | ||
STEPS_CONTEXT: ${{ toJson(steps) }} | ||
run: echo "$STEPS_CONTEXT" | ||
- name: Dump runner context | ||
env: | ||
RUNNER_CONTEXT: ${{ toJson(runner) }} | ||
run: echo "$RUNNER_CONTEXT" | ||
- name: Dump strategy context | ||
env: | ||
STRATEGY_CONTEXT: ${{ toJson(strategy) }} | ||
run: echo "$STRATEGY_CONTEXT" | ||
- name: Dump matrix context | ||
env: | ||
MATRIX_CONTEXT: ${{ toJson(matrix) }} | ||
run: echo "$MATRIX_CONTEXT" | ||
- name: Clone repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 2 # To be able to `commit --amend` | ||
token: ${{ secrets.GH_PAT }} | ||
- name: Get changed files | ||
if: github.event_name == 'push' | ||
id: changed-files | ||
uses: tj-actions/changed-files@v40 | ||
with: | ||
write_output_files: true | ||
json: true | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: 3.11 | ||
cache: pip | ||
cache-dependency-path: .github/requirements.txt | ||
- name: Install Python dependencies | ||
working-directory: .github | ||
run: pip install -r requirements.txt | ||
- name: Run postprocess | ||
working-directory: .github/src | ||
run: python postprocess.py | ||
- name: Delete temporary files | ||
run: rm -rf .github/outputs | ||
- name: Get last commit message and author | ||
id: last-commit | ||
run: | | ||
echo "message=$(git log -1 --pretty=%s)" >> $GITHUB_OUTPUT | ||
echo "author=$(git log -1 --pretty=\"%an <%ae>\")" >> $GITHUB_OUTPUT | ||
- name: Commit and push changes | ||
uses: stefanzweifel/git-auto-commit-action@v5 | ||
with: | ||
commit_options: --amend | ||
push_options: --force | ||
skip_fetch: true | ||
commit_message: ${{ steps.last-commit.outputs.message }} | ||
commit_user_name: GitHub Actions | ||
commit_author: ${{ steps.last-commit.outputs.author }} |