.github/workflows/emails.yml: switch from archived action

Signed-off-by: Anna (cybertailor) Vyalkova <cyber+gentoo@sysrq.in>
This commit is contained in:
Anna (cybertailor) Vyalkova
2023-04-23 19:39:38 +05:00
parent 23388935bd
commit 8784e6fe4b

View File

@@ -12,12 +12,10 @@ jobs:
bugzilla: bugzilla:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: nrwl/last-successful-commit-action@v1 - name: Setup Python
id: last_successful_commit uses: actions/setup-python@v4
with: with:
branch: 'dev' python-version: 3.x
workflow_id: 'emails.yml'
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repo - name: Checkout repo
uses: actions/checkout@v3 uses: actions/checkout@v3
@@ -25,31 +23,36 @@ jobs:
ref: dev ref: dev
fetch-depth: 0 fetch-depth: 0
- uses: actions/setup-python@v3 - name: Get compare commit
with:
python-version: 3.x
- name: Validate compare commit
run: | run: |
if git rev-parse --verify "${{ steps.last_successful_commit.outputs.commit_hash }}^{commit}"; then COMMIT=$(gh run list -R ${GITHUB_REPOSITORY} --branch=dev --workflow=emails.yml --status=success --limit=1 --json=headSha --jq=".[0].headSha")
echo "is_commit_valid=true" >> ${GITHUB_ENV} echo "last_successful_commit=${COMMIT}" >> "${GITHUB_ENV}"
echo "Workflow last succeeded on commit ${COMMIT:0:7}"
if git rev-parse --verify "${COMMIT}^{commit}"; then
echo -e "\033[92m\u2713 ${COMMIT:0:7} points to a valid commit"
VALID=true
else else
echo "is_commit_valid=false" >> ${GITHUB_ENV} echo -e "\033[91m\u2717 ${COMMIT:0:7} doesn't point to a valid commit"
VALID=false
fi fi
echo "is_commit_valid=${VALID}" >> "${GITHUB_ENV}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get changed files - name: Get changed files
id: changed-files
if: ${{ fromJSON(env.is_commit_valid) }} if: ${{ fromJSON(env.is_commit_valid) }}
uses: tj-actions/changed-files@v35 uses: tj-actions/changed-files@v35
with: with:
base_sha: ${{ steps.last_successful_commit.outputs.commit_hash }} base_sha: ${{ env.last_successful_commit }}
write_output_files: true
files: | files: |
**/metadata.xml **/metadata.xml
- name: Check Emails against bugzilla - name: Check emails against Bugzilla
if: ${{ fromJSON(env.is_commit_valid) }} if: ${{ fromJSON(env.is_commit_valid) }}
run: | run: |
python ./scripts/email-checker.py ${{ steps.changed-files.outputs.all_changed_files }} python ./scripts/email-checker.py < .github/outputs/all_changed_files.txt
- name: Inform on IRC - name: Inform on IRC
if: ${{ failure() && github.repository == 'gentoo/guru' && github.event_name == 'push' }} if: ${{ failure() && github.repository == 'gentoo/guru' && github.event_name == 'push' }}