ci: fix permissions of GITHUB_TOKEN via gh auth setup-git #120
Workflow file for this run
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: Run plugin-cargo | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
push: | |
branches: [ main, feat/* ] | |
permissions: write-all | |
env: | |
CARGO_TERM_COLOR: always | |
# GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
GITHUB_TOKEN: ${{ github.token }} | |
RUST_LOG: info | |
# database branch | |
DATABASE: debug | |
BOT: 1 | |
# repos-default.json tag in database release | |
TAG_REPOS_DEFAULT: cache-v8.redb | |
OS_CHECKER_CONFIGS: repos.json | |
# OS_CHECKER_CONFIGS: repos-default.json repos-ui.json | |
jobs: | |
run: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@nightly | |
with: | |
components: rustfmt, clippy | |
- name: Fetch os-checker config JSONs | |
run: | | |
wget https://github.com/os-checker/database/releases/download/${{ env.TAG_REPOS_DEFAULT }}/repos-default.json | |
wget https://raw.githubusercontent.com/os-checker/os-checker/refs/heads/main/assets/repos-ui.json | |
echo '{"os-checker/os-checker":{}}' > repos.json | |
- name: Install cargo-nextest | |
run: | | |
wget https://github.com/nextest-rs/nextest/releases/download/cargo-nextest-0.9.81/cargo-nextest-0.9.81-x86_64-unknown-linux-gnu.tar.gz | |
tar xzvf cargo-nextest-0.9.81-x86_64-unknown-linux-gnu.tar.gz | |
mv cargo-nextest ~/.cargo/bin | |
- name: Install os-checker | |
run: | | |
wget https://github.com/os-checker/database/releases/download/precompiled-checkers/os-checker -O ~/.cargo/bin/os-checker | |
chmod +x ~/.cargo/bin/os-checker | |
os-checker config --list-repos | |
# - name: Test get_release_count | |
# run: cargo test -- test_get_release_count --nocapture | |
# | |
# - name: Test os-checker layout --list-targets | |
# run: cargo test -- test_sel4 --nocapture | |
# | |
# - name: Test pkg_targets | |
# run: cargo test -- test_pkg_targets --nocapture | |
- name: Install plugin-cargo | |
run: cargo install --path . | |
- name: Run plugin-cargo | |
run: | | |
os-checker-plugin-cargo #os-checker.json | |
tree --gitignore -h cargo | |
- name: Push to database | |
env: | |
PLUGIN_PATH: plugin/cargo | |
run: | | |
git config --global user.name "zjp-CN[bot]" | |
git config --global user.email "zjp-CN[bot]@users.noreply.github.com" | |
echo "正在 clone os-checker/database" | |
# git clone https://x-access-token:${{ env.GITHUB_TOKEN }}@github.com/os-checker/database.git | |
gh repo clone os-checker/database | |
gh auth setup-git | |
echo "成功 clone os-checker/database" | |
cd database | |
git switch ${{ env.DATABASE }} | |
rm -rf ${{ env.PLUGIN_PATH }} | |
mkdir -p ${{ env.PLUGIN_PATH }} | |
mv ../cargo ${{ env.PLUGIN_PATH }}/info | |
bash ../push.sh | |