Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ci-checks #66

Merged
merged 38 commits into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
1cc959a
test: pr checks
Firgrep Aug 17, 2024
7bb2227
ci: format code with Prettier [on behalf of Firgrep]
actions-user Aug 17, 2024
4eb75f4
test: add permissions to workflow
Firgrep Aug 17, 2024
ae9bea8
ci: format code with Prettier [on behalf of Firgrep]
actions-user Aug 17, 2024
9e5c9ed
test: manual trigger in workflow
Firgrep Aug 17, 2024
4062bfd
ci: format code with Prettier [on behalf of Firgrep]
actions-user Aug 17, 2024
70719a7
fix: add token
Firgrep Aug 17, 2024
4d925da
ci: format code with Prettier [on behalf of Firgrep]
actions-user Aug 17, 2024
3805d0b
test: status set
Firgrep Aug 17, 2024
4ab0c99
chore: merge
Firgrep Aug 17, 2024
760cc5a
fix: script feedback to pr
Firgrep Aug 17, 2024
9e05c63
ci: format code with Prettier [on behalf of Firgrep]
actions-user Aug 17, 2024
3be8454
test: checks creation
Firgrep Aug 17, 2024
0374f67
ci: format code with Prettier [on behalf of Firgrep]
actions-user Aug 17, 2024
4b3d725
test: pr id pass
Firgrep Aug 17, 2024
f099844
ci: format code with Prettier [on behalf of Firgrep]
actions-user Aug 17, 2024
6aba174
fix: workflow event
Firgrep Aug 17, 2024
a0961a5
ci: format code with Prettier [on behalf of Firgrep]
actions-user Aug 17, 2024
1dbf00d
test: using script to get sha
Firgrep Aug 17, 2024
d6b82c3
ci: format code with Prettier [on behalf of Firgrep]
actions-user Aug 17, 2024
0fc512c
test: further changes
Firgrep Aug 17, 2024
1cba48a
ci: format code with Prettier [on behalf of Firgrep]
actions-user Aug 17, 2024
91d4caf
test: use commit sha from change
Firgrep Aug 17, 2024
220f648
ci: format code with Prettier [on behalf of Firgrep]
actions-user Aug 17, 2024
526ff10
test: combined approach
Firgrep Aug 17, 2024
39405c1
ci: format code with Prettier [on behalf of Firgrep]
actions-user Aug 17, 2024
74484e2
test: dual workflows test
Firgrep Aug 17, 2024
8507ed5
ci: format code with Prettier [on behalf of Firgrep]
actions-user Aug 17, 2024
0fc8274
test: types specification for verify
Firgrep Aug 17, 2024
37535d2
ci: format code with Prettier [on behalf of Firgrep]
actions-user Aug 17, 2024
13b15d5
test: with separate app
Firgrep Aug 17, 2024
ca06478
ci: format code with Prettier [on behalf of Firgrep]
actions-user Aug 17, 2024
5adb49b
test: removing reduancies and testing
Firgrep Aug 17, 2024
80324d6
ci: format code [automated action on behalf of Firgrep]
actions-user Aug 17, 2024
7a9cdcd
chore: final cleanup and test
Firgrep Aug 17, 2024
eb7d3bf
ci: format code [automated action on behalf of Firgrep]
actions-user Aug 17, 2024
d7bf466
test: make citation error
Firgrep Aug 17, 2024
44a422c
test: remove citation error
Firgrep Aug 17, 2024
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
89 changes: 0 additions & 89 deletions .github/workflows/pr_quality_control.yaml

This file was deleted.

14 changes: 9 additions & 5 deletions .github/workflows/verify_formatting.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,21 @@ on:

jobs:
formatting:
permissions:
contents: "write"
pull-requests: "write"

runs-on: ubuntu-latest
steps:

- name: Generate COG token
id: create_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.COG_APP_ID }}
private_key: ${{ secrets.COG_PRIVATE_KEY }}

- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ steps.create_token.outputs.token }}

- name: Set up Node.js
uses: actions/setup-node@v4
Expand All @@ -40,6 +44,6 @@ jobs:
git config --global user.email "[email protected]"
if [[ `git status --porcelain` ]]; then
git add .
git commit -m "ci: format code with Prettier [on behalf of ${{ github.event.pull_request.user.login }}]"
git commit -m "ci: format code [automated action on behalf of ${{ github.event.pull_request.user.login }}]"
git push origin HEAD:${{ github.event.pull_request.head.ref }}
fi
18 changes: 7 additions & 11 deletions .github/workflows/verify_mdx_content.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,19 @@ name: Verify MDX Content

