Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion bioccheck_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Even if you use the Workflow Generator, you must perform these one-time reposito

**For Codecov:**
1. **Obtain Codecov Token**: Log in to [Codecov](https://about.codecov.io/), link your repository, and copy the repository upload token.
2. **Set Repository Secret**: In your GitHub repository, navigate to **Settings** → **Secrets and variables** → **Actions** → **New repository secret**. Create a secret named `CODECOV_TOKEN` containing your token.
2. **Set Repository Secret**: In your GitHub repository, navigate to **Settings** → **Secrets and variables** → **Actions** → **New repository secret**. Create a secret named `CODECOV_TOKEN` containing your token. Because `ci.yml` uses `secrets: inherit`, the token is passed to the workflow automatically.

**For `pkgdown`:**
1. **Configure GitHub Pages Source**: In your package repository on GitHub, navigate to **Settings** → **Pages**. Under **Build and deployment** → **Source**, select **GitHub Actions** (do NOT select "Deploy from a branch").
Expand Down
4 changes: 1 addition & 3 deletions ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,4 @@ jobs:
with:
error_on: 'warning'
enable_pkgdown: false
# Required only if you want test coverage via Codecov
# secrets:
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
secrets: inherit
29 changes: 3 additions & 26 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -299,16 +299,6 @@ <h2>Configuration</h2>
</label>
</div>

<div class="form-group">
<label>
<input type="checkbox" id="opt-codecov">
<div class="label-text-wrapper">
<span>Enable Codecov</span>
<span class="help-text">Uploads test coverage to Codecov using covr. <a href="https://github.com/bioconductor/workflows/blob/main/bioccheck_usage.md#repository-setup-for-optional-features" target="_blank" style="color: var(--accent-primary); text-decoration: none;">Requires a CODECOV_TOKEN repository secret.</a></span>
</div>
</label>
</div>

<div class="form-group">
<label>
<input type="checkbox" id="opt-cyclocomp">
Expand Down Expand Up @@ -351,20 +341,18 @@ <h2>Generated YAML</h2>
<script>
document.addEventListener('DOMContentLoaded', () => {
const elPkgdown = document.getElementById('opt-pkgdown');
const elCodecov = document.getElementById('opt-codecov');
const elCyclocomp = document.getElementById('opt-cyclocomp');
const elErrorOn = document.getElementById('opt-error-on');
const elOutput = document.getElementById('yaml-output');
const btnCopy = document.getElementById('copy-btn');

// Listeners
[elPkgdown, elCodecov, elCyclocomp, elErrorOn].forEach(el => {
[elPkgdown, elCyclocomp, elErrorOn].forEach(el => {
el.addEventListener('change', generateYaml);
});

function generateYaml() {
const hasPkgdown = elPkgdown.checked;
const hasCodecov = elCodecov.checked;
const hasCyclocomp = elCyclocomp.checked;
const errorOn = elErrorOn.value;

Expand All @@ -378,7 +366,8 @@ <h2>Generated YAML</h2>
jobs: {
bioccheck: {
uses: 'bioconductor/workflows/.github/workflows/bioccheck.yml@main',
with: {}
with: {},
secrets: 'inherit'
}
Comment on lines 367 to 371
}
};
Expand All @@ -405,18 +394,6 @@ <h2>Generated YAML</h2>
delete workflowObj.jobs.bioccheck.with;
}

// Add secrets block if codecov is enabled
if (hasCodecov) {
// js-yaml handles standard objects well, but for dynamic GHA expressions like ${{ ... }}
// we can just pass it as a string and js-yaml will quote it if needed, or we can use custom type.
// Actually, js-yaml might quote strings with ${{ }}. To avoid quotes, we can post-process or let it quote.
// GHA actually supports quoted strings for expressions, e.g. CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}"
// But standard unquoted is cleaner. Let's let js-yaml dump it, and we will clean up quotes on expressions if present.
workflowObj.jobs.bioccheck.secrets = {
CODECOV_TOKEN: '${{ secrets.CODECOV_TOKEN }}'
};
}

// Serialize object to YAML
let yamlString = jsyaml.dump(workflowObj, {
lineWidth: -1,
Expand Down