on:
workflow_dispatch:
workflow_run:
workflows: ["Verify formatting"]
types:
- completed

pull_request:
branches: [main]

jobs:
verification:
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v4
# with:
# ref: ${{ github.event.pull_request.head.sha }}
- name: Checkout
uses: actions/checkout@v4

- uses: actions/cache/restore@v4
- name: Revive Prepyrus
uses: actions/cache/restore@v4
id: prepyrus-cache-restore
with:
path: target/release/prepyrus
Expand All @@ -32,6 +29,7 @@ jobs:
run: cargo build --release --package prepyrus

- name: Run prepyrus script in verification mode
id: prepyrus-run
run: target/release/prepyrus absolute_bibliography.bib src/pages verify

- name: Save Prepyrus to cache
Expand All @@ -42,8 +40,6 @@ jobs:
path: target/release/prepyrus
key: ${{ runner.os }}-cargo-${{ hashFiles('scripts/prepyrus/Cargo.lock') }}-${{ hashFiles('scripts/prepyrus/src/**') }}



# To include multiple paths for the cache:
# path: |
# ~/.cargo/bin/
Expand Down
109 changes: 109 additions & 0 deletions logs/deprecated/workflow_experiments.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Discarded workflow experiments

on:
workflow_dispatch:
# inputs:
# pr_id:
# description: 'Pull Request ID'
# required: true
# workflow_run:
# workflows: ["Verify formatting"]
# types:
# - completed
pull_request:
branches: [main]

env:
GH_TOKEN: ${{ github.token }}
#
# ! NOTE, these steps are not meant to be run together,
# ! they are just snippets from different workflows
#
jobs:
formatting:
permissions:
contents: "write"
pull-requests: "write"
actions: "write"

runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ steps.create_token.outputs.token }}

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Get Prettier version from package-lock.json
run: |
PRETTIER_VERSION=$(grep -m 1 'prettier' package-lock.json | cut -d '"' -f 4 | cut -c 2-)
echo $PRETTIER_VERSION

- name: Run Prettier (specific version)
run: |
npx --yes prettier@$PRETTIER_VERSION --config .prettierrc --write .

#extract the latest commit sha from the PR
- name: Check for changes
id: check-changes
run: |
git config --global user.name "sPhil_PR_quality_ctl"
git config --global user.email "[email protected]"
if [[ `git status --porcelain` ]]; then
git add .
git commit -m "ci: format code with Prettier [on behalf of ${{ github.event.pull_request.user.login }}]"
git push origin HEAD:${{ github.event.pull_request.head.ref }}
COMMIT_SHA=$(git rev-parse HEAD)
echo "Commit SHA: $COMMIT_SHA"
echo "::set-output name=commit_sha::$COMMIT_SHA"
fi

#extract the latest commit sha from the PR using script
- name: Get sha from PR number and save output
id: get-sha
uses: actions/github-script@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
console.log('PR number: ' + ${{ github.event.pull_request.number }})
const pr = await github.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: ${{ github.event.pull_request.number }}
})
console.log('PR Head sha: ' + pr.data.head.sha)
core.setOutput('sha', pr.data.head.sha)

#invoke another workflow using custom inputs
- name: Invoke workflow
run: |
echo "SHA: ${{ steps.check-changes.outputs.commit_sha }}"
gh workflow run verify_mdx_content.yaml --ref ${{ github.event.pull_request.head.ref }} -f pr_id=${{ steps.check-changes.outputs.commit_sha }}
# pr_id=${{ steps.get-sha.outputs.sha }}

#creating checks for the workflow
- name: Report tests check
uses: actions/github-script@v3
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.checks.create({
name: 'prepyrus verification',
head_sha: '${{ github.event.inputs.pr_id }}',
status: 'completed',
conclusion: '${{ steps.prepyrus-run.outcome }}',
output: {
title: 'Prepyrus verification',
summary: 'Results: ${{ steps.prepyrus-run.outcome }}'
},
owner: context.repo.owner,
repo: context.repo.repo
})
if: always()

# head_sha: '${{ github.event.inputs.pr_id }}',